Home > Computer Programming > Thursday 12th September

Thursday 12th September

September 12, 2013 Leave a comment Go to comments

Here is the presentation about string functions and the Caesar cipher. It contains a number of problems and clues about how to solve them.

Microsoft_PowerPoint_Icon
Presentation

Further Tasks:

  1. Write a function isPalindrome() that takes a string argument and returns true if it is a palindrome and false otherwise.
  2. Write a program to play hangman.
  3. Write a program to play the game Mastermind. Instead of using colours (red, blue, green, yellow, white, black), use numbers (1, 2, 3, 4, 5, 6). Functions you might consider coding are:
    • getRandomCode(), which returns a random 4-digit string of numbers from 1 to 6, e.g. 2345, or 1664.
    • getUserGuess(), which asks the user for their guess and returns the result
    • processGuess(), which takes the user’s current guess and returns a list of two numbers:
      • the first being how many numbers are correct and in the right place
      • the second being how many numbers are correct but in the wrong place
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s