Git Product home page Git Product logo

ggp-base's People

Contributors

alexlandau avatar aymandf avatar fhars avatar gsj601 avatar matt-thomson avatar orb avatar samschreiber avatar sjl avatar skylerberg avatar stevedraper avatar tflaherty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ggp-base's Issues

NPE in OPNF

If you use a term both as a relation and a function, OPNF throws an NPE, like in (note the missing true in the terminal rule):

(role player)
(base (foo bar))
(init (foo bar))
(<= terminal (foo bar))

Game repositories initially take a long time to load

Once they're cached, game repositories load quickly, but when they're first being accessed, game repositories take a long time to load. This is because they download the entire game repository to a local cache and block until the download is complete. They don't show any sort of progress bar or any indication of what's taking time. This is a bad user experience.

Add explicit versioning and publish versioned .jars

The modern way to do versioning is Semantic Versioning (http://semver.org/).

If people are just modifying checkouts of GGP-Base and running their applications from source, we don't really need versioning. If they're going to use it as a dependency from a separate project, publishing versioned jars is important. There's already an artifact on Maven Central involving some version of GGP-Base: http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22ggp-base%22 I believe this was used for incorporating it into a codebase in another JVM language.

Publishing to a Maven repository would be nice (and is doable through Gradle, with some effort) but may not be necessary; it's also possible to publish versioned .jars on Github. Those should come with instructions regarding which dependencies are necessary (and we should make the versions of dependencies explicit, so users can determine if they can replace them with other versions to satisfy their other dependencies). Publishing to Maven would probably require defining dependencies that we get online (handled by Gradle) rather than including them in the repo.

It's also possible that we should restructure GGP-Base to better work as a library. For example, we could have one project as the "library", another for sample gamers that depends on the library, and a third project containing the applications that depends on both the others. A user could insert their own gamer's project next to the sample-gamer project and add a dependency to the applications on their project. The first project could likely also be subdivided. (They should stay in the same repo under the same versioning scheme, though. They would be in separate Eclipse projects and produce separate artifacts.)

ClassCastException when constructing Gdl programmatically

I was trying to programmatically construct variations of Nim (specifically, nim1 on games.ggp.org/base). To be sure of what part broke, if any, my process was to incrementally build a List (for later use in constructing a Propnet) out of a String per rule. For each String, I was calling Game.preprocessRulesheet(), then calling SymbolFactory.create() to get a Symbol, then calling GdlFactory.create() to create a Gdl object of just that one rule. Apparently, preprocessing a rulesheet assumes that there will be many symbols, and so wraps the single rule in parentheses. (The concrete syntax of GDL doesn't normally have parentheses around the whole rule set, so, I don't know why a Symbol would...) This is a problem for the GdlFactory, though, because in createGdl(), it checks if it has a SymbolList, and if it does, it casts to a SymbolList, and then casts the first Symbol inside that list to a SymbolAtom... and throws a ClassCastException. With some debugging println()'s thrown in, this code will reliably throw an Exception:

System.out.println("(role player1)");
String processed = Game.preprocessRulesheet(rule);
System.out.println(processed);
Symbol s = SymbolFactory.create(processed);
System.out.println(s);
return GdlFactory.create(s);

If I remove preprocessRulesheet() from the process, there's no exception, all my GDL strings get turned into Gdl objects, and a Propnet can be successfully built.

So that's one issue... but I don't know how to fix it, or know if it should be fixed. For preprocessing whole rulesheets, it doesn't throw the ClassCastException, so I don't think everyone's working code needs to change to handle the one case where maybe you want to double-check that your code is preprocessed correctly, but it's not an entire rulesheet. But! It did point out what is pretty clearly a bug in GdlFactory's create(Symbol) method:

public static Gdl create(Symbol symbol) throws GdlFormatException
    {
        try
        {
            return createGdl(symbol);
        }
        catch (Exception e)
        {
            createGdl(symbol);
            throw new GdlFormatException(symbol);
        }
    }

The try throws any exception, the same method is tried again, the same exception will always be thrown, and the more meaningful GdlFormatException will never be reached. The fix is to get rid of the call to createGdl inside of the catch. I have a fork with the fix already, and will be making a pull request as soon as I figure out how. (My first one ever!)

Track LPNF vs. OPNF performance

The goal of these is to determine if we can get rid of the LegacyPropNetFactory entirely in favor of the OptimizingPropNetFactory.

Results from a recent round of testing that focused on time taken:

The LPNF is faster on smaller games, where the exact time for computation doesn't really matter. The OPNF consistently takes at least 200 ms to run, while the LPNF can finish in under 20 ms. Instead, we look for games where the OPNF takes several seconds to run (at least) or fails while the LPNF is significantly faster.

Games where the OPNF takes at least 5 seconds to build a propnet and the LPNF is significantly faster:

Dresden/ggp-course2013_jordi [256] (6 vs. 1 seconds)
GGP.org/pancakes6 [70] (10 vs. <1 seconds)
GGP.org/pancakes [215] (10 vs. <1 seconds)
Dresden/knightstour [260] (40 vs. <1 seconds)
Dresden/ggp-course2013_a1 [396] (73 vs. 4 seconds)

Games where the OPNF times out (120 second limit) or fails and the LPNF does not:

GGP-Base/test_case_5a [483]
Stanford/tictictoe [429] (fails StaticValidator)
GGP.org/knightsTourLarge [21]
GGP.org/factoringImpossibleTurtleBrain [18]
Dresden/ggp-course2013_michal13 [373]
GGP.org/knightwar [33]
GGP.org/pancakes88 [171]
Dresden/ggp-course2013_nicolai [338]
GGP.org/god [66]

Note that games listed above may be earlier versions of games that have since been modified. (For some of these games, at least, adding bases and inputs makes the OPNF faster.) I need to go through and weed these out. Numbers in square brackets are game IDs from a personal database, for my reference (and so my output code doesn't conflate different versions of a game).

Question: Where can I find more GGP domains (kif files) ?

Dear GGP community,

I am Masataro Asai, a researcher specialized in heuristic search and PDDL-based planning.
Generally speaking, what is the best way to interact with people in this community?

I am looking for a centralized repository of the GGP domains (GDL / kif file database).
Competition servers only seem to provide game specifications through some HTTP interactions,
and this base repository seems to have only three domains (connect4, tic-tac-toe, maze).

Thank you,
Masataro

Spurious index out of bounds exception in OPNFValidator

I get a java.lang.IndexOutOfBoundsException: Index: 2, Size: 2 from the OPNFValidor for the following GDL file. I think the file contains no errors, and in any case the error message is not helpful:

(role player)

(base bar)

(inp player foo)
(<= (inp player (bar ?a ?b)) (t ?a) (t ?b))
(<= (input ?p ?m) (inp ?p ?m))
(<= (input ?p (combine ?m1 ?m2)) (inp ?p ?m1) (inp ?p ?m2))

(lgl player foo)
(<= (lgl player (bar ?a ?b)) (t ?a) (t ?b))
(<= (legal ?p ?m) (lgl ?p ?m))
(<= (legal ?p (combine ?m1 ?m2)) (lgl ?p ?m1) (lgl ?p ?m2))

(t a)
(t b)

(<= (next bar) (does player (combine ?m1 ?m2)))
(<= (next bar) (does player (bar ?a ?b)))
(<= (next bar) (does player foo))
(<= terminal (true bar))
(<= (goal player 100) (true bar))

SampleSearchLightGamer bug

There's a report on the Coursera forums that the SampleSearchLightGamer is broken. When it tries to shuffle the list of moves it's given, it tries to remove things from an ImmutableList. The moves it gets from the state machine should be copied into a new ArrayList before being manipulated.

Incidentally, the list shuffling could be done with Collections#shuffle instead to simplify the code.

A GGP game

Hi,I have a question about a GGP game.Can anybody help me?
Thanks!

Here is a very ancient game originated from China: Tiger vs Dogs.
In the above 4X4 board(5 rows,5columns), there are one tiger (represented by a white stone in the center) and 16 dogs
(represented by black stones in the perimeter).
The tiger is controlled by the tiger player and the dogs are controlled by the dog player. The tiger player
goes rst and then they take turns. Each player can go one step along the line to an adjacent position that
is not occupied.
When the tiger enters a position such that the following condition hold \two dogs are adjacent to this
position such that they three are in the same line, and also these two dogs have no adjacent dogs in the same
line", then these two dogs are killed by the tiger. If 6 dogs are killed, then the tiger player wins and the dog
player loses.
When the dogs surrounded the tiger such that there is no unoccupied adjacent position for the tiger to
move, then the tiger player loses and the dog player wins.

Write a game description in GDL (KIF form) for this game.

Logic loop with no transitions

Reposting from Coursera boards at request of Sam S, though it may well be a game rules bug (again on the main ggp repository if so), in case it isn;t just a GDL issue, but highlights a bug in h propnet generation too (unknown):

I have found that one game (cubicup_3player) gives rise to a looped logic path in the generated propnet which does not involve a transition. This seems problematic!

The relevant games rules appear to be:
( role yellow )
( role red )
( role green )
( nextplayer yellow red )
( nextplayer red green )
( nextplayer green yellow )

<= ( nextplayer_with_cubes ?player ?nextplayer ) ( true ( cubes ?player 0 ) ) ( nextplayer ?player ?player1 ) ( nextplayer_with_cubes ?player1 ?nextplayer ) )

This doesn't seem like properly stratified GDL. Can anyone confirm this is a game defintion error rather than a propnet generation (or possibly my propnet propagation, which certainly does not cope with such loops) code issue?

Add option to select all gamers in kiosk

Currently you can pick the opponent in the kiosk, but can only play against it as a human. There should be a drop down for each player in the game, allowing you to pit two AI against each other. A minimum turn delay and/or stepping forwards and backwards through the turns would also help keep the game from flashing by instantly. Zillions of games is a propriety game that does this very well: http://www.zillions-of-games.com/demo

OPNF should always generate the same number of legal and input propositions

Generated propositional networks for games should have the same number of legal propositions ("move X is legal for player Y") and input propositions ("player Y chose move X"). It's internally inconsistent to have a legal proposition with no corresponding input proposition, since a player could choose that move and the propnet wouldn't be able to simulate it; and it's pointless to have an input proposition with no corresponding legal proposition, since the input proposition could never be set.

On the game "checkersonabarrelnokings" on the "games.ggp.org/stanford" repository, OPNF generates significantly more legal propositions than input propositions. This can be observed with the following code snippet:

PropNet p = OptimizingPropNetFactory.create(new CloudGameRepository("games.ggp.org/stanford").getGame("checkersonabarrelnokings").getRules());
System.out.println(p.getLegalPropositions().get(p.getRoles().get(0)).size());
System.out.println(p.getLegalPropositions().get(p.getRoles().get(1)).size());
System.out.println(p.getInputPropositions().keySet().size());

For most games (connect four, english draughts) the first two numbers added together equal the third number. For this game, the first two numbers added together are nearly double the third number.

Sorting the above results shows differences of this form:

( legal black ( jump 1 1 3 3 ) )
( legal black ( jump 1 1 3 7 ) )
( legal black ( jump 1 3 3 1 ) )
( legal black ( jump 1 3 3 5 ) )
( legal black ( jump 1 5 3 3 ) )
( legal black ( jump 1 5 3 7 ) )
( legal black ( jump 1 7 3 1 ) )
( legal black ( jump 1 7 3 5 ) )

vs.

( does black ( jump 1 1 3 3 ) )
( does black ( jump 1 3 3 5 ) )
( does black ( jump 1 5 3 7 ) )
( does black ( jump 1 7 3 1 ) )

OPNF is creating extra legal propositions, but it's not creating extra input propositions because the input propositions are specified via "input" rules. We should remove the extra legal propositions, or fix the issue that's causing OPNF to generate extra legal propositions in the first place.

Move to Java 7

Currently the .settings/org.eclipse.jdt.core.prefs file tells Eclipse to build GGP-Base in Java 6, which is no longer actively supported (at least by Oracle). I move to change it to use Java 7. This will introduce some new compiler warnings/errors, depending on your settings (mainly around JComboBox); I believe there's a pull request that should fix those issues.

Server application needs a more responsive user interface layout

Users of the server application have observed that:

  • the default window size can be too tall when on a laptop
  • components in the window don't resize when the window is resized, resulting in them being hidden
  • the main window isn't properly repainted when resized to be larger than the default size

These issues should all be fixable by redesigning the way that the server application lays out its user interface. These issues may also apply to applications like kiosk, player, and validator, which render their user interfaces in a way similar to server.

Javadoc has errors

Compiling the javadoc gives 20 errors and many warnings.

A few are on a setter method wiith a @return, renamed or removed parameter etc so just delete the line or correct the spelling

The others appear to be unescaped < or > in the doc so I think need replacing with < or > Which is not nice as this is example code

Remove ggp-org/ggp-base/ggp-base subfolder

@samschreiber, are you planning on pushing everything from ggp-org/ggp-base/ggp-base up one level? Will this happen soon?

I have some more pull requests for small functionality improvements. However, I don't really want to make these until the folder structure is relatively stable. Thanks!

Rename PropNetFactory

Probably to LegacyPropNetFactory. Make the OPNF more discoverable, if possible.

Alternatively, we could delete it, if we determine there's no value in leaving it around.

Documentation of Python GGP Player Example in src_py

import org.ggp... statements in src_py fail. Jython or other packages/interpretters besides python 2.7 must be required.

Documentation of the steps involved in compiling/running a python game player would be an awesome addition.

In [1]: %run sample_gamer.py
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/usr/lib/python2.7/site-packages/IPython/utils/py3compat.pyc in execfile(fname, *where)
    202             else:
    203                 filename = fname
--> 204             __builtin__.execfile(filename, *where)

/home/hobs/src/ggp-base/src_py/sample_gamer.py in <module>()
      5 import random
      6 
----> 7 from org.ggp.base.util.statemachine import MachineState
      8 from org.ggp.base.util.statemachine.implementation.prover import ProverStateMachine
      9 from org.ggp.base.player.gamer.statemachine import StateMachineGamer

ImportError: No module named org.ggp.base.util.statemachine

Nested instantiations in PropNetFlattener

I've tried using PropNetFlattener on GDL-II game descriptions. It seems to work just fine on most of the small games, but sometimes it encounters a problem with nested instantiations in the "sees" predicates. For example in the Monty Hall game, as defined at the Dresden server:

http://ggpserver.general-game-playing.de/ggpserver/public/view_game.jsp?name=montyhall

The flattener successfully finds:
( SEES CANDIDATE ( OPEN_DOOR 1 ) )
( SEES CANDIDATE ( OPEN_DOOR 2 ) )
( SEES CANDIDATE ( OPEN_DOOR 3 ) )
( SEES CANDIDATE ( CAR 1 ) )
( SEES CANDIDATE ( CAR 2 ) )
( SEES CANDIDATE ( CAR 2 ) )
( SEES CANDIDATE ( does CANDIDATE SWITCH ) )
( SEES CANDIDATE ( does CANDIDATE NOOP ) )

But is unable to generate:
( SEES CANDIDATE ( does CANDIDATE ( CHOOSE 1 ) ) )
( SEES CANDIDATE ( does CANDIDATE ( CHOOSE 2 ) ) )
( SEES CANDIDATE ( does CANDIDATE ( CHOOSE 3 ) ) )

Is there any way to solve this issue? Something like forcing "sees" to be instantiated as the last?

Thanks in advance,

Jakub Cerny

OptimizingPropnetFactory failure on 'skirmish' (with some details)

The propnet generated by the OptimizingPropnetFactory for the game 'skirmish' (from games.ggp.org/base) generates DOES propositions ONLy for the two 'noop' possibilities, and does not include any of the DOES' related to inputs of the form:

( <= ( input ?role ( move ?u ?v ?x ?y ) ) ( role ?role ) ( rookMove ?u ?v ?x ?y ) )
( <= ( input ?role ( move ?u ?v ?x ?y ) ) ( role ?role ) ( bishopMove ?u ?v ?x ?y ) )
( <= ( input ?role ( move ?u ?v ?x ?y ) ) ( role ?role ) ( knightMove ?u ?v ?x ?y ) )

On debugging I have found that when the DOES sentence form '( does _ ( move _ _ _ _ ) )' is processed it is effectively skipped because 'usingInput' is set when addSentenceForm() is called on this form (which is correct) but there are no constant immutable sentences for the form '( input _ ( move _ _ _ _ ) )' so nothing to enumerate.

The noop forms work because the corresponding input form '( input _ _ )' is a constant form. I am unsure where exactly the non-constant input form '( input _ ( move _ _ _ _ ) )' should be expanded, so I'm afraid the above is about all I can offer for debugging detail currently (slightly out of my depth with this part of the existing codebase)

Move to github

This issue to note action to do to completely move to github :

  • wiki
  • close SVN source
  • delete google code wiki
  • write in google code homepage that the project is moved.

Other actions needed ?

Game server throws an exception when multiple instances are open

"If you open the Game Server when there's another instance already open, it generates an exception. It should give a warning message to tell you that only 1 instance can be open at a time, then gracefully shut down after you've acknowledged the message."

Validate that GDL rules aren't malformed

There have been reports about malformed rules in game rulesheets like the following:

  (<= terminal (not (sheep_exist)))  ;; instead (<= terminal (not sheep_exist))
  (<= (base (step 1)))               ;; instead (base (step 1))

These should fail validation in the GDL validator. Currently I don't think we have anything that checks for this during validation; we should add something to do that.

Move to Java 8

This has come up before and been blocked on the fact that Tiltyard is a major consumer of GGP-Base as a library, and it uses Google App Engine, which still doesn't have Java 8 support.

However, the Google App Engine team has announced that they will be supporting Java 8 in the next few months: https://cloudplatform.googleblog.com/2017/03/your-favorite-languages-now-on-Google-App-Engine.html

Given that, it's now worth tracking this in its own ticket.

(Note that in the meantime, if you have your own checkout of GGP-Base and want to use Java 8, you should feel free to modify the sourceCompatibility and targetCompatibility in build.gradle to 1.8 and regenerate your IDE files with e.g. ./gradlew eclipse or ./gradlew idea. This should enable you to use Java 8 language features.)

KioskGamer NPE when abort precedes first metagame command

I'm not sure of the exact circumstances, but this was reported on Coursera and looks like a simple fix:

Kiosk has started a gamer named MyFirstGamer.

[GamePlayer] [Received at 1428606724027](START kiosk.ticTacToe-1428606723652 oplayer %28%28 role xplayer %29 %28 role oplayer %29 %28 index 1 %29 %28 index 2 %29 %28 index 3 %29 %28 <= %28 base %28 cell ?x ?y b %29 %29 %28 index ?x %29 %28 index ?y %29 %29 %28 <= %28 base %28 cell ?x ?y x %29 %29 %28 index ?x %29 %28 index ?y %29 %29 %28 <= %28 base %28 cell ?x ?y o %29 %29 %28 index ?x %29 %28 index ?y %29 %29 %28 <= %28 base %28 control ?p %29 %29 %28 role ?p %29 %29 %28 <= %28 input ?p %28 mark ?x ?y %29 %29 %28 index ?x %29 %28 index ?y %29 %28 role ?p %29 %29 %28 <= %28 input ?p noop %29 %28 role ?p %29 %29 %28 init %28 cell 1 1 b %29 %29 %28 init %28 cell 1 2 b %29 %29 %28 init %28 cell 1 3 b %29 %29 %28 init %28 cell 2 1 b %29 %29 %28 init %28 cell 2 2 b %29 %29 %28 init %28 cell 2 3 b %29 %29 %28 init %28 cell 3 1 b %29 %29 %28 init %28 cell 3 2 b %29 %29 %28 init %28 cell 3 3 b %29 %29 %28 init %28 control xplayer %29 %29 %28 <= %28 next %28 cell ?m ?n x %29 %29 %28 does xplayer %28 mark ?m ?n %29 %29 %28 true %28 cell ?m ?n b %29 %29 %29 %28 <= %28 next %28 cell ?m ?n o %29 %29 %28 does oplayer %28 mark ?m ?n %29 %29 %28 true %28 cell ?m ?n b %29 %29 %29 %28 <= %28 next %28 cell ?m ?n ?w %29 %29 %28 true %28 cell ?m ?n ?w %29 %29 %28 distinct ?w b %29 %29 %28 <= %28 next %28 cell ?m ?n b %29 %29 %28 does ?w %28 mark ?j ?k %29 %29 %28 true %28 cell ?m ?n b %29 %29 %28 or %28 distinct ?m ?j %29 %28 distinct ?n ?k %29 %29 %29 %28 <= %28 next %28 control xplayer %29 %29 %28 true %28 control oplayer %29 %29 %29 %28 <= %28 next %28 control oplayer %29 %29 %28 true %28 control xplayer %29 %29 %29 %28 <= %28 row ?m ?x %29 %28 true %28 cell ?m 1 ?x %29 %29 %28 true %28 cell ?m 2 ?x %29 %29 %28 true %28 cell ?m 3 ?x %29 %29 %29 %28 <= %28 column ?n ?x %29 %28 true %28 cell 1 ?n ?x %29 %29 %28 true %28 cell 2 ?n ?x %29 %29 %28 true %28 cell 3 ?n ?x %29 %29 %29 %28 <= %28 diagonal ?x %29 %28 true %28 cell 1 1 ?x %29 %29 %28 true %28 cell 2 2 ?x %29 %29 %28 true %28 cell 3 3 ?x %29 %29 %29 %28 <= %28 diagonal ?x %29 %28 true %28 cell 1 3 ?x %29 %29 %28 true %28 cell 2 2 ?x %29 %29 %28 true %28 cell 3 1 ?x %29 %29 %29 %28 <= %28 line ?x %29 %28 row ?m ?x %29 %29 %28 <= %28 line ?x %29 %28 column ?m ?x %29 %29 %28 <= %28 line ?x %29 %28 diagonal ?x %29 %29 %28 <= open %28 true %28 cell ?m ?n b %29 %29 %29 %28 <= %28 legal ?w %28 mark ?x ?y %29 %29 %28 true %28 cell ?x ?y b %29 %29 %28 true %28 control ?w %29 %29 %29 %28 <= %28 legal xplayer noop %29 %28 true %28 control oplayer %29 %29 %29 %28 <= %28 legal oplayer noop %29 %28 true %28 control xplayer %29 %29 %29 %28 <= %28 goal xplayer 100 %29 %28 line x %29 %29 %28 <= %28 goal xplayer 50 %29 %28 not %28 line x %29 %29 %28 not %28 line o %29 %29 %28 not open %29 %29 %28 <= %28 goal xplayer 0 %29 %28 line o %29 %29 %28 <= %28 goal oplayer 100 %29 %28 line o %29 %29 %28 <= %28 goal oplayer 50 %29 %28 not %28 line x %29 %29 %28 not %28 line o %29 %29 %28 not open %29 %29 %28 <= %28 goal oplayer 0 %29 %28 line x %29 %29 %28 <= terminal %28 line x %29 %29 %28 <= terminal %28 line o %29 %29 %28 <= terminal %28 not open %29 %29 %29 30 10)

[GamePlayer] [Sent at 1428606724079] ready

[GamePlayer] [Received at 1428606730520](ABORT kiosk.ticTacToe-1428606723652)

[GamePlayer] [Sent at 1428606730521] aborted

Timeout when communicating with role [xplayer].

[GamePlayer] java.lang.NullPointerException

at org.ggp.base.apps.kiosk.KioskGamer.stateMachineAbort(KioskGamer.java:136)

at org.ggp.base.player.gamer.statemachine.StateMachineGamer.abort(StateMachineGamer.java:262)

at org.ggp.base.apps.kiosk.Kiosk.actionPerformed(Kiosk.java:293)

at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)

at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)

at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)

at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)

at java.awt.Component.processMouseEvent(Component.java:6525)

at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)

at java.awt.Component.processEvent(Component.java:6290)

at java.awt.Container.processEvent(Container.java:2234)

at java.awt.Component.dispatchEventImpl(Component.java:4881)

at java.awt.Container.dispatchEventImpl(Container.java:2292)

at java.awt.Component.dispatchEvent(Component.java:4703)

at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)

at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)

at java.awt.Container.dispatchEventImpl(Container.java:2278)

at java.awt.Window.dispatchEventImpl(Window.java:2750)

at java.awt.Component.dispatchEvent(Component.java:4703)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:751)

at java.awt.EventQueue.access$500(EventQueue.java:97)

at java.awt.EventQueue$3.run(EventQueue.java:702)

at java.awt.EventQueue$3.run(EventQueue.java:696)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)

at java.awt.EventQueue$4.run(EventQueue.java:724)

at java.awt.EventQueue$4.run(EventQueue.java:722)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:721)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

An unhandled exception ocurred during aborting: org.ggp.base.player.gamer.exception.AbortingException: java.lang.NullPointerException

at org.ggp.base.player.gamer.statemachine.StateMachineGamer.abort(StateMachineGamer.java:267)

at org.ggp.base.apps.kiosk.Kiosk.actionPerformed(Kiosk.java:293)

at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)

at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)

at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)

at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)

at java.awt.Component.processMouseEvent(Component.java:6525)

at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)

at java.awt.Component.processEvent(Component.java:6290)

at java.awt.Container.processEvent(Container.java:2234)

at java.awt.Component.dispatchEventImpl(Component.java:4881)

at java.awt.Container.dispatchEventImpl(Container.java:2292)

at java.awt.Component.dispatchEvent(Component.java:4703)

at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)

at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)

at java.awt.Container.dispatchEventImpl(Container.java:2278)

at java.awt.Window.dispatchEventImpl(Window.java:2750)

at java.awt.Component.dispatchEvent(Component.java:4703)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:751)

at java.awt.EventQueue.access$500(EventQueue.java:97)

at java.awt.EventQueue$3.run(EventQueue.java:702)

at java.awt.EventQueue$3.run(EventQueue.java:696)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)

at java.awt.EventQueue$4.run(EventQueue.java:724)

at java.awt.EventQueue$4.run(EventQueue.java:722)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:721)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Caused by: java.lang.NullPointerException

at org.ggp.base.apps.kiosk.KioskGamer.stateMachineAbort(KioskGamer.java:136)

at org.ggp.base.player.gamer.statemachine.StateMachineGamer.abort(StateMachineGamer.java:262)

... 37 more

Expose game versioning in GameRepository

For certain applications (in my case performance testing), it would be helpful to be able to record the exact identity of a game that was used to generate information. Currently the GameRepository and Game objects don't expose the version of a loaded game, nor allow the user to request a specific game version.

Add ability to abandon running games in the Server app

This can be convenient both when testing games or players and if the Server app were to be used for a tournament. The next-fastest alternative is the annoying process of restarting the app and reselecting the repo, the game, the players, etc.

Automatic detection of player connection

Sorry if I'm writing in a wrong place.

Normally the server app needs to manually add each and every player except the ones who were hardcoded in PlayerPresenceManager(). How can one make the server automatically listen to the client connections and add them to the PlayerList Panel?

Incorrect goals net created by OPNF in JointConnectFour (Stanford repo)

Came across this while working on factorization of games, but it turned out to be a bug in the basic OPNF. The GDL for the goals is quite involved and a little odd for this game (and also DualConnctFour) and critically contains:

(<= (goal ?p 50) (role ?p) (not (some_win)))
...
(<= (normal_win ?p) (goal_normal ?p 100))
(<= (suicide_win ?p) (goal_suicide ?p 100))
(<= (win ?p) (normal_win ?p))
(<= (win ?p) (suicide_win ?p))
(<= (some_win) (win ?p))

When adding the sentence forms for '(<= (goal ?p 50) (role ?p) (not (some_win)))' the OPNF does not find the component (which it HAS successfully added) for ' (<= (some_win) (win ?p))', and as a result it winds up connecting the 50 value goals to TRUE, resulting in incorrect reports of a 50 goal value in some winning states (depending on how you state-machine enumerates goal props, since actually two values will be true).

The reason this occurs is that it's looking for a match in the components collection in this code (in addSentenceForm()):

         PolymorphicComponent positive = components.get(transformed);
         //No, because then that will be attached to "negations", which could be bad

          if (positive == null)
          {
            //So the positive can't possibly be true (unless we have recursion)
            //and so this would be positive always
            //We want to just skip this conjunct, so we continue to the next

            continue; //to the next conjunct
          }

'transformed' (and therefore 'positive') are GdlRelation instances. However the component for 'some_win' was added as a GdlProposition (with sentence matching the rule head for the relation it's now trying to find), and so no match is found.

My (hacky) solution (which works, but...) is this change to the above code:

          PolymorphicComponent positive = components.get(transformed);
          //No, because then that will be attached to "negations", which could be bad

          if ( positive == null && transformed.arity() == 0 )
          {
            positive = components.get(GdlPool.getProposition(transformed.getName()));
          }
          if (positive == null)
          {

However, there must be a cleaner way! Not sure if the clean fix involves making sure the 'some_win' gets added as an arity 0 relation instance, or adding an equals() override to various Gdl... classes so that a proposition and a bodyless relation with the same name compare equally, or what?

Also please note I am not using the OPNF from Git - it's a copy that works against a different component class hierarchy (I needed to make Component an interface, so I basically had to copy everything and make some mechanical changes), so I can't submit my code directly back (and anyway, I'm sure what I have done is a hack)

Auto-formatter for GDL game rules

GGP Base should include a tool that automatically formats game rules in a clean, canonical way. Among other things, this should do the following:

  • Put each relation on a separate line, with splitting for long lines.
  • Group similar relations, and separate out important groups (role, next, legal, etc)
  • Trim unnecessary whitespace.

Ideally it would preserve comments (in one form or another), but that might be more challenging.

This should not change the semantics of the game at all. One possible use-case is having this run automatically for all of the games in an online game repository.

Given two game descriptions, you should get a meaningful easy-to-read report if you auto-format both and run them through a diff tool. This will make it substantially easier to understand the differences between different versions of the same game.

Better support for testing visualizations in browsers

Right now it's very difficult to test visualizations in a way that reflects how they will work as rendered in browsers on Tiltyard. We should at least have a way that the game server can render game states so they are seen in a browser, and possibly move to that as the preferred/only approach. This would likely involve offering a link to a web page that either is served by a Java servlet in the game server process, or is a file: link to generated static HTML pages in a folder. (I've seen issues with same-origin policies in Chrome with the latter approach.)

This might be combined with a move to JavaScript-based visualizations.

DeORer does not correctly handle `not` literals

Given the GDL (<= p (not (or a b))), I'd expect this to de-or to (<= p (not a) (not b)), due to De Morgan's law, i.e., the negation of a disjunction is the conjunction of the negated terms in the disjunction. However, the DeORer class prints out ( <= p ( not a ) ) ( <= p ( not b ) ).

The following code is an example:

    public static void main(String[] args) {
        ArrayList<Gdl> l = new ArrayList<>();
        GdlConstant p = GdlPool.getConstant("p");
        GdlConstant a = GdlPool.getConstant("a");
        GdlConstant b = GdlPool.getConstant("b");

        l.add(GdlPool.getRule(GdlPool.getProposition(p),
                new GdlLiteral[] { GdlPool.getNot(GdlPool.getOr(
                        new GdlLiteral[] { GdlPool.getProposition(a), GdlPool.getProposition(b)})) }));

        List<Gdl> res = DeORer.run(l);
        for (Gdl g : res) {
            System.out.println(g.toString());
        }
    }

HTML parsing library for visualizations messes up divs

In preparing games for the coming competition, I'm seeing several cases where visualization code like

<div id="d1"/>
<div id="d2"/>
<div id="d3"/>

turns into

<div id="d1">
<div id="d2">
<div id="d3">
</div></div></div>

This wreaks havoc with visualizations (I believe Hex is an example).

Debugging indicates this error is introduced by the "new HtmlDocumentBuilder().parse(is)" call in GameStateRenderer#renderImagefromGameXML. The input "xhtml" string is correct, the created dom object is incorrect.

OPNF bug in test case 5d

See SanchoGGP#212

The OPNF needs to be able to handle multiple strata of sentence forms at once. Currently its toposort goes into an infinite loop in this case.

Make StaticValidator use Griddle validation library

This should both cause the set of warnings and errors to be more comprehensive (and even configurable) and improve the format of results (e.g. allowing more than one error to be detected at once, and consistently reporting the relevant code and its line number).

General Game Player Benchmarks

Currently I am not aware of any good ways of objectively benchmarking the real play quality of a GGP player, particularly in a reasonable timeframe. The closest approximation that I have is the long-term average score on an online round-robin server, but this metric has several undesirable properties:

  1. It depends on the other players on the online server. If better/worse players join, your score may go down/up, independent of the quality of your player.
  2. It depends on the distribution of games on the online server. If more games which your player performs better/worse on are added, your score will increase/decrease, independent of the quality of your player.

A benchmark should depend only on a single player. It should be possible to compute in a reasonable time frame, which I'm going to arbitrarily define as 100 hours, but faster is much better, since the benchmark should be part of a design-test-iterate cycle.

These benchmarks should be purely a black-box metric: hypothetically, any player should be able to connect to a "benchmarking server", play a series of games, and get a score at the end. Nothing in the benchmark should depend on the internal state of the player. (Teams should develop their own white-box metrics to supplement this black-box metric, of course, but those aren't general purpose components suitable for GGP Base)

The benchmark does not need to be a single number. A set of numbers, each measuring the quality of a particular aspect of play, is perfectly fine. The benchmark also does not need to be "authoritative", in that there can be multiple equally-valid benchmarks with different values. (As a result, individual benchmarks can be composed to form larger, more comprehensive benchmarks.)

The benchmark should be a real number between 0 and 100. Larger numbers should always be strictly better than smaller numbers.

Any suggestions for objective black-box benchmarks will be appreciated. I hope to put together a large, comprehensive benchmark suite, so that different players (and different versions of the same player) can be independently benchmarked. This should help make the player development process slightly more scientific.

Additional thoughts:

Benchmarks don't necessarily need to be deterministic, since the player isn't likely to be deterministic either. On the other hand, all else being equal, deterministic behavior is preferable.

Since the benchmarks are black-box metrics, they must be computed based on having the target player play through an ordinary game (or a series of such games). There are some complex ways to compute a metric based on a game, but example of some simple one are:

  • Player plays Tic-Tac-Toe against Random. Benchmark is 100 if they win/tie, 0 if they lose.
  • Player plays Tic-Tac-Toe against a perfect Tic-Tac-Toe player. Benchmark is 100 if they win/tie, 0 if they lose.
  • Player plays Connect Four against Legal. Benchmark is 100 if they win, 50 if they tie, 0 if they lose.

Each of these tests can be repeated, to decrease variance. Reasonable times for these matches are 60 + 15x, in seconds, where 'x' is the length of the match. Tic-Tac-Toe matches will be at most 3.25 minutes each, and Connect Four matches will be at most 13 minutes each. These are well within the 6000 minute total time.

The example benchmarks are good at determining whether a player has a baseline of reasonable behavior, which is useful to know, but they don't provide a nuanced, fine-grained notion of the quality of the player's play on harder games.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.