Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Johan Gustav Thrane-Nielsen
inf101.v20.sem2.losning
Commits
438990a4
Commit
438990a4
authored
Apr 16, 2020
by
mva021
Browse files
Separated out GameSupplier class to a file of its own.
parent
d6ea32a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/inf101/v20/sem2/mnkgames/GUI/GUIMain.java
View file @
438990a4
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
();
}
}
src/main/java/inf101/v20/sem2/mnkgames/GUI/GameSupplier.java
0 → 100644
View file @
438990a4
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
();
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment