Klasse Server
java.lang.Object
Server.Server
Server
This is the Server for the Tic Tac Toe Game
!!!Attention the IPs must be set to the IPs of the Clients!!!
- Version:
- 1.0
- Autor:
- Julian Lombardo, Diego Zwahlen, Lean Melone
-
Feldübersicht
Felder -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifikator und TypMethodeBeschreibungstatic StringboardToString(char[] board) Transforms the board to a Stringstatic booleancheckWin(char[] board, char player) Checks for a win on the boardstatic voidMainfunction for the Serverstatic voidsendCurrentBoard(char[] board, InetAddress player1, InetAddress player2, DatagramSocket socket) Sends current Board to all Playersstatic voidsendMessageToPlayer(InetAddress Player, DatagramSocket socket, String msg) Sends Messages to certain Playersstatic voidwin(InetAddress activePlayer, DatagramSocket socket, int fullCounter) Handels the different kind of wins/draws
-
Felddetails
-
playing
public static boolean playing -
board
public static char[] board
-
-
Konstruktordetails
-
Server
public Server()
-
-
Methodendetails
-
main
-
win
public static void win(InetAddress activePlayer, DatagramSocket socket, int fullCounter) throws IOException Handels the different kind of wins/draws- Parameter:
activePlayer-socket-fullCounter-- Löst aus:
IOException
-
boardToString
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
-