Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
hanabi
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
IGGI students
hanabi
Commits
05aa3058
Commit
05aa3058
authored
Jul 18, 2019
by
Joseph Walton-Rivers
🐦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add gameover callback
parent
216bd4c6
Pipeline
#2275
passed with stages
in 5 minutes and 24 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
0 deletions
+13
-0
src/main/java/com/fossgalaxy/games/fireworks/GameRunner.java
src/main/java/com/fossgalaxy/games/fireworks/GameRunner.java
+6
-0
src/main/java/com/fossgalaxy/games/fireworks/ai/Agent.java
src/main/java/com/fossgalaxy/games/fireworks/ai/Agent.java
+1
-0
src/main/java/com/fossgalaxy/games/fireworks/ai/AgentPlayer.java
...n/java/com/fossgalaxy/games/fireworks/ai/AgentPlayer.java
+5
-0
src/main/java/com/fossgalaxy/games/fireworks/players/Player.java
...n/java/com/fossgalaxy/games/fireworks/players/Player.java
+1
-0
No files found.
src/main/java/com/fossgalaxy/games/fireworks/GameRunner.java
View file @
05aa3058
...
...
@@ -238,6 +238,12 @@ public class GameRunner {
}
}
}
// tell players about the end of the game
for
(
Player
player
:
players
)
{
player
.
onGameOver
();
}
return
new
GameStats
(
gameID
,
players
.
length
,
state
.
getScore
(),
state
.
getLives
(),
moves
,
state
.
getInfomation
(),
strikes
);
}
catch
(
Exception
ex
)
{
logger
.
error
(
"the game went bang"
,
ex
);
...
...
src/main/java/com/fossgalaxy/games/fireworks/ai/Agent.java
View file @
05aa3058
...
...
@@ -36,6 +36,7 @@ public interface Agent {
default
void
receiveID
(
int
agentID
,
String
[]
names
)
{
receiveID
(
agentID
);
}
default
void
onGameOver
(
int
agentID
,
GameState
state
){
}
@Deprecated
default
void
receiveID
(
int
agentID
)
{
...
...
src/main/java/com/fossgalaxy/games/fireworks/ai/AgentPlayer.java
View file @
05aa3058
...
...
@@ -88,6 +88,11 @@ public class AgentPlayer implements Player {
policy
.
receiveID
(
id
,
names
);
}
@Override
public
void
onGameOver
()
{
policy
.
onGameOver
(
playerID
,
state
.
getCopy
());
}
@Override
public
String
getName
()
{
return
name
;
...
...
src/main/java/com/fossgalaxy/games/fireworks/players/Player.java
View file @
05aa3058
package
com
.
fossgalaxy
.
games
.
fireworks
.
players
;
import
com.fossgalaxy.games.fireworks.state.GameState
;
import
com.fossgalaxy.games.fireworks.state.GameType
;
import
com.fossgalaxy.games.fireworks.state.actions.Action
;
import
com.fossgalaxy.games.fireworks.state.events.GameEvent
;
...
...
Write
Preview
Markdown
is supported
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