Here is the presentation about string functions and the Caesar cipher. It contains a number of problems and clues about how to solve them.
- Write a function isPalindrome() that takes a string argument and returns true if it is a palindrome and false otherwise.
- Write a program to play hangman.
- 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