hw1/src/main/java/controllers/PlayGame.java
/**
   * Asynchronously calls sendGameBoardToAllPlayers after a delay.
   * Catches the IO exception and prints to stack trace.
   * @param gameBoardJson Gameboard JSON
   * @param secDelay The number of seconds to wait before the call.
   */
Asynchronously calls sendGameBoardToAllPlayers after a delay.
Catches the IO exception and prints to stack trace.
@param gameBoardJson Gameboard JSON
@param secDelay The number of seconds to wait before the call.
Asynchronously calls sendGameBoardToAllPlayers after a delay . Catches the IO exception and prints to stack trace . @param gameBoardJson Gameboard JSON @param secDelay The number of seconds to wait before the call .
private static void sendGameBoardToAllPlayers(final String gameBoardJson, final int secDelay) {
    Thread thread = new Thread(new Runnable() {
      public void run() {
        try {
          TimeUnit.SECONDS.sleep(secDelay);
          sendGameBoardToAllPlayers(new Gson().toJson(board));
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
      }
    });
    thread.start();
  }
private static void sendGameBoardToAllPlayers ( final String gameBoardJson , final int secDelay ) { Thread thread = new Thread ( new Runnable ( ) { public void run ( ) { try { TimeUnit . SECONDS . sleep ( secDelay ) ; sendGameBoardToAllPlayers ( new Gson ( ) . toJson ( board ) ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } } ) ; thread . start ( ) ; }
Asynchronously calls sendGameBoardToAllPlayers after a delay.
Asynchronously calls sendGameBoardToAllPlayers after a delay .