Guest User

Untitled

a guest
Feb 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. e.g.3x3 tic tac toe we'll number them 1,2,3,4,...
  2. could have chosen a 3x3 array but we'll just do 1-9.
  3.  
  4. also have to take care of x and o
  5. human and computer also.
  6.  
  7. x or o goes first
  8. human
  9. computer
  10.  
  11. we have to allow either to be x or o, and also allow human and computer to be the thing that goes first.
  12.  
  13.  
  14. board( ) = 0 for blank
  15. 1 for human move, this is more fundamental. want to evaluate the best move for the computer
  16. 2 for computer move
  17.  
  18. so if x in 2 and o in 6
  19.  
  20.  
  21. board(2) = 1
  22. board(6) = 2
  23.  
  24.  
  25. board = 0 1 0
  26. 0 0 2
  27. 0 0 0
  28.  
  29. to write a subroutine
  30.  
  31. printboard that will just print out the current state of the board.
  32. contents of board array, etc. what should print to the screen
  33.  
  34. hint: if you define a character array, x is character not a number...you define a character array cboard(9) and assign elements of it to blank, x, or o and depends on contents of WHAT
  35.  
  36. subroutine has to have two arguments
  37. 1: board
  38. 2: player x who determines who is x and who is o
Add Comment
Please, Sign In to add comment