Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hanabi network code
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fireworks Competition
hanabi network code
Commits
70146f23
There was a problem fetching the pipeline mini graph.
Commit
70146f23
authored
7 years ago
by
Piers Williams
Browse files
Options
Downloads
Patches
Plain Diff
Hopefully it now will accept a seed
parent
047de2fa
Branches
master
No related tags found
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/com/fossgalaxy/games/fireworks/NetServer.java
+6
-1
6 additions, 1 deletion
src/main/java/com/fossgalaxy/games/fireworks/NetServer.java
with
6 additions
and
1 deletion
src/main/java/com/fossgalaxy/games/fireworks/NetServer.java
+
6
−
1
View file @
70146f23
...
@@ -26,6 +26,7 @@ public class NetServer {
...
@@ -26,6 +26,7 @@ public class NetServer {
public
static
void
main
(
String
[]
args
)
throws
FileNotFoundException
{
public
static
void
main
(
String
[]
args
)
throws
FileNotFoundException
{
boolean
running
=
true
;
boolean
running
=
true
;
Long
seed
=
null
;
OptionParser
parser
=
new
OptionParser
();
OptionParser
parser
=
new
OptionParser
();
...
@@ -33,6 +34,7 @@ public class NetServer {
...
@@ -33,6 +34,7 @@ public class NetServer {
parser
.
accepts
(
"players"
).
withOptionalArg
().
defaultsTo
(
"2"
);
parser
.
accepts
(
"players"
).
withOptionalArg
().
defaultsTo
(
"2"
);
parser
.
accepts
(
"numAI"
).
withOptionalArg
().
defaultsTo
(
"0"
);
parser
.
accepts
(
"numAI"
).
withOptionalArg
().
defaultsTo
(
"0"
);
parser
.
accepts
(
"ai"
).
withOptionalArg
().
defaultsTo
(
"iggi"
);
parser
.
accepts
(
"ai"
).
withOptionalArg
().
defaultsTo
(
"iggi"
);
parser
.
accepts
(
"seed"
).
withOptionalArg
();
OptionSet
options
=
parser
.
parse
(
args
);
OptionSet
options
=
parser
.
parse
(
args
);
...
@@ -40,6 +42,9 @@ public class NetServer {
...
@@ -40,6 +42,9 @@ public class NetServer {
int
nPlayers
=
Integer
.
parseInt
(
options
.
valueOf
(
"players"
).
toString
());
int
nPlayers
=
Integer
.
parseInt
(
options
.
valueOf
(
"players"
).
toString
());
int
nAI
=
Integer
.
parseInt
(
options
.
valueOf
(
"numAI"
).
toString
());
int
nAI
=
Integer
.
parseInt
(
options
.
valueOf
(
"numAI"
).
toString
());
String
ai
=
options
.
valueOf
(
"ai"
).
toString
();
String
ai
=
options
.
valueOf
(
"ai"
).
toString
();
if
(
options
.
has
(
"seed"
)){
seed
=
Long
.
parseLong
(
options
.
valueOf
(
"seed"
).
toString
());
}
if
(
nAI
>=
nPlayers
){
if
(
nAI
>=
nPlayers
){
throw
new
IllegalArgumentException
(
"You need to specify more players or less AI's"
);
throw
new
IllegalArgumentException
(
"You need to specify more players or less AI's"
);
...
@@ -95,7 +100,7 @@ public class NetServer {
...
@@ -95,7 +100,7 @@ public class NetServer {
System
.
out
.
println
(
"The game is ready to start"
);
System
.
out
.
println
(
"The game is ready to start"
);
playGame
(
agentNames
,
networkPlayers
,
r
.
nextLong
(),
statOut
);
playGame
(
agentNames
,
networkPlayers
,
(
seed
!=
null
)
?
seed
:
r
.
nextLong
(),
statOut
);
System
.
out
.
println
(
"The game has ended, play again?"
);
System
.
out
.
println
(
"The game has ended, play again?"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment