Skip to content

Latest commit

 

History

History
31 lines (11 loc) · 2.85 KB

Challenges 71-80.md

File metadata and controls

31 lines (11 loc) · 2.85 KB

Challenges 71-80: "Hexa what?"

  1. Write a program to model an ATM. You need to devise a way to store people's PIN, account number and current balance. Users authenticate themselves with the correct account number and pin combination. When they're in credit, they can withdraw or deposit money into their account. Do not let them withdraw more than they have available. Make sure you reduce the amount of money available after a successful withdrawal. Money can be depositied but the amounts must be possible with paper notes only.

  2. Scrabble 1: Create a dictionary file. Lookup the number and values of tiles in a game of scrabble. Shuffle the tiles. Deal them out and ask the user to make a word. Ensure the word is possible from the tiles given. Make sure that the word is in the dictionary. Calculate the score if the word is valid and add this to the users score. Deal them more tiles. Extension: Make this a multi user game.

  3. Scrabble 2: Extend your program from the last task so that the board is also represented. Display the board to the user and ask them where the word should be placed. Your program should take account of the letters that are already in place.

  4. Scrabble 3: Now include all the double and tripple letter and word scores. Keep tabs on the score of the user. Extension: use a UI module to make this look like a real scrabble board.

  5. Vowel square: Ask the user for the sqaure size and generate a square where each space is filled with a randomly generated letter. Display the square. Now ask the user for another square size which must be smaller than the original. Can you find any square, of the smaller size, in the original square that only contains vowels?

  6. Draughts. Write a game of draughts.

  7. Farm simulator: Write a simulation that has a field of a specified size. Each space can contain a seed, a plant or be empty. Every spring the seeds turn into plants. Every Autumn the plants scatter seeds. The seeds cannot land on a space that contains a plant. Each space can only contain one plant or one seed at a time. Run the simulation for 5 years showing the state of the field at the end of every spring and every autumn.

  8. Farm simulator 2: Modify your simulator to include events that can happen in winter and summer. In any given winter there is a 20% chance that there will be a frost. If there is a frost there is a 30% chance that each seed will die. In summer there is a 15% chance that there will be a drought. When there is a drought each plant has a 20% chance that it can die.

  9. Farm simulator 3: Modify it again. Ask the user how many years the simulation should run for, if the state of the field should be shown each season and what the chance of each event happening should be for this run.

  10. Write a game of hexapawn - you'll have to investigate what that is! Allow the game to be played by two players, taking it in turn.