Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
9a48fce
Implement basic game loop
dienn1 Jul 3, 2024
2a927db
Update HandManager.java
dienn1 Jul 11, 2024
36ce9d4
implement duo actions
dienn1 Aug 1, 2024
dc3fd68
Fix SeaSaltPaperCard copy, temp fix Discard null
dienn1 Aug 1, 2024
e53d312
fix ShellDuo Action
dienn1 Aug 1, 2024
f51db38
Update HandManager.java
dienn1 Aug 2, 2024
d4a3f39
polish some stuff
dienn1 Sep 4, 2024
26baa1d
SeaSaltPaper GUI mockup
dienn1 Sep 19, 2024
8a13002
Generate card front image
dienn1 Nov 24, 2024
769373e
Implemented proper drawPile setup
dienn1 Nov 24, 2024
5121a29
Implement separate deck for playerDiscard
dienn1 Nov 25, 2024
1969d38
Trying to display cards
dienn1 Nov 25, 2024
9be3c59
Colors for cards added as comments
diegopliebana Nov 27, 2024
87d7007
Update SeaSaltPaperParameters.java
diegopliebana Nov 27, 2024
2ed4997
Add CrabDuo, SwimmerSharkDuo
dienn1 Dec 3, 2024
71cfe18
Add Mermaid, add color distributions
dienn1 Dec 5, 2024
4818028
Update LIGHT_ORANGE/ORANGE color
dienn1 Dec 10, 2024
287cd76
Update SeaSaltPaperCard to also contain bonus
dienn1 Dec 10, 2024
4555c4a
Implement protectedHands, SwimmerShark random draw
dienn1 Dec 18, 2024
b49cd25
Update PlayDuo to add DuoBonus to an array in gs
dienn1 Dec 18, 2024
0d60c5c
Implement point calculation
dienn1 Dec 18, 2024
533f1ba
LastChance + Complete Game Loop
dienn1 Jan 13, 2025
03755c8
Implement proper copying
dienn1 Jan 13, 2025
e99710b
Implement valid target checks for Duo
dienn1 Jan 14, 2025
2b3fb56
Implement proper Duo bonus calculation
dienn1 Jan 14, 2025
2cf6f5e
Implement simple redeterminization
dienn1 Jan 14, 2025
eb33574
Implement individual card visibility
dienn1 Jan 15, 2025
3c9e1f0
Update proper hashCode and equals
dienn1 Jan 22, 2025
daa487d
Fixed copy for mutable actions
dienn1 Jan 27, 2025
abe96cb
Update SeaSaltPaperGameState.java
dienn1 Jan 28, 2025
2c3d4a9
Merge branch 'master' into sea-salt-and-paper
dienn1 Jan 28, 2025
d1861f0
Fix SwimmerShark to use DrawRandom
dienn1 Jan 28, 2025
a0a9eee
Update Game.java
dienn1 Jan 28, 2025
e2cd9ad
Implement json container class for gameState
dienn1 Jan 28, 2025
aa97357
Implement save cycle for gameState
dienn1 Jan 30, 2025
ad0e558
Working GUI and some cleanup in other classes
rdgain Feb 6, 2025
fdb4da0
Cleanup, Game runs GUI
rdgain Feb 6, 2025
6e86342
Action strings and cleanup
rdgain Feb 6, 2025
4bf0b12
Update Game.java
dienn1 Feb 6, 2025
65f4519
rename fix SSPGUIManager
dienn1 Feb 6, 2025
2ba1927
rename fix SSPGUIManager
dienn1 Feb 6, 2025
f548673
Implement proper LeadHeuristic
dienn1 Feb 6, 2025
b142191
Merge branch 'gui-and-fixes' into sea-salt-and-paper
dienn1 Feb 6, 2025
4349d72
clean up
dienn1 Feb 6, 2025
2204d92
generate array of random seeds
dienn1 Feb 7, 2025
56a4b9e
clean SeaSaltPaperParameters
dienn1 Feb 12, 2025
af1fce4
add roundStopCondition to SSPGameParameter
dienn1 Feb 17, 2025
c7dbd3f
Merge branch 'master' into sea-salt-and-paper
dienn1 Feb 17, 2025
00adf06
Parameterized collectorBonus as base, increment
dienn1 Feb 22, 2025
6b647a9
Parameterized howManyDiscard for DrawAndDiscard
dienn1 Feb 23, 2025
b0e1421
Update SeaSaltPaperParameters.java
dienn1 Feb 23, 2025
5f2067f
make normalized heuristic for SSP
dienn1 Feb 24, 2025
a1b4cc0
Move AbstractGameStateContainer to core
dienn1 Feb 25, 2025
534379b
implement TunableParameters for SSP
dienn1 Feb 25, 2025
a1fe7d5
Merge branch 'master' into sea-salt-and-paper
dienn1 Feb 25, 2025
ff32ac8
Update Game.java
dienn1 Feb 26, 2025
b37b10d
NTBEA config files for Sea Salt and Paper
diegopliebana Feb 26, 2025
d774e35
Merge branch 'sea-salt-and-paper' of https://github.com/dienn1/Tablet…
diegopliebana Feb 26, 2025
4ac7540
proper setup
diegopliebana Feb 26, 2025
1653268
Update HandManager.java
diegopliebana Feb 27, 2025
898583d
Merge remote-tracking branch 'upstream/SevenWondersFix' into sea-salt…
dienn1 Feb 28, 2025
8b5c954
SSP config runs
diegopliebana Mar 5, 2025
e20b8fa
Merge branch 'sea-salt-and-paper' of https://github.com/dienn1/Tablet…
diegopliebana Mar 5, 2025
9d548b5
Merge branch 'master' of https://github.com/dienn1/TabletopGames
dienn1 Sep 24, 2025
487e584
Update Game.java
dienn1 Oct 27, 2025
de9afe0
Merge remote-tracking branch 'upstream/master'
dienn1 Oct 27, 2025
0b1d963
Clean core stuff, fix Boat Duo copy
dienn1 Feb 10, 2026
686288e
Merge branch 'master' into master
hopshackle Feb 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added data/seasaltpaper/boat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/seasaltpaper/crab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/seasaltpaper/fish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/seasaltpaper/mermaid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/seasaltpaper/octopus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/seasaltpaper/penguin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/seasaltpaper/sailor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/seasaltpaper/shark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/seasaltpaper/shell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/seasaltpaper/swimmer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions json/seasaltpaper/mcts-seasalt-128ms.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"class" : "players.mcts.MCTSParams",
"budgetType" : "BUDGET_TIME",
"budget" : 128,
"breakMS" : 0,
"K" : [0.1, 1.0, 3.0, 5.0],
"rolloutLength" : [0, 10, 15, 30, 50],
"maxTreeDepth" : [1, 3, 5, 15],
"rolloutTermination" : "DEFAULT",
"information" : "Open_Loop",
"selectionPolicy" : ["SIMPLE", "ROBUST"],
"treePolicy" : ["UCB","UCB_Tuned"],
"opponentTreePolicy" : ["OneTree", "MultiTree", "SelfOnly"],
"heuristic" : [
{
"class" : "games.seasaltpaper.heuristics.LeadHeuristic"
},
{
"class" : "games.seasaltpaper.heuristics.ScoreAndHandHeuristic"
}
],
"exploreEpsilon" : [0.03, 0.1, 0.3],
"expansionPolicy" :"RANDOM",
"rolloutType" : "RANDOM",
"biasVisits" : 0,
"progressiveWideningConstant" : 0.0,
"progressiveWideningExponent" : 0.2
}
28 changes: 28 additions & 0 deletions json/seasaltpaper/mcts-seasalt-64ms.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"class" : "players.mcts.MCTSParams",
"budgetType" : "BUDGET_TIME",
"budget" : 64,
"breakMS" : 0,
"K" : [0.1, 1.0, 3.0, 5.0],
"rolloutLength" : [0, 10, 15, 30, 50],
"maxTreeDepth" : [1, 3, 5, 15],
"rolloutTermination" : "DEFAULT",
"information" : "Open_Loop",
"selectionPolicy" : ["SIMPLE", "ROBUST"],
"treePolicy" : ["UCB","UCB_Tuned"],
"opponentTreePolicy" : ["OneTree", "MultiTree", "SelfOnly"],
"heuristic" : [
{
"class" : "games.seasaltpaper.heuristics.LeadHeuristic"
},
{
"class" : "games.seasaltpaper.heuristics.ScoreAndHandHeuristic"
}
],
"exploreEpsilon" : [0.03, 0.1, 0.3],
"expansionPolicy" :"RANDOM",
"rolloutType" : "RANDOM",
"biasVisits" : 0,
"progressiveWideningConstant" : 0.0,
"progressiveWideningExponent" : 0.2
}
15 changes: 15 additions & 0 deletions json/seasaltpaper/paramsearch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"game": "SeaSaltPaper",
"destDir": "param-optimisation/",
"repeats": 5,
"iterations": 100,
"evalGames": 20,
"matchups": 50,
"samplingRate": 1,
"neighbourhood": 100,
"evalMethod": "Heuristic",
"nPlayers": 4,
"output": "results_optimisation_mcts64ms.txt",
"searchSpace": "json/seasaltpaper/mcts-seasalt-64ms.json",
"verbose": true
}
69 changes: 69 additions & 0 deletions src/main/java/core/AbstractGameStateContainer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package core;

import core.AbstractGameState;
import core.AbstractParameters;
import core.CoreConstants;
import core.CoreParameters;
import core.actions.AbstractAction;
import core.components.Area;
import core.interfaces.IExtendedSequence;
import core.interfaces.IGamePhase;
import evaluation.listeners.IGameListener;
import games.GameType;
import utilities.ElapsedCpuChessTimer;
import utilities.Pair;

import java.util.ArrayList;
import java.util.List;
import java.util.Stack;

public abstract class AbstractGameStateContainer {
// Parameters, forward model and turn order for the game
// public final AbstractParameters gameParameters;
// Game being played
public final GameType gameType;

// Game tick, number of iterations of game loop
public final int tick;

// Migrated from TurnOrder...may move later
public final int roundCounter, turnCounter, turnOwner, firstPlayer;
public final int nPlayers;
public final int nTeams;

// Timers for all players
// protected ElapsedCpuChessTimer[] playerTimer;

// Status of the game, and status for each player (in cooperative games, the game status is also each player's status)
public final CoreConstants.GameResult gameStatus;
public final CoreConstants.GameResult[] playerResults;
// Current game phase
// protected IGamePhase gamePhase;
// Stack for extended actions
// public final CoreParameters coreGameParameters;

// A record of all actions taken to reach this game state
// The history is stored as a list of pairs, where the first element is the player who took the action
// this is in chronological order
// public final List<Pair<Integer, AbstractAction>> history;
public final List<String> historyText;

protected AbstractGameStateContainer(AbstractGameState gs) {
this.gameType = gs.getGameType();

this.tick = gs.getGameTick();
this.roundCounter = gs.getRoundCounter();
this.turnCounter = gs.getTurnCounter();
this.turnOwner = gs.getTurnOwner();

this.firstPlayer = gs.getFirstPlayer();
this.nPlayers = gs.getNPlayers();
this.nTeams = gs.getNTeams();

this.gameStatus = gs.getGameStatus();
this.playerResults = gs.getPlayerResults();

// this.history = gs.getHistory();
this.historyText = gs.getHistoryAsText();
}
}
26 changes: 19 additions & 7 deletions src/main/java/core/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import evaluation.metrics.Event;
import evaluation.summarisers.TAGNumericStatSummary;
import games.GameType;
import games.seasaltpaper.heuristics.LeadHeuristic;
import games.seasaltpaper.heuristics.ScoreAndHandHeuristic;
import games.seasaltpaper.heuristics.ScoreHeuristic;
import games.pandemic.PandemicForwardModel;
import gui.AbstractGUIManager;
import gui.GUI;
Expand All @@ -17,10 +20,13 @@
import players.human.ActionController;
import players.human.HumanConsolePlayer;
import players.human.HumanGUIPlayer;
import players.mcts.MCTSEnums;
import players.mcts.MCTSParams;
import players.mcts.MCTSPlayer;
import players.rhea.RHEAPlayer;
import players.rmhc.RMHCParams;
import players.rmhc.RMHCPlayer;
import players.simple.FirstActionPlayer;
import players.simple.OSLAPlayer;
import players.simple.RandomPlayer;
import utilities.Pair;
Expand Down Expand Up @@ -691,28 +697,34 @@ public String toString() {
* and then run this class.
*/
public static void main(String[] args) {
String gameType = Utils.getArg(args, "game", "Chess");
String gameType = Utils.getArg(args, "game", "SeaSaltPaper");
boolean useGUI = Utils.getArg(args, "gui", true);
int turnPause = Utils.getArg(args, "turnPause", 0);
long seed = Utils.getArg(args, "seed", System.currentTimeMillis());
ActionController ac = new ActionController();

/* Set up players for the game */
ArrayList<AbstractPlayer> players = new ArrayList<>();

// players.add(new MCTSPlayer());
// players.add(new HumanConsolePlayer());
// players.add(new HumanConsolePlayer());
// players.add(new RandomPlayer());
// players.add(new RandomPlayer());
players.add(new RandomPlayer());
players.add(new RandomPlayer());
// players.add(new BasicMCTSPlayer());
// players.add(new OSLAPlayer());
// players.add(new RMHCPlayer());
// players.add(new HumanGUIPlayer(ac));
// players.add(new HumanGUIPlayer(ac));
players.add(new BasicMCTSPlayer());
players.add(new BasicMCTSPlayer());
// players.add(new BasicMCTSPlayer());
// players.add(new BasicMCTSPlayer());


/* Game parameter configuration. Set to null to ignore and use default parameters */
String gameParams = null;

/* Run! */
runOne(GameType.valueOf(gameType), gameParams, players, seed, false, null, useGUI ? ac : null, turnPause);
}


}
}
2 changes: 1 addition & 1 deletion src/main/java/core/components/PartialObservableDeck.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public PartialObservableDeck(String id, int ownerID, int nPlayers, VisibilityMod
}
}

private PartialObservableDeck(String name, int ownerID, boolean[] defaultVisibility, int ID) {
protected PartialObservableDeck(String name, int ownerID, boolean[] defaultVisibility, int ID) {
super(name, ownerID, ID, VisibilityMode.MIXED_VISIBILITY);
this.deckVisibility = defaultVisibility;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ public void createAndRunMatchUp(List<Integer> matchUp) {
// In the RANDOM case we use a new seed for each game
PermutationCycler idStream = new PermutationCycler(agents.size(), seedRnd, nTeams);
for (int i = 0; i < totalGameBudget; i++) {
// System.out.println("Playing game " + (i+1) + " out of " + totalGameBudget);
List<Integer> matchup = new ArrayList<>(nTeams);
for (int j = 0; j < nTeams; j++)
matchup.add(idStream.getAsInt());
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/games/GameType.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
import games.resistance.ResGameState;
import games.resistance.ResParameters;
import games.resistance.gui.ResGUIManager;
import games.seasaltpaper.SeaSaltPaperForwardModel;
import games.seasaltpaper.SeaSaltPaperGameState;
import games.seasaltpaper.SeaSaltPaperParameters;
import games.seasaltpaper.gui.SSPGUIManager;
import games.root.RootForwardModel;
import games.root.RootGameState;
import games.root.RootParameters;
Expand Down Expand Up @@ -213,6 +217,10 @@ public enum GameType {
Arrays.asList(Cards, Deduction, Renaissance),
Arrays.asList(HandManagement, PlayerElimination),
LoveLetterGameState.class, LoveLetterForwardModel.class, LoveLetterParameters.class, LoveLetterGUIManager.class),
SeaSaltPaper(2, 4,
Arrays.asList(Cards, Deduction),
Arrays.asList(HandManagement, SetCollection),
SeaSaltPaperGameState.class, SeaSaltPaperForwardModel.class, SeaSaltPaperParameters.class, SSPGUIManager.class),
Uno(2, 10,
Arrays.asList(Cards, ComicBook, Number, MoviesTVRadio),
Arrays.asList(HandManagement, LoseATurn, TakeThat),
Expand Down
31 changes: 31 additions & 0 deletions src/main/java/games/seasaltpaper/SSPGameStateContainer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package games.seasaltpaper;

import core.AbstractGameStateContainer;
import core.components.Deck;
import core.components.PartialObservableDeck;
import games.seasaltpaper.cards.SeaSaltPaperCard;

import java.util.List;

public class SSPGameStateContainer extends AbstractGameStateContainer {
public final List<PartialObservableDeck<SeaSaltPaperCard>> playerHands;
public final List<Deck<SeaSaltPaperCard>> playerDiscards;
public final Deck<SeaSaltPaperCard> discardPile1, discardPile2;
public final Deck<SeaSaltPaperCard> drawPile;
public final int lastChance; // index of the player that play "lastChance", -1 for no one
public final boolean[] protectedHands;
public final int[] playerTotalScores; // player points of previous rounds


public SSPGameStateContainer(SeaSaltPaperGameState gs) {
super(gs);
this.playerHands = gs.getPlayerHands();
this.playerDiscards = gs.getPlayerDiscards();
this.discardPile1 = gs.getDiscardPile1();
this.discardPile2 = gs.getDiscardPile2();
this.drawPile = gs.getDrawPile();
this.lastChance = gs.lastChance;
this.protectedHands = gs.getProtectedHands();
this.playerTotalScores = gs.playerTotalScores;
}
}
Loading