Skip to content

Commit

Permalink
updated example AI repo for Ludii 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisSoemers committed Sep 6, 2019
1 parent 2f8d40b commit 4eb6dbe
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ Alternatively, the following email address may be used: `ludii(dot)games(at)gmai

## Changelog

- 6 September, 2019: Updated repository for compatibility with new version 0.3.0 of Ludii.
- 13 August, 2019: Initial release.

## Acknowledgements
Expand Down
2 changes: 1 addition & 1 deletion src/experiments/RunCustomMatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static void main(final String[] args)
game.create(0);

final Trial trial = new Trial(game);
final Context context = new Context(game, trial, null, null);
final Context context = new Context(game, trial);
final List<AI> ais = new ArrayList<AI>();
ais.add(null);
ais.add(new RandomAI());
Expand Down
4 changes: 2 additions & 2 deletions src/experiments/Tutorial.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static void main(final String[] args)

// to be able to play the game, we need to instantiate "Trial" and "Context" objects
Trial trial = new Trial(game);
Context context = new Context(game, trial, null, null);
Context context = new Context(game, trial);

// let's start a game (setting up the initial game state)
game.start(context);
Expand Down Expand Up @@ -198,7 +198,7 @@ public static void main(final String[] args)
game.create(0);

trial = new Trial(game);
context = new Context(game, trial, null, null);
context = new Context(game, trial);
game.start(context);

System.out.println("We're playing " + game.name() + "!");
Expand Down
7 changes: 2 additions & 5 deletions src/mcts/ExampleDUCT.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import util.Trial;
import util.action.Action;
import util.action.ActionPass;
import util.state.StateType;
import utils.AIUtils;

/**
Expand Down Expand Up @@ -270,14 +269,12 @@ public void initAI(final Game game, final int playerID)
@Override
public boolean supportsGame(final Game game)
{
final int stateFlags = game.stateFlags();

// Don't allow stochastic games
if ((stateFlags & StateType.Stochastic) != 0)
if (game.isStochasticGame())
return false;

// Don't allow games which are NOT simultaneous-move games
if ((stateFlags & StateType.Simultaneous) == 0)
if (game.isAlternatingMoveGame())
return false;

// Don't allow real-time games
Expand Down
7 changes: 2 additions & 5 deletions src/mcts/ExampleUCT.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import util.Move;
import util.Trial;
import util.action.ActionPass;
import util.state.StateType;
import utils.AIUtils;

/**
Expand Down Expand Up @@ -243,12 +242,10 @@ public void initAI(final Game game, final int playerID)
@Override
public boolean supportsGame(final Game game)
{
final int stateFlags = game.stateFlags();

if ((stateFlags & StateType.Stochastic) != 0)
if (game.isStochasticGame())
return false;

if ((stateFlags & StateType.Simultaneous) != 0)
if (!game.isAlternatingMoveGame())
return false;

return true;
Expand Down

0 comments on commit 4eb6dbe

Please sign in to comment.