Commit 438990a4 authored by mva021's avatar mva021
Browse files

Separated out GameSupplier class to a file of its own.

parent d6ea32a9
package inf101.v20.sem2.mnkgames.GUI;
import java.util.function.Supplier;
import inf101.v20.sem2.mnkgames.ConnectFour;
import inf101.v20.sem2.mnkgames.MNKGame;
import inf101.v20.sem2.mnkgames.TicTacToe;
public class GUIMain {
public static void main(String[] args) {
......@@ -12,19 +7,3 @@ public class GUIMain {
}
}
class GameSupplier implements Supplier<MNKGame>{
@Override
public MNKGame get() {
return null;
}
public MNKGame getConnectFourGame() {
return new ConnectFour();
}
public MNKGame getTicTacToeGame() {
return new TicTacToe();
}
}
package inf101.v20.sem2.mnkgames.GUI;
import inf101.v20.sem2.mnkgames.ConnectFour;
import inf101.v20.sem2.mnkgames.MNKGame;
import inf101.v20.sem2.mnkgames.TicTacToe;
/**
* Simple class to return new instances of MNK games
* If your constructors are simple like here this class does nothing.
* But if the constructors need specific inputs that could be handled here.
* E.g. a list of players
* @author mva021
*
*/
class GameSupplier{
public MNKGame getConnectFourGame() {
return new ConnectFour();
}
public MNKGame getTicTacToeGame() {
return new TicTacToe();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment