Day 1 - Tic-Tac-Toe I

April 30-Day Coding Challenge

April 30d Coding Challenge > Tic-Tac-Toe I

Day 1 - Tic-Tac-Toe I

TTT is a two player game with a 3x3 grid. First player picks an open square and puts a X, the second player draws an O. Players take turns till one of the players wins (gets the of the marks in a row). Game is a draw when all 9 squares are filled up without a winner.

Write a program to build a two player game with win/draw detection.

You will be writing the following methods.

  • String play(char player, int x, int y) - Returns
    • OK - if it is player’s turn and the spot is free.
    • BAD - not ok.
  • String checkWin() - Returns
    • X WON - Player X Won
    • O WON - Player O Won
    • DRAW - No winner, board full
    • INPROGRESS - No winner, game not over
    • BAD BOARD - Bad board state, ex. three Xs and only one Os

To Discuss more and follow up, join us at SDE Skills Discord Server, use the #women-in-tech channel.

How to submit your code

  1. Head over to repl.it
  2. create an account / log in.
  3. Code your submission and share it with user @sdeskills
  4. e-mail your submission to [email protected]

Note: While there is no submission deadline per-se, we recommend you answer these questions as soon as they are posted.

Day 1 - Tic-Tac-Toe I

Want the questions emailed?