Homework # 1 (Due Date: Saturday July 7 by Midnight)

Submit your homework via E-learning

Name your code file StudentID_FirstName.cpp

Download and run the executable file to have a better idea of what the homework should do.

Download the framework code Hw1.cpp and add your code there.

We are going to build Tic Tac Toe game where two players take turn inserting circles or crosses into a 3x3 grid. The first to lay out a vertical, horizonatal, or diangonal row of circles or crosses wins the game.

Visit RGB color picker to lookup red, green, and blue for colors

  1. [DONE] Prompt the players to enter their first names.
  2. [DONE] Draw a 3x3 grid of cells that occupies the bottom 50% of the drawing space. (function DrawGrid)
  3. [TODO] Draw two players (with different colors) on the left and right sides of the grid. Their names should appear too.
  4. [TODO] Highlight the active player by drawing a rectangle around him.
  5. [DONE] When a player wins the game or the game ends with a tie a message appears on the screen and the players can no longer click on the grid cells.
  6. [Partially DONE] When player 1 clicks on an empty cell a circle is drawn inside that cell. Cross is drawn when player 2 clicks inside an empty cell.
  7. [TODO] When a player makes out a vertical, horizonatal, or diangonal row of circles or crosses he wins and the game is over.
  8. [TODO] When all cells are clicked and it is not a win then it is a tie and the game is over.
  9. [TODO] Press 'R' or 'r' on the keyboard resets the game.
  10. [DONE] Press “ESC” on the keyboard to exit the application.