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 RoundResult
play(int x)
Overrides the method to throw anUnsupportedOperationException
since 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 anUnsupportedOperationException
since it's not allowed to be called on a free positioned Connect4 game.- Overrides:
play
in classConnect4
- Parameters:
x
- X coordinate which has to be between 1 and 7- Returns:
- A
RoundResult
containing a message and a boolean telling if the round was valid
-
-