java - Incorporating a method into a tic tac toe board -


this code far:

import java.util.scanner; import java.util.arrays;  public class tictactoegame {      public static void main(string[] args) {         // todo auto-generated method stub         system.out.println("welcome tic tac toe (you x)!");         string gamebox = new tictactoe().tostring();         system.out.println(gamebox);         usermove(gamebox);     }       public static void usermove(string gameboard) {         scanner keyboard = new scanner (system.in);         int row, column;         string [][] movex = new string [3][3];         {             system.out.print("move location: ");             row = keyboard.nextint();             column = keyboard.nextint();         } while (row < 0 || row > 2 || column < 0 || column > 2);         (int = 0; < movex.length; i++){             (int j = 0; j < movex[i].length; j++){                 if (row == && column == j){                     movex[i][j] = "x";                 }                 else                      movex[i][j] = " ";             }         }         system.out.println(arrays.deeptostring(movex));      } 

i have user enter location want put x on game board. game board, gamebox (taken class), looks this:

============= |   |   |   | ============= |   |   |   | ============= |   |   |   | ============= 

how can "x" inside the game board?


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -