Package tk.dmanstrator.connectfour
Class FreePositionedConnect4
- java.lang.Object
-
- tk.dmanstrator.connectfour.Connect4
-
- tk.dmanstrator.connectfour.FreePositionedConnect4
-
public class FreePositionedConnect4 extends Connect4
Implementation for a free positioned Connect4 game. This exists since when I started developing, I implemented it so a player can choose both x and y. Later when I started testing it I recognized my mistake.
-
-
Constructor Summary
Constructors Constructor Description FreePositionedConnect4(java.lang.String firstPlayerName, java.lang.String secondPlayerName)Constructor for a 2 player game free positioned Connect4 game.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RoundResultplay(int x)Overrides the method to throw anUnsupportedOperationExceptionsince it's not allowed to be called on a free positioned Connect4 game.-
Methods inherited from class tk.dmanstrator.connectfour.Connect4
getCurrentField, getCurrentField, getCurrentPlayerName, getFirstPlayerName, getGameLog, getPlayedRounds, getSecondPlayerName, isDraw, isGameOver, play, toString
-
-
-
-
Constructor Detail
-
FreePositionedConnect4
public FreePositionedConnect4(java.lang.String firstPlayerName, java.lang.String secondPlayerName)Constructor for a 2 player game free positioned Connect4 game.- Parameters:
firstPlayerName- Name of the first playersecondPlayerName- Name of the second player
-
-
Method Detail
-
play
public RoundResult play(int x)
Overrides the method to throw anUnsupportedOperationExceptionsince it's not allowed to be called on a free positioned Connect4 game.- Overrides:
playin classConnect4- Parameters:
x- X coordinate which has to be between 1 and 7- Returns:
- A
RoundResultcontaining a message and a boolean telling if the round was valid
-
-