Tags: %TAGME{ tpaction="" web="SCMP118" tag="" }% view all tags

Tick Tack Toe


Create a simple TTT game


  1. Consider the game Tic Tac Toe. How could a game be represented? Represent as a two dimensional array of char.
  2. Manually create a Tic Tac Toe board on the screen with the following:
    X O
    X O
    O X
  3. Write a function "void displayBoard(char board[][3])" to display a Tic Tac Toe game state.
  4. Write a function "void nextMove(char player, char board[][3])" to ask a user for the row and column of a move. player will be 'X' or 'Y', and the program will check is the move is legal.
  5. Write a main program to allow two plays to play, starting with a blank board, and alternating between X and O turns.
  6. Write a routine "bool checkDone(char board[][3], char& winner)" to check for winner. Return true if there is a winner, and return winner ("X" or "O") in winner.
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2017-10-02 - JimSkon
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback