D. Final Algorithm

Algorithm for Othello

  1. Each player chooses either black or white.
  2. Each player places two black and two white pieces in an alternating pattern in the middle of the board in the form of a square.
  3. Black plays first and draws a single disc and places it on a valid spot on the grid.
  4. You must place a disc on a spot that allows you to “flank” or “capture” at least one of your opponent’s discs by bordering them in a row.
  5. You must flip all captured discs to your color.
  6. To capture your opponent’s discs you must have 1 of your own pieces at the end of a row and then on your turn place a new piece at the beginning of the row. Everything in between on that row is now flipped to your color. You can only capture rows of a single color adjacent to each other; there cannot be any open space or your own discs between them or the combo is interrupted.
  7. You can flank any number of discs. You may capture discs vertically, horizontally, diagonally. You may capture in multiple directions at the same time. All discs that can be flipped must be flipped. You cannot pick and choose which ones are captured.
  8. If you cannot make a valid move then your turn is forfeited and your opponent may go again. If you have a valid move available to you then you must make that move and are not allowed to forfeit your turn.
  9. If you have run out of discs, but can still make valid moves, then your opponent must give you one of their own discs to play with. This exchange can continue for as long as needed.
  10. When neither player can make any further play then the game is over.
  11. Each player counts the number of spaces occupied by their color. Highest count is the winner. Games can end before all spaces are filled

 

Hangman algorithm

  1. A random is chosen from a word bank and is represented by stars.
  2. The Player is prompted to guess a letter: if the guess is incorrect the player gets a strike. If the player guesses correctly go to step 4
  3. If the player gets 7 incorrect guesses, or 7 strikes, the player loses, go to step 8
  4. If the player guessed the word correctly, go to step 7. If the player guessed a letter correctly, go to step 5
  5. The AI will tell the player how many of the guessed letter is in the word as well as the location of each of the letters.
  6. If there are any unknown letters left go to step 2. If all letters are known go to step 7
  7. The Player Wins!!! end
  8. The player loses. end