Exercises

  • Use Button instead of clickable Label and add logic that prevents such a button to react to mouse actions after a move is made by any player.
  • Tic Tac Toe
    • Change the code to keep track of last user and computer moves separately so that the last moves of both the players are always highlighted.
    • Add 4x4 board. This will require to connect 4 cells to form a line.
    • Add 'Easy', 'Medium' and 'Hard' modes.
  • Square Tic Tac Toe
    • Add 'Medium' mode which will have algorithm based AI moves but with much better chances for the user to score a win.
    • Write tests to find at least two different sequence of plays which will result in AI losing when the very first move is made by the user.
    • Extend the tests to check if there's a case where the AI loses even when it makes the very first move.
    • See if you can tweak the AI decision making algorithm to be more defensive and never lose (with/without changing the weight calculation).
  • New game
    • Implement Connect Four game.
    • Implement a GUI that allows the user to choose among Tic Tac Toe, Square Tic Tac Toe and Connect Four games.
  • Add sound effects for these projects.
  • Keep track of number of wins/losses for the user and display them. Try to make this information persistent if the user closes the GUI window and opens again later.
  • Coding style

Further Reading