Klasse Server

java.lang.Object
ServerPackage.Server

public class Server extends Object

TicTacToe ServerCreator-Script

Script allows to send messages/responses to Players and has the game logic for Tic-Tac-Toe
Version:
2.1.0
Autor:
Julian Lombardo, Diego Zwahlen, Lean Melone
  • Konstruktordetails

  • Methodendetails

    • startServer

      public void startServer() throws NumberFormatException, Exception
      This is the method, which is started by the thread in the MainGame, to start the server
      Löst aus:
      NumberFormatException
      Exception
    • win

      public void win(InetAddress activePlayer, int fullCounter) throws IOException
      Handels the different kind of wins/draws
      Parameter:
      activePlayer -
      fullCounter -
      Löst aus:
      IOException
    • boardToString

      public static String boardToString(char[] board)
      Transforms the board to a String
      Parameter:
      board -
      Gibt zurück:
      String
    • sendCurrentBoard

      public static void sendCurrentBoard(char[] board, InetAddress player1, InetAddress player2, DatagramSocket socket) throws IOException
      Sends current Board to all Players
      Parameter:
      board -
      player1 -
      player2 -
      socket -
      Löst aus:
      IOException
    • checkWin

      public static boolean checkWin(char[] board, char player)
      Checks for a win on the board
      Parameter:
      board -
      player -
      Gibt zurück:
      boolean
    • sendMessageToPlayer

      public static void sendMessageToPlayer(InetAddress Player, DatagramSocket socket, String msg) throws IOException
      Sends Messages to certain Players
      Parameter:
      Player -
      socket -
      msg -
      Löst aus:
      IOException