Пример #1
0
 /*====================================
 plays one turn of 2048
 ====================================*/
 public void playTurn() {
   String s = Keyboard.readString();
   if (s.equals("w") && swipeU()) addNewTile();
   else if (s.equals("a") && swipeL()) addNewTile();
   else if (s.equals("s") && swipeD()) addNewTile();
   else if (s.equals("d") && swipeR()) addNewTile();
   else return; // if the input is not w a s or d, do nothing
   // System.out.println("\n" + _board);
   System.out.println(_board);
 }
Пример #2
0
 // constructor
 public T048() {
   _board = new Board(4);
   _board.populate(0);
   addNewTile();
   addNewTile();
 }