[Toss-devel-svn] SF.net SVN: toss:[1575] trunk/Toss
Status: Beta
Brought to you by:
lukaszkaiser
|
From: <luk...@us...> - 2011-09-27 23:53:32
|
Revision: 1575
http://toss.svn.sourceforge.net/toss/?rev=1575&view=rev
Author: lukaszkaiser
Date: 2011-09-27 23:53:22 +0000 (Tue, 27 Sep 2011)
Log Message:
-----------
Correcting parsing of let-in formulas, better GDL timeouting, full set of gdl examples.
Modified Paths:
--------------
trunk/Toss/Formula/BoolFunctionParser.mly
trunk/Toss/Formula/Formula.ml
trunk/Toss/Formula/FormulaParser.mly
trunk/Toss/Formula/Tokens.mly
trunk/Toss/GGP/GDL.ml
trunk/Toss/GGP/TranslateGameTest.ml
trunk/Toss/GGP/examples/3pffa.gdl
trunk/Toss/GGP/examples/3pttc.gdl
trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.0.qdimacs.gdl
trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.2.qdimacs.SAT.gdl
trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.2.qdimacs.satlike.gdl
trunk/Toss/GGP/examples/4pttc.gdl
trunk/Toss/GGP/examples/8puzzle.gdl
trunk/Toss/GGP/examples/ad_game_2x2.gdl
trunk/Toss/GGP/examples/aipsrovers01.gdl
trunk/Toss/GGP/examples/asteroids.gdl
trunk/Toss/GGP/examples/asteroidsparallel.gdl
trunk/Toss/GGP/examples/asteroidsserial.gdl
trunk/Toss/GGP/examples/checkers.gdl
trunk/Toss/GGP/examples/chess.gdl
trunk/Toss/GGP/examples/connect4.gdl
trunk/Toss/GGP/examples/connect5.gdl
trunk/Toss/GGP/examples/pacman3p.gdl
trunk/Toss/GGP/examples/pawn_whopping.gdl
trunk/Toss/GGP/examples/tictactoe.gdl
trunk/Toss/Server/Server.ml
trunk/Toss/Solver/SolverTest.ml
Added Paths:
-----------
trunk/Toss/GGP/examples/BattleSnakes.gdl
trunk/Toss/GGP/examples/Catch-Me-If-You-Can.gdl
trunk/Toss/GGP/examples/Catch.Me.If.You.Can.gdl
trunk/Toss/GGP/examples/CatchMeIfYouCanTest.gdl
trunk/Toss/GGP/examples/CephalopodMicro.gdl
trunk/Toss/GGP/examples/DoubleAuctionDJ.gdl
trunk/Toss/GGP/examples/Guard_Intruder.gdl
trunk/Toss/GGP/examples/Nine_Mens_Morris_0.11_2p.gdl
trunk/Toss/GGP/examples/Nine_Mens_Morris_0.1_2p.gdl
trunk/Toss/GGP/examples/Qyshinsu.gdl
trunk/Toss/GGP/examples/RobinsonRoulete.gdl
trunk/Toss/GGP/examples/RobinsonRoulette.gdl
trunk/Toss/GGP/examples/RobinsonRoulette_no_white_peg.gdl
trunk/Toss/GGP/examples/Runners.gdl
trunk/Toss/GGP/examples/Thief_Police.gdl
trunk/Toss/GGP/examples/Zhadu.gdl
trunk/Toss/GGP/examples/battle.gdl
trunk/Toss/GGP/examples/battlesnakes1409.gdl
trunk/Toss/GGP/examples/battlesnakes1509.gdl
trunk/Toss/GGP/examples/battlesnakes2011.gdl
trunk/Toss/GGP/examples/beatmania.gdl
trunk/Toss/GGP/examples/bidding-tictactoe.gdl
trunk/Toss/GGP/examples/bidding-tictactoe_10coins.gdl
trunk/Toss/GGP/examples/blobwars.gdl
trunk/Toss/GGP/examples/blocker.gdl
trunk/Toss/GGP/examples/blockerparallel.gdl
trunk/Toss/GGP/examples/blockerserial.gdl
trunk/Toss/GGP/examples/blocks.gdl
trunk/Toss/GGP/examples/blocks2player.gdl
trunk/Toss/GGP/examples/blocksworldparallel.gdl
trunk/Toss/GGP/examples/blocksworldserial.gdl
trunk/Toss/GGP/examples/bomberman2p.gdl
trunk/Toss/GGP/examples/brain_teaser_extended.gdl
trunk/Toss/GGP/examples/brawl.gdl
trunk/Toss/GGP/examples/breakthroughsuicide.gdl
trunk/Toss/GGP/examples/breakthroughsuicide_v2.gdl
trunk/Toss/GGP/examples/bunk_t.gdl
trunk/Toss/GGP/examples/buttons.gdl
trunk/Toss/GGP/examples/capture_the_king.gdl
trunk/Toss/GGP/examples/catch_me.gdl
trunk/Toss/GGP/examples/catcha_mouse.gdl
trunk/Toss/GGP/examples/checkers-cylinder-mustjump.gdl
trunk/Toss/GGP/examples/checkers-mustjump-torus.gdl
trunk/Toss/GGP/examples/checkers-mustjump.gdl
trunk/Toss/GGP/examples/checkers-newgoals.gdl
trunk/Toss/GGP/examples/checkers-suicide-cylinder-mustjump.gdl
trunk/Toss/GGP/examples/chickentictactoe.gdl
trunk/Toss/GGP/examples/chickentoetictac.gdl
trunk/Toss/GGP/examples/chinesecheckers1.gdl
trunk/Toss/GGP/examples/chinesecheckers2.gdl
trunk/Toss/GGP/examples/chinesecheckers3.gdl
trunk/Toss/GGP/examples/chinesecheckers4.gdl
trunk/Toss/GGP/examples/chinesecheckers6-simultaneous.gdl
trunk/Toss/GGP/examples/chinesecheckers6.gdl
trunk/Toss/GGP/examples/chomp.gdl
trunk/Toss/GGP/examples/circlesolitaire.gdl
trunk/Toss/GGP/examples/coins.gdl
trunk/Toss/GGP/examples/conn4.gdl
trunk/Toss/GGP/examples/connectfour.gdl
trunk/Toss/GGP/examples/connectfoursuicide.gdl
trunk/Toss/GGP/examples/crisscross.gdl
trunk/Toss/GGP/examples/crissrace.gdl
trunk/Toss/GGP/examples/crossers3.gdl
trunk/Toss/GGP/examples/cubicup.gdl
trunk/Toss/GGP/examples/cubicup_3player.gdl
trunk/Toss/GGP/examples/cylinder-checkers.gdl
trunk/Toss/GGP/examples/double_tictactoe_dengji.gdl
trunk/Toss/GGP/examples/doubletictactoe.gdl
trunk/Toss/GGP/examples/doubletoetictac.gdl
trunk/Toss/GGP/examples/duplicatestatelarge.gdl
trunk/Toss/GGP/examples/duplicatestatemedium.gdl
trunk/Toss/GGP/examples/duplicatestatesmall.gdl
trunk/Toss/GGP/examples/endgame.gdl
trunk/Toss/GGP/examples/eotcatcit.gdl
trunk/Toss/GGP/examples/eotcitcit.gdl
trunk/Toss/GGP/examples/farmers.gdl
trunk/Toss/GGP/examples/firefighter.gdl
trunk/Toss/GGP/examples/four_way_battle.gdl
trunk/Toss/GGP/examples/gameofsquares.gdl
trunk/Toss/GGP/examples/ghostmaze2p.gdl
trunk/Toss/GGP/examples/god.gdl
trunk/Toss/GGP/examples/golden_rectangle.gdl
trunk/Toss/GGP/examples/grid_game.gdl
trunk/Toss/GGP/examples/grid_game2.gdl
trunk/Toss/GGP/examples/gt_attrition.gdl
trunk/Toss/GGP/examples/gt_centipede.gdl
trunk/Toss/GGP/examples/gt_chicken.gdl
trunk/Toss/GGP/examples/gt_prisoner.gdl
trunk/Toss/GGP/examples/gt_ultimatum.gdl
trunk/Toss/GGP/examples/guard_intruder.gdl
trunk/Toss/GGP/examples/guard_intruder_test.gdl
trunk/Toss/GGP/examples/guess.gdl
trunk/Toss/GGP/examples/hallway.gdl
trunk/Toss/GGP/examples/hanoi.gdl
trunk/Toss/GGP/examples/hanoi7.gdl
trunk/Toss/GGP/examples/hanoi7_bugfix.gdl
trunk/Toss/GGP/examples/hanoi_6_disks.gdl
trunk/Toss/GGP/examples/hitori.gdl
trunk/Toss/GGP/examples/incredible.gdl
trunk/Toss/GGP/examples/javastrike.gdl
trunk/Toss/GGP/examples/jkkj.gdl
trunk/Toss/GGP/examples/kalaha_2009.gdl
trunk/Toss/GGP/examples/kitten_escapes_from_fire.gdl
trunk/Toss/GGP/examples/knightazons.gdl
trunk/Toss/GGP/examples/knightfight.gdl
trunk/Toss/GGP/examples/knightmove.gdl
trunk/Toss/GGP/examples/knightstour.gdl
trunk/Toss/GGP/examples/knightthrough.gdl
trunk/Toss/GGP/examples/knightwar.gdl
trunk/Toss/GGP/examples/laikLee_hex.gdl
trunk/Toss/GGP/examples/latenttictactoe.gdl
trunk/Toss/GGP/examples/lightson2x2.gdl
trunk/Toss/GGP/examples/lightsout.gdl
trunk/Toss/GGP/examples/lightsout2.gdl
trunk/Toss/GGP/examples/mastermind448.gdl
trunk/Toss/GGP/examples/max_knights.gdl
trunk/Toss/GGP/examples/maze.gdl
trunk/Toss/GGP/examples/meier.gdl
trunk/Toss/GGP/examples/merrills.gdl
trunk/Toss/GGP/examples/minichess-evilconjuncts.gdl
trunk/Toss/GGP/examples/minichess.gdl
trunk/Toss/GGP/examples/mummymaze1p.gdl
trunk/Toss/GGP/examples/mummymaze2p-comp2007.gdl
trunk/Toss/GGP/examples/mummymaze2p.gdl
trunk/Toss/GGP/examples/nim1.gdl
trunk/Toss/GGP/examples/nim2.gdl
trunk/Toss/GGP/examples/nim3.gdl
trunk/Toss/GGP/examples/nim4.gdl
trunk/Toss/GGP/examples/nothello.gdl
trunk/Toss/GGP/examples/numbertictactoe.gdl
trunk/Toss/GGP/examples/oisters_farm.gdl
trunk/Toss/GGP/examples/othello-comp2007.gdl
trunk/Toss/GGP/examples/othello-cornercontrol.gdl
trunk/Toss/GGP/examples/othello-fourway-teamswitch.gdl
trunk/Toss/GGP/examples/othello-fourway-teamswitchA.gdl
trunk/Toss/GGP/examples/othello-fourway-teamswitchB.gdl
trunk/Toss/GGP/examples/othello-fourway.gdl
trunk/Toss/GGP/examples/othello-new-horse.gdl
trunk/Toss/GGP/examples/othello-new.gdl
trunk/Toss/GGP/examples/othello.gdl
trunk/Toss/GGP/examples/othello2.gdl
trunk/Toss/GGP/examples/othellooo.gdl
trunk/Toss/GGP/examples/othellosuicide.gdl
trunk/Toss/GGP/examples/pancakes.gdl
trunk/Toss/GGP/examples/pancakes6.gdl
trunk/Toss/GGP/examples/pancakes88.gdl
trunk/Toss/GGP/examples/pawn_whopping_wrong.gdl
trunk/Toss/GGP/examples/pawntoqueen.gdl
trunk/Toss/GGP/examples/peg.gdl
trunk/Toss/GGP/examples/peg_bugfixed.gdl
trunk/Toss/GGP/examples/pentago_2008.gdl
trunk/Toss/GGP/examples/point_grab.gdl
trunk/Toss/GGP/examples/quad.gdl
trunk/Toss/GGP/examples/quad_5x5.gdl
trunk/Toss/GGP/examples/quad_5x5_8_2.gdl
trunk/Toss/GGP/examples/quad_7x7.gdl
trunk/Toss/GGP/examples/quarto.gdl
trunk/Toss/GGP/examples/quartosuicide.gdl
trunk/Toss/GGP/examples/queens.gdl
trunk/Toss/GGP/examples/racer.gdl
trunk/Toss/GGP/examples/racer4.gdl
trunk/Toss/GGP/examples/racetrackcorridor.gdl
trunk/Toss/GGP/examples/roshambo2.gdl
trunk/Toss/GGP/examples/ruledepthexponential.gdl
trunk/Toss/GGP/examples/ruledepthlinear.gdl
trunk/Toss/GGP/examples/ruledepthquadratic.gdl
trunk/Toss/GGP/examples/sat_test_20v_91c.gdl
trunk/Toss/GGP/examples/sat_test_20v_91c_version2.gdl
trunk/Toss/GGP/examples/satlike_20v_91c_version2.gdl
trunk/Toss/GGP/examples/sheep_and_wolf.gdl
trunk/Toss/GGP/examples/skirmish.gdl
trunk/Toss/GGP/examples/skirmish2.gdl
trunk/Toss/GGP/examples/skirmish3.gdl
trunk/Toss/GGP/examples/skirmishfinal.gdl
trunk/Toss/GGP/examples/slidingpieces.gdl
trunk/Toss/GGP/examples/smallest.gdl
trunk/Toss/GGP/examples/smallest_4player.gdl
trunk/Toss/GGP/examples/snake_2008.gdl
trunk/Toss/GGP/examples/snake_2009.gdl
trunk/Toss/GGP/examples/snake_2009_big.gdl
trunk/Toss/GGP/examples/statespacelarge.gdl
trunk/Toss/GGP/examples/statespacemedium.gdl
trunk/Toss/GGP/examples/statespacesmall.gdl
trunk/Toss/GGP/examples/sudoku_simple.gdl
trunk/Toss/GGP/examples/sum15.gdl
trunk/Toss/GGP/examples/test6868.gdl
trunk/Toss/GGP/examples/ticblock.gdl
trunk/Toss/GGP/examples/tictactoe-init1.gdl
trunk/Toss/GGP/examples/tictactoe_3d_2player.gdl
trunk/Toss/GGP/examples/tictactoe_3d_6player.gdl
trunk/Toss/GGP/examples/tictactoe_3d_small_2player.gdl
trunk/Toss/GGP/examples/tictactoe_3d_small_6player.gdl
trunk/Toss/GGP/examples/tictactoe_3player.gdl
trunk/Toss/GGP/examples/tictactoe_orthogonal.gdl
trunk/Toss/GGP/examples/tictactoelarge.gdl
trunk/Toss/GGP/examples/tictactoelargesuicide.gdl
trunk/Toss/GGP/examples/tictactoeparallel.gdl
trunk/Toss/GGP/examples/tictactoeserial.gdl
trunk/Toss/GGP/examples/tictactoex9.gdl
trunk/Toss/GGP/examples/tictictoe.gdl
trunk/Toss/GGP/examples/toetictac.gdl
trunk/Toss/GGP/examples/tpeg.gdl
trunk/Toss/GGP/examples/troublemaker01.gdl
trunk/Toss/GGP/examples/troublemaker02.gdl
trunk/Toss/GGP/examples/tttcc4.gdl
trunk/Toss/GGP/examples/twisty-passages.gdl
trunk/Toss/GGP/examples/uf20-01.cnf.SAT.gdl
trunk/Toss/GGP/examples/uf20-010.cnf.SAT.gdl
trunk/Toss/GGP/examples/uf20-010.cnf.SAT.satlike.gdl
trunk/Toss/GGP/examples/uf20-020.cnf.SAT.gdl
trunk/Toss/GGP/examples/uf20-020.cnf.SAT.satlike.gdl
trunk/Toss/GGP/examples/wallmaze.gdl
trunk/Toss/GGP/examples/wargame01.gdl
trunk/Toss/toss
Modified: trunk/Toss/Formula/BoolFunctionParser.mly
===================================================================
--- trunk/Toss/Formula/BoolFunctionParser.mly 2011-09-27 09:43:50 UTC (rev 1574)
+++ trunk/Toss/Formula/BoolFunctionParser.mly 2011-09-27 23:53:22 UTC (rev 1575)
@@ -47,9 +47,6 @@
{ Ex (vars, phi) }
| NOT bool_function_expr { Not ($2) }
| OPEN bool_function_expr CLOSE { $2 }
- | error
- { Lexer.report_parsing_error $startpos $endpos
- "Syntax error in Boolean function definition." }
parse_bool_function:
| bool_function_expr EOF { triv_simp $1 };
@@ -74,9 +71,6 @@
class_def:
| CLASS n = ID OPENCUR vars = id_sc_list CLOSECUR
{ (n, vars) }
- | error
- { Lexer.report_parsing_error $startpos $endpos
- "Syntax error in class parsing." }
bool_defs_expr:
| class_def SEMICOLON { [(Some $1, None)] }
@@ -84,9 +78,6 @@
| bool_def SEMICOLON { [(None, Some $1)] }
| bool_def { [(None, Some $1)] }
| bool_def SEMICOLON bool_defs_expr { (None, Some $1) :: $3 }
- | error
- { Lexer.report_parsing_error $startpos $endpos
- "Syntax error in parsing list of definitions." }
parse_bool_defs:
| dl = bool_defs_expr EOF
Modified: trunk/Toss/Formula/Formula.ml
===================================================================
--- trunk/Toss/Formula/Formula.ml 2011-09-27 09:43:50 UTC (rev 1574)
+++ trunk/Toss/Formula/Formula.ml 2011-09-27 23:53:22 UTC (rev 1575)
@@ -214,7 +214,7 @@
(Aux.fprint_sep_list "," fprint_var) (Array.to_list vs)
(fprint_prec prec) fpphi
| Let (r, args, rphi, inphi) ->
- Format.fprintf f "@[<1>let %s(%s) = %a in %a@]" r (String.concat ", " args)
+ Format.fprintf f "@[<1>let %s(%s) = %a in@]@ %a" r (String.concat ", " args)
(fprint_prec prec) rphi (fprint_prec prec) inphi
Modified: trunk/Toss/Formula/FormulaParser.mly
===================================================================
--- trunk/Toss/Formula/FormulaParser.mly 2011-09-27 09:43:50 UTC (rev 1574)
+++ trunk/Toss/Formula/FormulaParser.mly 2011-09-27 23:53:22 UTC (rev 1575)
@@ -121,7 +121,7 @@
| OPEN formula_expr CLOSE { $2 }
| LET_CMD rel = ID args = delimited (OPEN, separated_list (COMMA, ID), CLOSE)
EQ body = formula_expr IN phi = formula_expr
- { Let (rel, args, body, phi) }
+ { Let (rel, args, body, phi) } %prec LET_CMD
expr_eq_expr: /* only standard equations here for now (no differentials) */
Modified: trunk/Toss/Formula/Tokens.mly
===================================================================
--- trunk/Toss/Formula/Tokens.mly 2011-09-27 09:43:50 UTC (rev 1574)
+++ trunk/Toss/Formula/Tokens.mly 2011-09-27 23:53:22 UTC (rev 1575)
@@ -14,6 +14,7 @@
%token MODEL_SPEC RULE_SPEC STATE_SPEC LEFT_SPEC RIGHT_SPEC CLASS LFP GFP EOF
/* List in order of increasing precedence. */
+%nonassoc LET_CMD
%nonassoc COND
%left LARR
%right RARR
Modified: trunk/Toss/GGP/GDL.ml
===================================================================
--- trunk/Toss/GGP/GDL.ml 2011-09-27 09:43:50 UTC (rev 1574)
+++ trunk/Toss/GGP/GDL.ml 2011-09-27 23:53:22 UTC (rev 1575)
@@ -503,6 +503,7 @@
let instantiate_one tot_base cur_base irules =
Aux.concat_map (function
| (hrel, hargs as head), [], neg_body ->
+ check_timeout ~print:false ("GDL: saturate: instantiate_one: match1");
if (try Tuples.mem hargs (Aux.StrMap.find hrel tot_base)
with Not_found -> false)
then []
@@ -518,6 +519,7 @@
) neg_body then []
else [Aux.Left head]
| (hrel, hargs as head), (rel,args as pos_atom)::body, neg_body ->
+ check_timeout ~print:false ("GDL: saturate: instantiate_one: match2");
if (try Tuples.mem hargs (Aux.StrMap.find hrel tot_base)
with Not_found -> false)
then []
Modified: trunk/Toss/GGP/TranslateGameTest.ml
===================================================================
--- trunk/Toss/GGP/TranslateGameTest.ml 2011-09-27 09:43:50 UTC (rev 1574)
+++ trunk/Toss/GGP/TranslateGameTest.ml 2011-09-27 23:53:22 UTC (rev 1575)
@@ -367,15 +367,21 @@
(* failwith "generated"; *)
()
-let translate_file fname =
+let translate_file fname timeout =
try
+ let start = Unix.gettimeofday () in
+ (match timeout with
+ | None -> ()
+ | Some tout ->
+ TranslateGame.set_timeout
+ (fun () -> Unix.gettimeofday() -. start > float (tout)));
let descr = load_rules fname in
let gdl_data, result =
TranslateGame.translate_game ~playing_as:(GDL.Const "") descr in
(true, Arena.state_str result)
with
| Aux.Timeout msg -> (false, "Timeout: " ^ msg)
- | _ -> (false, "Failed")
+ | e -> (false, "Failed: " ^ (Printexc.to_string e))
let translate_dir_tests dirname timeout =
let is_gdl fn = (String.length fn > 4) &&
@@ -387,7 +393,7 @@
let start = Unix.gettimeofday () in
TranslateGame.set_timeout
(fun () -> Unix.gettimeofday() -. start > float (timeout));
- let res, msg = translate_file (dirname ^ fname) in
+ let res, msg = translate_file (dirname ^ fname) None in
let t = Unix.gettimeofday() -. start in
let final = if res then Printf.sprintf "Suceeded (%f sec.)\n%!" t else
Printf.sprintf "%s (%f sec)\n%!" msg t in
@@ -412,7 +418,7 @@
] in
Arg.parse opts (fun _ -> ()) "Try -help for help or one of the following.";
if !file <> "" then
- print_endline (snd (translate_file !file))
+ print_endline (snd (translate_file !file (Some !timeout)))
else if !testdir <> "" then
Aux.run_test_if_target "TranslateGameTest"
(translate_dir_tests !testdir !timeout)
Modified: trunk/Toss/GGP/examples/3pffa.gdl
===================================================================
--- trunk/Toss/GGP/examples/3pffa.gdl 2011-09-27 09:43:50 UTC (rev 1574)
+++ trunk/Toss/GGP/examples/3pffa.gdl 2011-09-27 23:53:22 UTC (rev 1575)
@@ -198,6 +198,4 @@
(scoremap 7 70)
(scoremap 8 80)
(scoremap 9 90)
-(scoremap 10 100)
-
-
+(scoremap 10 100)
\ No newline at end of file
Modified: trunk/Toss/GGP/examples/3pttc.gdl
===================================================================
--- trunk/Toss/GGP/examples/3pttc.gdl 2011-09-27 09:43:50 UTC (rev 1574)
+++ trunk/Toss/GGP/examples/3pttc.gdl 2011-09-27 23:53:22 UTC (rev 1575)
@@ -208,6 +208,3 @@
(stepcount 28 29)
(stepcount 29 30)
(stepcount 30 31)
-
-
-
Modified: trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.0.qdimacs.gdl
===================================================================
--- trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.0.qdimacs.gdl 2011-09-27 09:43:50 UTC (rev 1574)
+++ trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.0.qdimacs.gdl 2011-09-27 23:53:22 UTC (rev 1575)
@@ -373,6 +373,4 @@
(<= (goal exists 100) all_sat)
(<= (goal exists 0) (not all_sat))
(<= (goal forall 100) (not all_sat))
-(<= (goal forall 0) all_sat)
-
-
+(<= (goal forall 0) all_sat)
\ No newline at end of file
Modified: trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.2.qdimacs.SAT.gdl
===================================================================
--- trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.2.qdimacs.SAT.gdl 2011-09-27 09:43:50 UTC (rev 1574)
+++ trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.2.qdimacs.SAT.gdl 2011-09-27 23:53:22 UTC (rev 1575)
@@ -573,6 +573,4 @@
(<= (goal exists 100) all_sat)
(<= (goal exists 0) (not all_sat))
(<= (goal forall 100) (not all_sat))
-(<= (goal forall 0) all_sat)
-
-
+(<= (goal forall 0) all_sat)
\ No newline at end of file
Modified: trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.2.qdimacs.satlike.gdl
===================================================================
--- trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.2.qdimacs.satlike.gdl 2011-09-27 09:43:50 UTC (rev 1574)
+++ trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.2.qdimacs.satlike.gdl 2011-09-27 23:53:22 UTC (rev 1575)
@@ -580,6 +580,4 @@
(<= (goal forall 100) three_not_sat)
(<= one_not_sat (clause ?v86740) (not (true (sat ?v86740))))
(<= two_not_sat (clause ?v86751) (not (true (sat ?v86751))) (clause ?v86771) (not (true (sat ?v86771))) (distinct ?v86751 ?v86771))
-(<= three_not_sat (clause ?v86751) (not (true (sat ?v86751))) (clause ?v86771) (not (true (sat ?v86771))) (clause ?v86806) (not (true (sat ?v86806))) (distinct ?v86751 ?v86771) (distinct ?v86751 ?v86806) (distinct ?v86771 ?v86806))
-
-
+(<= three_not_sat (clause ?v86751) (not (true (sat ?v86751))) (clause ?v86771) (not (true (sat ?v86771))) (clause ?v86806) (not (true (sat ?v86806))) (distinct ?v86751 ?v86771) (distinct ?v86751 ?v86806) (distinct ?v86771 ?v86806))
\ No newline at end of file
Modified: trunk/Toss/GGP/examples/4pttc.gdl
===================================================================
--- trunk/Toss/GGP/examples/4pttc.gdl 2011-09-27 09:43:50 UTC (rev 1574)
+++ trunk/Toss/GGP/examples/4pttc.gdl 2011-09-27 23:53:22 UTC (rev 1575)
@@ -274,6 +274,3 @@
(succ 30 31)
(succ 31 32)
(succ 32 33)
-
-
-
Modified: trunk/Toss/GGP/examples/8puzzle.gdl
===================================================================
--- trunk/Toss/GGP/examples/8puzzle.gdl 2011-09-27 09:43:50 UTC (rev 1574)
+++ trunk/Toss/GGP/examples/8puzzle.gdl 2011-09-27 23:53:22 UTC (rev 1575)
@@ -150,6 +150,3 @@
(successor 57 58)
(successor 58 59)
(successor 59 60)
-
-
-
Added: trunk/Toss/GGP/examples/BattleSnakes.gdl
===================================================================
--- trunk/Toss/GGP/examples/BattleSnakes.gdl (rev 0)
+++ trunk/Toss/GGP/examples/BattleSnakes.gdl 2011-09-27 23:53:22 UTC (rev 1575)
@@ -0,0 +1,345 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;
+;; BattleSnakes
+;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Roles
+;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(role red)
+(role blue)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Initial State
+;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(init (snake 2 2 red 1))
+(init (snake 1 2 red 2))
+(init (snake 1 3 red 3))
+(init (snake 1 4 red 4))
+(init (snake 1 5 red 5))
+(init (snake 1 6 red 6))
+(init (snake 1 7 red 7))
+(init (snake 1 8 red 8))
+
+(init (snake 7 7 blue 1))
+(init (snake 8 7 blue 2))
+(init (snake 8 6 blue 3))
+(init (snake 8 5 blue 4))
+(init (snake 8 4 blue 5))
+(init (snake 8 3 blue 6))
+(init (snake 8 2 blue 7))
+(init (snake 8 1 blue 8))
+
+(init (step 0))
+
+(init (size red 8))
+(init (size blue 8))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Legal
+;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(<= (legal ?player (move ?x ?y ?x1 ?y))
+ (role ?player)
+ (true (snake ?x ?y ?player 1))
+ (adjacent ?x ?x1)
+)
+
+(<= (legal ?player (move ?x ?y ?x ?y1))
+ (role ?player)
+ (true (snake ?x ?y ?player 1))
+ (adjacent ?y ?y1)
+)
+
+(<= (adjacent ?x1 ?x2)
+ (boardSucc ?x1 ?x2)
+)
+
+(<= (adjacent ?x1 ?x2)
+ (boardSucc ?x2 ?x1)
+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Next
+;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Stepper
+(<= (next (step ?y))
+ (true (step ?x))
+ (succ ?x ?y)
+)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Moves
+
+;; Move Head ;;
+(<= (next (snake ?x1 ?y1 ?player 1))
+ (does ?player (move ?x ?y ?x1 ?y1))
+)
+
+;; Move Tail ;;
+;; No collision
+(<= (next (snake ?x ?y ?player ?newTail))
+ (true (snake ?x ?y ?player ?currTail))
+ (not (true (size ?player ?currTail)))
+ (succ ?currTail ?newTail)
+ (role ?player2)
+ (distinct ?player ?player2)
+ (not (collision ?player))
+ (not (collision ?player2))
+)
+
+;; Both collide
+(<= (next (snake ?x ?y ?player ?newTail))
+ (true (snake ?x ?y ?player ?currTail))
+ (not (true (size ?player ?currTail)))
+ (succ ?currTail ?newTail)
+ (role ?player2)
+ (distinct ?player ?player2)
+ (collision ?player)
+ (collision ?player2)
+)
+
+;; Player crashes
+(<= (next (snake ?x ?y ?player ?newTail))
+ (true (snake ?x ?y ?player ?currTail))
+ (true (size ?player ?size))
+ (succ ?size ?newsize)
+ (distinct ?currTail ?size)
+ (distinct ?currTail ?newsize)
+ (succ ?currTail ?newTail)
+ (role ?player2)
+ (distinct ?player ?player2)
+ (collision ?player)
+ (not (collision ?player2))
+)
+
+;; Other player crashes
+(<= (next (snake ?x ?y ?player ?newTail))
+ (true (snake ?x ?y ?player ?currTail))
+ (true (size ?player ?size))
+ (succ ?newsize ?size)
+ (distinct ?currTail ?newsize)
+ (succ ?currTail ?newTail)
+ (role ?player2)
+ (distinct ?player ?player2)
+ (collision ?player2)
+ (not (collision ?player))
+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Size
+
+;; No collision
+(<= (next (size ?player ?size))
+ (true (size ?player ?size))
+ (role ?player2)
+ (distinct ?player ?player2)
+ (not (collision ?player))
+ (not (collision ?player2))
+)
+
+;; Both collide
+(<= (next (size ?player ?size))
+ (true (size ?player ?size))
+ (role ?player2)
+ (distinct ?player ?player2)
+ (collision ?player)
+ (collision ?player2)
+)
+
+;; Player crashes
+(<= (next (size ?player ?newsize))
+ (true (size ?player ?size))
+ (role ?player2)
+ (distinct ?player ?player2)
+ (collision ?player)
+ (not (collision ?player2))
+ (succ ?size ?newsize)
+)
+
+;; Other player crashes
+(<= (next (size ?player ?newsize))
+ (true (size ?player ?size))
+ (role ?player2)
+ (distinct ?player ?player2)
+ (collision ?player2)
+ (not (collision ?player))
+ (succ ?newsize ?size)
+)
+
+(<= (collision ?player)
+ (does ?player (move ?a ?b ?c ?d))
+ (true (snake ?c ?d ?anyplayer ?body))
+ (true (size ?anyplayer ?size))
+ (distinct ?size ?body)
+)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Terminal States
+;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(score 1 100)
+(score 2 93)
+(score 3 86)
+(score 4 79)
+(score 5 72)
+(score 6 65)
+(score 7 58)
+(score 8 50)
+(score 9 42)
+(score 10 35)
+(score 11 28)
+(score 12 21)
+(score 13 14)
+(score 14 7)
+(score 15 0)
+
+(<= (goal ?player ?score)
+ (role ?player)
+ (true (size ?player ?size))
+ (score ?size ?score)
+)
+
+(<= (goal ?player1 100)
+ (role ?player1)
+ (role ?player2)
+ (true (size ?player2 15))
+ (true (size ?player1 1))
+)
+
+(<= (goal ?player2 0)
+ (role ?player1)
+ (role ?player2)
+ (true (size ?player2 15))
+ (true (size ?player1 1))
+)
+
+(<= terminal
+ (true (step 100))
+)
+
+(<= terminal
+ (true (size ?player1 1))
+ (true (size ?player2 15))
+ (distinct ?player1 ?player2)
+)
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Successors
+;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(boardSucc 1 2)
+(boardSucc 2 3)
+(boardSucc 3 4)
+(boardSucc 4 5)
+(boardSucc 5 6)
+(boardSucc 6 7)
+(boardSucc 7 8)
+(boardSucc 8 1)
+
+(succ 0 1)
+(succ 1 2)
+(succ 2 3)
+(succ 3 4)
+(succ 4 5)
+(succ 5 6)
+(succ 6 7)
+(succ 7 8)
+(succ 8 9)
+(succ 9 10)
+(succ 10 11)
+(succ 11 12)
+(succ 12 13)
+(succ 13 14)
+(succ 14 15)
+(succ 15 16)
+(succ 16 17)
+(succ 17 18)
+(succ 18 19)
+(succ 19 20)
+(succ 20 21)
+(succ 21 22)
+(succ 22 23)
+(succ 23 24)
+(succ 24 25)
+(succ 25 26)
+(succ 26 27)
+(succ 27 28)
+(succ 28 29)
+(succ 29 30)
+(succ 30 31)
+(succ 31 32)
+(succ 32 33)
+(succ 33 34)
+(succ 34 35)
+(succ 35 36)
+(succ 36 37)
+(succ 37 38)
+(succ 38 39)
+(succ 39 40)
+(succ 40 41)
+(succ 41 42)
+(succ 42 43)
+(succ 43 44)
+(succ 44 45)
+(succ 45 46)
+(succ 46 47)
+(succ 47 48)
+(succ 48 49)
+(succ 49 50)
+(succ 50 51)
+(succ 51 52)
+(succ 52 53)
+(succ 53 54)
+(succ 54 55)
+(succ 55 56)
+(succ 56 57)
+(succ 57 58)
+(succ 58 59)
+(succ 59 60)
+(succ 60 61)
+(succ 61 62)
+(succ 62 63)
+(succ 63 64)
+(succ 64 65)
+(succ 65 66)
+(succ 66 67)
+(succ 67 68)
+(succ 68 69)
+(succ 69 70)
+(succ 70 71)
+(succ 71 72)
+(succ 72 73)
+(succ 73 74)
+(succ 74 75)
+(succ 75 76)
+(succ 76 77)
+(succ 77 78)
+(succ 78 79)
+(succ 79 80)
+(succ 80 81)
+(succ 81 82)
+(succ 82 83)
+(succ 83 84)
+(succ 84 85)
+(succ 85 86)
+(succ 86 87)
+(succ 87 88)
+(succ 88 89)
+(succ 89 90)
+(succ 90 91)
+(succ 91 92)
+(succ 92 93)
+(succ 93 94)
+(succ 94 95)
+(succ 95 96)
+(succ 96 97)
+(succ 97 98)
+(succ 98 99)
+(succ 99 100)
\ No newline at end of file
Added: trunk/Toss/GGP/examples/Catch-Me-If-You-Can.gdl
===================================================================
--- trunk/Toss/GGP/examples/Catch-Me-If-You-Can.gdl (rev 0)
+++ trunk/Toss/GGP/examples/Catch-Me-If-You-Can.gdl 2011-09-27 23:53:22 UTC (rev 1575)
@@ -0,0 +1,110 @@
+; still buggy
+
+(role guard)
+(role intruder)
+
+(init (at guard 1 1))
+(init (at intruder 5 5))
+
+
+(co 1)
+(co 2)
+(co 3)
+(co 4)
+(co 5)
+
+(succ 1 2)
+(succ 2 3)
+(succ 3 4)
+(succ 4 5)
+
+
+
+(<= (goal ?r 0)
+(role ?r)
+(not terminal))
+
+(<= (goal ?r 0)
+(role ?r)
+(distinct ?r intruder)
+terminal
+(not remain))
+
+(<= (goal ?r 100)
+(role ?r)
+(distinct ?r intruder)
+terminal
+(true (at intruder ?x ?y)))
+
+(<= (goal intruder 0)
+terminal
+(true (at intruder ?x ?y)))
+
+(<= (goal intruder 100)
+terminal
+(not remain))
+
+(<= terminal
+(true (at guard ?x ?y))
+(true (at intruder ?x ?y)))
+
+(<= terminal
+(not remain))
+
+(<= remain
+(true (at intruder ?x ?y)))
+
+(<= (legal ?r stay)
+(true (at ?r ?x ?y)))
+
+(<= (legal intruder exit)
+(not terminal)
+(true (at intruder 1 1)))
+
+(<= (legal intruder exit)
+(not terminal)
+(true (at intruder 1 5)))
+
+(<= (legal ?r (move ?d))
+(not terminal)
+(true (at ?r ?u ?v))
+(adjacent ?u ?v ?d ?x ?y))
+
+(<= (adjacent ?x ?y1 north ?x ?y2)
+(co ?x)
+(succ ?y1 ?y2))
+
+(<= (adjacent ?x ?y1 south ?x ?y2)
+(co ?x)
+(succ ?y2 ?y1))
+
+(<= (adjacent ?x1 ?y east ?x2 ?y)
+(co ?y)
+(succ ?x1 ?x2))
+
+(<= (adjacent ?x1 ?y west ?x2 ?y)
+(co ?y)
+(succ ?x2 ?x1))
+
+(<= (next (at ?r ?x ?y))
+(does ?r stay)
+(true (at ?r ?x ?y)))
+
+(<= (next (at ?r ?x ?y))
+(does ?r (move ?d))
+(true (at ?r ?u ?v))
+(adjacent ?u ?v ?d ?x ?y)
+(not (capture ?r)))
+
+(<= (next (at intruder ?x ?y))
+(true (at intruder ?x ?y))
+(capture intruder))
+
+(<= (capture intruder)
+(true (at intruder ?x ?y))
+(true (at ?r ?u ?v))
+(does intruder (move ?d1))
+(does ?r (move ?d2))
+(adjacent ?x ?y ?d1 ?u ?v)
+(adjacent ?u ?v ?d2 ?x ?y))
+
Added: trunk/Toss/GGP/examples/Catch.Me.If.You.Can.gdl
===================================================================
--- trunk/Toss/GGP/examples/Catch.Me.If.You.Can.gdl (rev 0)
+++ trunk/Toss/GGP/examples/Catch.Me.If.You.Can.gdl 2011-09-27 23:53:22 UTC (rev 1575)
@@ -0,0 +1,108 @@
+(role guard)
+(role intruder)
+
+(init (at guard 1 1))
+(init (at intruder 5 5))
+
+
+(co 1)
+(co 2)
+(co 3)
+(co 4)
+(co 5)
+
+(succ 1 2)
+(succ 2 3)
+(succ 3 4)
+(succ 4 5)
+
+
+
+(<= (goal ?r 0)
+(role ?r)
+(not terminal))
+
+(<= (goal ?r 0)
+(role ?r)
+(distinct ?r intruder)
+terminal
+(not remain))
+
+(<= (goal ?r 100)
+(role ?r)
+(distinct ?r intruder)
+terminal
+(true (at intruder ?x ?y)))
+
+(<= (goal intruder 0)
+terminal
+(true (at intruder ?x ?y)))
+
+(<= (goal intruder 100)
+terminal
+(not remain))
+
+(<= terminal
+(true (at guard ?x ?y))
+(true (at intruder ?x ?y)))
+
+(<= terminal
+(not remain))
+
+(<= remain
+(true (at intruder ?x ?y)))
+
+(<= (legal ?r stay)
+(true (at ?r ?x ?y)))
+
+(<= (legal intruder exit)
+(not terminal)
+(true (at intruder 1 1)))
+
+(<= (legal intruder exit)
+(not terminal)
+(true (at intruder 1 5)))
+
+(<= (legal ?r (move ?d))
+(not terminal)
+(true (at ?r ?u ?v))
+(adjacent ?u ?v ?d ?x ?y))
+
+(<= (adjacent ?x ?y1 north ?x ?y2)
+(co ?x)
+(succ ?y1 ?y2))
+
+(<= (adjacent ?x ?y1 south ?x ?y2)
+(co ?x)
+(succ ?y2 ?y1))
+
+(<= (adjacent ?x1 ?y east ?x2 ?y)
+(co ?y)
+(succ ?x1 ?x2))
+
+(<= (adjacent ?x1 ?y west ?x2 ?y)
+(co ?y)
+(succ ?x2 ?x1))
+
+(<= (next (at ?r ?x ?y))
+(does ?r stay)
+(true (at ?r ?x ?y)))
+
+(<= (next (at ?r ?x ?y))
+(does ?r (move ?d))
+(true (at ?r ?u ?v))
+(adjacent ?u ?v ?d ?x ?y)
+(not (capture ?r)))
+
+(<= (next (at intruder ?x ?y))
+(true (at intruder ?x ?y))
+(capture intruder))
+
+(<= (capture intruder)
+(true (at intruder ?x ?y))
+(true (at ?r ?u ?v))
+(does intruder (move ?d1))
+(does ?r (move ?d2))
+(adjacent ?x ?y ?d1 ?u ?v)
+(adjacent ?u ?v ?d2 ?x ?y))
+
Added: trunk/Toss/GGP/examples/CatchMeIfYouCanTest.gdl
===================================================================
--- trunk/Toss/GGP/examples/CatchMeIfYouCanTest.gdl (rev 0)
+++ trunk/Toss/GGP/examples/CatchMeIfYouCanTest.gdl 2011-09-27 23:53:22 UTC (rev 1575)
@@ -0,0 +1,108 @@
+(role guard)
+(role intruder)
+
+(init (at guard 1 1))
+(init (at intruder 5 5))
+
+
+(co 1)
+(co 2)
+(co 3)
+(co 4)
+(co 5)
+
+(succ 1 2)
+(succ 2 3)
+(succ 3 4)
+(succ 4 5)
+
+
+
+(<= (goal ?r 0)
+(role ?r)
+(not terminal))
+
+(<= (goal ?r 0)
+(role ?r)
+(distinct ?r intruder)
+terminal
+(not remain))
+
+(<= (goal ?r 100)
+(role ?r)
+(distinct ?r intruder)
+terminal
+(true (at intruder ?x ?y)))
+
+(<= (goal intruder 0)
+terminal
+(true (at intruder ?x ?y)))
+
+(<= (goal intruder 100)
+terminal
+(not remain))
+
+(<= terminal
+(true (at guard ?x ?y))
+(true (at intruder ?x ?y)))
+
+(<= terminal
+(not remain))
+
+(<= remain
+(true (at intruder ?x ?y)))
+
+(<= (legal ?r stay)
+(true (at ?r ?x ?y)))
+
+(<= (legal intruder exit)
+(not terminal)
+(true (at intruder 1 1)))
+
+(<= (legal intruder exit)
+(not terminal)
+(true (at intruder 1 5)))
+
+(<= (legal ?r (move ?d))
+(not terminal)
+(true (at ?r ?u ?v))
+(adjacent ?u ?v ?d ?x ?y))
+
+(<= (adjacent ?x ?y1 north ?x ?y2)
+(co ?x)
+(succ ?y1 ?y2))
+
+(<= (adjacent ?x ?y1 south ?x ?y2)
+(co ?x)
+(succ ?y2 ?y1))
+
+(<= (adjacent ?x1 ?y east ?x2 ?y)
+(co ?y)
+(succ ?x1 ?x2))
+
+(<= (adjacent ?x1 ?y west ?x2 ?y)
+(co ?y)
+(succ ?x2 ?x1))
+
+(<= (next (at ?r ?x ?y))
+(does ?r stay)
+(true (at ?r ?x ?y)))
+
+(<= (next (at ?r ?x ?y))
+(does ?r (move ?d))
+(true (at ?r ?u ?v))
+(adjacent ?u ?v ?d ?x ?y)
+(not (capture ?r)))
+
+(<= (next (at intruder ?x ?y))
+(true (at intruder ?x ?y))
+(capture intruder))
+
+(<= (capture intruder)
+(true (at intruder ?x ?y))
+(true (at ?r ?u ?v))
+(does intruder (move ?d1))
+(does ?r (move ?d2))
+(adjacent ?x ?y ?d1 ?u ?v)
+(adjacent ?u ?v ?d2 ?x ?y))
+
Added: trunk/Toss/GGP/examples/CephalopodMicro.gdl
===================================================================
--- trunk/Toss/GGP/examples/CephalopodMicro.gdl (rev 0)
+++ trunk/Toss/GGP/examples/CephalopodMicro.gdl 2011-09-27 23:53:22 UTC (rev 1575)
@@ -0,0 +1,555 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;; CephalopodMicro
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;; GDL by Ethan Dreyfuss
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;; Description:
+;;;; Cephalopod is a board game played with dice (with no randomness!)
+;;;; invented by Mark Steere in 2006.
+;;;; See http://vying.org/games/cephalopod for details.
+;;;; This is a smaller variant played on a 3x3 board instead of 3x5 or 5x5
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(role red)
+(role black)
+(init (control red))
+
+;;;; LEGAL MOVES ;;;;
+
+(<= (legal red noop)
+ (true (control black)))
+
+(<= (legal black noop)
+ (true (control red)))
+
+(<= (legal red noop)
+ boardFull)
+
+(<= (legal black noop)
+ boardFull)
+
+(<= (legal ?player (play ?x ?y ?amount ?captureMask))
+ (true (control ?player))
+ (empty ?x ?y)
+ (side ?amount)
+ (mask ?captureMask)
+ (captureSum ?x ?y ?amount ?captureMask))
+
+(<= (legal ?player (play ?x ?y 1 0))
+ (numX ?y)
+ (true (control ?player))
+ (empty ?x ?y)
+ (noCaptureSum ?x ?y))
+
+;;;;; Physics ;;;;;;;;;;
+
+;;Cells persist if not the play location and not a capture location
+(<= (next (cell ?x ?y ?val ?player))
+ (true (cell ?x ?y ?val ?player))
+ (not (capturedAt ?x ?y)))
+
+(<= (capturedAt ?x ?y)
+ (does ?player (play ?x2 ?y2 ?amount ?captureMask))
+ (inMask ?x2 ?y2 ?captureMask ?x ?y))
+
+;;Cells become whatever is played at that location
+(<= (next (cell ?x ?y ?val ?player))
+ (does ?player (play ?x ?y ?val ?captureMask)))
+
+(<= (next (control red))
+ (true (control black)))
+
+(<= (next (control black))
+ (true (control red)))
+
+;;;; Terminal and Goal ;;;;;;
+
+(<= terminal
+ boardFull)
+
+(<= (goal black 100)
+ (morePieces black red))
+
+(<= (goal red 0)
+ (morePieces black red))
+
+(<= (goal red 100)
+ (morePieces red black))
+
+(<= (goal black 0)
+ (morePieces red black))
+
+(<= (goal black 0)
+ (not boardFull))
+
+(<= (goal red 0)
+ (not boardFull))
+
+;;;;;; Helper Methods (AKA view) ;;;;;;;;;
+
+;; There is no possible capture at a given square
+(<= (noCaptureSum ?x ?y)
+ (num ?x)
+ (numX ?y)
+ (not (isCaptureSum ?x ?y)))
+
+(<= (isCaptureSum ?x ?y)
+ (captureSum ?x ?y ?val ?captureMask))
+
+;; Sums up adjacent squares
+(<= (captureSum ?x ?y ?amount ?captureMask)
+ (side ?amount)
+ (leftVal ?captureMask ?x ?y ?val1)
+ (topVal ?captureMask ?x ?y ?val2)
+ (bottomVal ?captureMask ?x ?y ?val3)
+ (rightVal ?captureMask ?x ?y ?val4)
+ (not (threeZeros ?val1 ?val2 ?val3 ?val4))
+ (fourSum ?val1 ?val2 ?val3 ?val4 ?amount))
+
+(<= (threeZeros ?val 0 0 0)
+ (side ?val))
+(<= (threeZeros 0 ?val 0 0)
+ (side ?val))
+(<= (threeZeros 0 0 ?val 0)
+ (side ?val))
+(<= (threeZeros 0 0 0 ?val)
+ (side ?val))
+(threeZeros 0 0 0 0)
+
+(<= (fourSum ?a ?b ?c ?d ?result)
+ (sum ?a ?b ?res1)
+ (sum ?c ?d ?res2)
+ (sum ?res1 ?res2 ?result))
+
+(<= (leftVal ?captureMask ?x ?y 0)
+ (mask ?captureMask)
+ (num ?x)
+ (numX ?y)
+ (not (leftBit ?captureMask)))
+
+(<= (leftVal ?captureMask ?x ?y 0)
+ (leftBit ?captureMask)
+ (before ?x ?xMinus)
+ (empty ?xMinus ?y))
+
+(<= (leftVal ?captureMask ?x ?y ?val)
+ (leftBit ?captureMask)
+ (before ?x ?xMinus)
+ (true (cell ?xMinus ?y ?val ?player)))
+
+(<= (topVal ?captureMask ?x ?y 0)
+ (mask ?captureMask)
+ (num ?x)
+ (numX ?y)
+ (not (topBit ?captureMask)))
+
+(<= (topVal ?captureMask ?x ?y 0)
+ (topBit ?captureMask)
+ (before ?y ?yMinus)
+ (empty ?x ?yMinus))
+
+(<= (topVal ?captureMask ?x ?y ?val)
+ (topBit ?captureMask)
+ (before ?y ?yMinus)
+ (true (cell ?x ?yMinus ?val ?player)))
+
+(<= (rightVal ?captureMask ?x ?y 0)
+ (mask ?captureMask)
+ (num ?x)
+ (numX ?y)
+ (not (rightBit ?captureMask)))
+
+(<= (rightVal ?captureMask ?x ?y 0)
+ (rightBit ?captureMask)
+ (after ?x ?xPlus)
+ (empty ?xPlus ?y))
+
+(<= (rightVal ?captureMask ?x ?y ?val)
+ (rightBit ?captureMask)
+ (after ?x ?xPlus)
+ (true (cell ?xPlus ?y ?val ?player)))
+
+(<= (bottomVal ?captureMask ?x ?y 0)
+ (mask ?captureMask)
+ (num ?x)
+ (numX ?y)
+ (not (bottomBit ?captureMask)))
+
+(<= (bottomVal ?captureMask ?x ?y 0)
+ (bottomBit ?captureMask)
+ (afterX ?y ?yPlus)
+ (empty ?x ?yPlus))
+
+(<= (bottomVal ?captureMask ?x ?y ?val)
+ (bottomBit ?captureMask)
+ (afterX ?y ?yPlus)
+ (true (cell ?x ?yPlus ?val ?player)))
+
+(<= (notInMask ?xOrig ?yOrig ?captureMask ?x ?y)
+ (num ?x)
+ (numX ?y)
+ (num ?xOrig)
+ (numX ?yOrig)
+ (mask ?captureMask)
+ (not (inMask ?xOrig ?yOrig ?captureMask ?x ?y)))
+
+(<= (empty ?x ?y)
+ (num ?x)
+ (numX ?y)
+ (not (true (cell ?x ?y 1 red)))
+ (not (true (cell ?x ?y 2 red)))
+ (not (true (cell ?x ?y 3 red)))
+ (not (true (cell ?x ?y 4 red)))
+ (not (true (cell ?x ?y 5 red)))
+ (not (true (cell ?x ?y 6 red)))
+ (not (true (cell ?x ?y 1 black)))
+ (not (true (cell ?x ?y 2 black)))
+ (not (true (cell ?x ?y 3 black)))
+ (not (true (cell ?x ?y 4 black)))
+ (not (true (cell ?x ?y 5 black)))
+ (not (true (cell ?x ?y 6 black)))
+ )
+
+(<= (empty ?x OFFBOARD)
+ (num ?x))
+
+(<= (empty OFFBOARD ?x)
+ (numX ?x))
+
+(<= boardFull
+ (not someCellEmpty))
+
+(<= someCellEmpty
+ (num ?x)
+ (numX ?y)
+ (empty ?x ?y))
+
+(<= (morePieces ?player1 ?player2)
+ (pieceCount ?player1 ?val1)
+ (pieceCount ?player2 ?val2)
+ (greater ?val1 ?val2))
+
+(<= (pieceCount ?player ?val)
+ (addRow 0 1 ?player ?result1)
+ (addRow ?result1 2 ?player ?result2)
+ (addRow ?result2 3 ?player ?val))
+
+;; (<= (next (count ?player ?num))
+;; (pieceCount ?player ?num))
+
+(<= (addRow ?inVal ?row ?player ?outVal)
+ (addCell ?inVal ?row 1 ?player ?result1)
+ (addCell ?result1 ?row 2 ?player ?result2)
+ (addCell ?result2 ?row 3 ?player ?outVal))
+
+(<= (addCell ?in ?row ?col ?player ?out)
+ (true (cell ?row ?col ?val ?player))
+ (plusplus ?in ?out))
+
+(<= (addCell ?in ?row ?col ?player ?in)
+ (oneThroughTwentyFive ?in)
+ (role ?player)
+ (role ?player2)
+ (distinct ?player ?player2)
+ (true (cell ?row ?col ?val ?player2)))
+
+(<= (oneThroughTwentyFive ?x)
+ (plusplus ?x ?y))
+
+(<= (oneThroughTwentyFive ?x)
+ (plusplus ?y ?x))
+
+;;Before and After;;
+(before 1 OFFBOARD) (before 2 1) (before 3 2)
+(after 1 2) (after 2 3) (after 3 OFFBOARD)
+(afterX 1 2) (afterX 2 3) (afterX 3 OFFBOARD)
+
+;;;;; Constants ;;;;;
+(num 1) (num 2) (num 3)
+(numX 1) (numX 2) (numX 3)
+(side 1) (side 2) (side 3) (side 4) (side 5) (side 6)
+
+;;;;; Math ;;;;;;
+(sum 0 0 0)
+(sum 0 1 1)
+(sum 0 2 2)
+(sum 0 3 3)
+(sum 0 4 4)
+(sum 0 5 5)
+(sum 0 6 6)
+(sum 1 0 1)
+(sum 1 1 2)
+(sum 1 2 3)
+(sum 1 3 4)
+(sum 1 4 5)
+(sum 1 5 6)
+(sum 2 0 2)
+(sum 2 1 3)
+(sum 2 2 4)
+(sum 2 3 5)
+(sum 2 4 6)
+(sum 3 0 3)
+(sum 3 1 4)
+(sum 3 2 5)
+(sum 3 3 6)
+(sum 4 0 4)
+(sum 4 1 5)
+(sum 4 2 6)
+(sum 5 0 5)
+(sum 5 1 6)
+(sum 6 0 6)
+
+(plusplus 0 1)
+(plusplus 1 2)
+(plusplus 2 3)
+(plusplus 3 4)
+(plusplus 4 5)
+(plusplus 5 6)
+(plusplus 6 7)
+(plusplus 7 8)
+(plusplus 8 9)
+
+(greater 1 0)
+(greater 2 0)
+(greater 2 1)
+(greater 3 0)
+(greater 3 1)
+(greater 3 2)
+(greater 4 0)
+(greater 4 1)
+(greater 4 2)
+(greater 4 3)
+(greater 5 0)
+(greater 5 1)
+(greater 5 2)
+(greater 5 3)
+(greater 5 4)
+(greater 6 0)
+(greater 6 1)
+(greater 6 2)
+(greater 6 3)
+(greater 6 4)
+(greater 6 5)
+(greater 7 0)
+(greater 7 1)
+(greater 7 2)
+(greater 7 3)
+(greater 7 4)
+(greater 7 5)
+(greater 7 6)
+(greater 8 0)
+(greater 8 1)
+(greater 8 2)
+(greater 8 3)
+(greater 8 4)
+(greater 8 5)
+(greater 8 6)
+(greater 8 7)
+(greater 9 0)
+(greater 9 1)
+(greater 9 2)
+(greater 9 3)
+(greater 9 4)
+(greater 9 5)
+(greater 9 6)
+(greater 9 7)
+(greater 9 8)
+
+;;; Masks ;;;;
+(mask 3)
+(mask 5)
+(mask 6)
+(mask 7)
+(mask 9)
+(mask 10)
+(mask 11)
+(mask 12)
+(mask 13)
+(mask 14)
+(mask 15)
+
+(leftBit 1)
+(topBit 2)
+(leftBit 3) (topBit 3)
+(bottomBit 4)
+(leftBit 5) (bottomBit 5)
+(topBit 6) (bottomBit 6)
+(leftBit 7) (topBit 7) (bottomBit 7)
+(rightBit 8)
+(leftBit 9) (rightBit 9)
+(topBit 10) (rightBit 10)
+(leftBit 11) (topBit 11) (rightBit 11)
+(bottomBit 12) (rightBit 12)
+(leftBit 13) (bottomBit 13) (rightBit 13)
+(topBit 14) (bottomBit 14) (rightBit 14)
+(leftBit 15) (topBit 15) (bottomBit 15) (rightBit 15)
+
+;;;;; Fatty flattened inMask relation (generated by short little Java program) ;;;;;
+(inMask 1 2 3 1 1)
+(inMask 1 3 3 1 2)
+(inMask 2 1 3 1 1)
+(inMask 2 2 3 1 2)
+(inMask 2 2 3 2 1)
+(inMask 2 3 3 1 3)
+(inMask 2 3 3 2 2)
+(inMask 3 1 3 2 1)
+(inMask 3 2 3 2 2)
+(inMask 3 2 3 3 1)
+(inMask 3 3 3 2 3)
+(inMask 3 3 3 3 2)
+(inMask 1 1 5 1 2)
+(inMask 1 2 5 1 3)
+(inMask 2 1 5 1 1)
+(inMask 2 1 5 2 2)
+(inMask 2 2 5 1 2)
+(inMask 2 2 5 2 3)
+(inMask 2 3 5 1 3)
+(inMask 3 1 5 2 1)
+(inMask 3 1 5 3 2)
+(inMask 3 2 5 2 2)
+(inMask 3 2 5 3 3)
+(inMask 3 3 5 2 3)
+(inMask 1 1 6 1 2)
+(inMask 1 2 6 1 1)
+(inMask 1 2 6 1 3)
+(inMask 1 3 6 1 2)
+(inMask 2 1 6 2 2)
+(inMask 2 2 6 2 1)
+(inMask 2 2 6 2 3)
+(inMask 2 3 6 2 2)
+(inMask 3 1 6 3 2)
+(inMask 3 2 6 3 1)
+(inMask 3 2 6 3 3)
+(inMask 3 3 6 3 2)
+(inMask 1 1 7 1 2)
+(inMask 1 2 7 1 1)
+(inMask 1 2 7 1 3)
+(inMask 1 3 7 1 2)
+(inMask 2 1 7 1 1)
+(inMask 2 1 7 2 2)
+(inMask 2 2 7 1 2)
+(inMask 2 2 7 2 1)
+(inMask 2 2 7 2 3)
+(inMask 2 3 7 1 3)
+(inMask 2 3 7 2 2)
+(inMask 3 1 7 2 1)
+(inMask 3 1 7 3 2)
+(inMask 3 2 7 2 2)
+(inMask 3 2 7 3 1)
+(inMask 3 2 7 3 3)
+(inMask 3 3 7 2 3)
+(inMask 3 3 7 3 2)
+(inMask 1 1 9 2 1)
+(inMask 1 2 9 2 2)
+(inMask 1 3 9 2 3)
+(inMask 2 1 9 1 1)
+(inMask 2 1 9 3 1)
+(inMask 2 2 9 1 2)
+(inMask 2 2 9 3 2)
+(inMask 2 3 9 1 3)
+(inMask 2 3 9 3 3)
+(inMask 3 1 9 2 1)
+(inMask 3 2 9 2 2)
+(inMask 3 3 9 2 3)
+(inMask 1 1 10 2 1)
+(inMask 1 2 10 1 1)
+(inMask 1 2 10 2 2)
+(inMask 1 3 10 1 2)
+(inMask 1 3 10 2 3)
+(inMask 2 1 10 3 1)
+(inMask 2 2 10 2 1)
+(inMask 2 2 10 3 2)
+(inMask 2 3 10 2 2)
+(inMask 2 3 10 3 3)
+(inMask 3 2 10 3 1)
+(inMask 3 3 10 3 2)
+(inMask 1 1 11 2 1)
+(inMask 1 2 11 1 1)
+(inMask 1 2 11 2 2)
+(inMask 1 3 11 1 2)
+(inMask 1 3 11 2 3)
+(inMask 2 1 11 1 1)
+(inMask 2 1 11 3 1)
+(inMask 2 2 11 1 2)
+(inMask 2 2 11 2 1)
+(inMask 2 2 11 3 2)
+(inMask 2 3 11 1 3)
+(inMask 2 3 11 2 2)
+(inMask 2 3 11 3 3)
+(inMask 3 1 11 2 1)
+(inMask 3 2 11 2 2)
+(inMask 3 2 11 3 1)
+(inMask 3 3 11 2 3)
+(inMask 3 3 11 3 2)
+(inMask 1 1 12 1 2)
+(inMask 1 1 12 2 1)
+(inMask 1 2 12 1 3)
+(inMask 1 2 12 2 2)
+(inMask 1 3 12 2 3)
+(inMask 2 1 12 2 2)
+(inMask 2 1 12 3 1)
+(inMask 2 2 12 2 3)
+(inMask 2 2 12 3 2)
+(inMask 2 3 12 3 3)
+(inMask 3 1 12 3 2)
+(inMask 3 2 12 3 3)
+(inMask 1 1 13 1 2)
+(inMask 1 1 13 2 1)
+(inMask 1 2 13 1 3)
+(inMask 1 2 13 2 2)
+(inMask 1 3 13 2 3)
+(inMask 2 1 13 1 1)
+(inMask 2 1 13 2 2)
+(inMask 2 1 13 3 1)
+(inMask 2 2 13 1 2)
+(inMask 2 2 13 2 3)
+(inMask 2 2 13 3 2)
+(inMask 2 3 13 1 3)
+(inMask 2 3 13 3 3)
+(inMask 3 1 13 2 1)
+(inMask 3 1 13 3 2)
+(inMask 3 2 13 2 2)
+(inMask 3 2 13 3 3)
+(inMask 3 3 13 2 3)
+(inMask 1 1 14 1 2)
+(inMask 1 1 14 2 1)
+(inMask 1 2 14 1 1)
+(inMask 1 2 14 1 3)
+(inMask 1 2 14 2 2)
+(inMask 1 3 14 1 2)
+(inMask 1 3 14 2 3)
+(inMask 2 1 14 2 2)
+(inMask 2 1 14 3 1)
+(inMask 2 2 14 2 1)
+(inMask 2 2 14 2 3)
+(inMask 2 2 14 3 2)
+(inMask 2 3 14 2 2)
+(inMask 2 3 14 3 3)
+(inMask 3 1 14 3 2)
+(inMask 3 2 14 3 1)
+(inMask 3 2 14 3 3)
+(inMask 3 3 14 3 2)
+(inMask 1 1 15 1 2)
+(inMask 1 1 15 2 1)
+(inMask 1 2 15 1 1)
+(inMask 1 2 15 1 3)
+(inMask 1 2 15 2 2)
+(inMask 1 3 15 1 2)
+(inMask 1 3 15 2 3)
+(inMask 2 1 15 1 1)
+(inMask 2 1 15 2 2)
+(inMask 2 1 15 3 1)
+(inMask 2 2 15 1 2)
+(inMask 2 2 15 2 1)
+(inMask 2 2 15 2 3)
+(inMask 2 2 15 3 2)
+(inMask 2 3 15 1 3)
+(inMask 2 3 15 2 2)
+(inMask 2 3 15 3 3)
+(inMask 3 1 15 2 1)
+(inMask 3 1 15 3 2)
+(inMask 3 2 15 2 2)
+(inMask 3 2 15 3 1)
+(inMask 3 2 15 3 3)
+(inMask 3 3 15 2 3)
+(inMask 3 3 15 3 2)
\ No newline at end of file
Added: trunk/Toss/GGP/examples/DoubleAuctionDJ.gdl
===================================================================
--- trunk/Toss/GGP/examples/DoubleAuctionDJ.gdl (rev 0)
+++ trunk/Toss/GGP/examples/DoubleAuctionDJ.gdl 2011-09-27 23:53:22 UTC (rev 1575)
@@ -0,0 +1,322 @@
+(role broker)
+(role trader1)
+(role trader2)
+
+(init (control trader))
+(init (time 0))
+
+(<= (legal trader1 (ask 1 ?p))
+ (true (control trader))
+ (num ?p))
+
+(<= (legal trader2 (bid 1 ?p))
+ (true (control trader))
+ (num ?p))
+
+(<= (legal trader1 noop)
+ (true (control broker)))
+
+(<= (legal trader2 noop)
+ (true (control broker)))
+
+(<= (legal broker (match (ask ?a1 ?a ?p1) (bid ?a2 ?q ?p2) ?q ?p))
+ (true (control broker))
+ (true (ask ?a1 ?q1 ?p1))
+ (true (bid ?q2 ?q2 ?p2))
+ (ls_or_eq ?p1 ?p2)
+ (price ?p1 ?p2 ?p))
+
+(<= (legal broker noop)
+ (true (control broker))
+ (true (ask ?a1 ?q1 ?p1))
+ (true (bid ?a2 ?q2 ?p2))
+ (not (ls_or_eq ?p1 ?p2)))
+
+(<= (legal broker noop)
+ (true (control trader)))
+
+(<= (price ?p ?p ?p)
+ (num ?p))
+
+(<= (price ?p1 ?p2 ?p1)
+ (succ ?p1 ?p2))
+
+(<= (price ?p1 ?p2 ?p)
+ (succ ?p1 ?p3)
+ (succ ?p4 ?p2)
+ (price ?p3 ?p4 ?p))
+
+(<= (ls_or_eq ?p ?p)
+ (num ?p))
+
+(<= (ls_or_eq ?p1 ?p2)
+ (succ ?p1 ?p3)
+ (ls_or_eq ?p3 ?p2))
+
+(<= (next (control broker))
+ (true (control trader)))
+
+(<= (next (control trader))
+ (true (control broker)))
+
+(<= (next (time ?n))
+ (true (time ?c))
+ (succ ?c ?n))
+
+(<= (next (ask ?t ?q ?p))
+ (does ?t (ask ?q ?p)))
+
+(<= (next (ask ?t ?q ?p))
+ (does ?t (bid ?q ?p)))
+
+(<= (next stop)
+ (does broker (match (ask ?a1 ?q1 ?p1) (bid ?a2 ?q2 ?p2) ?q ?p)))
+
+(<= (next (value ?a1 ?q ?p ask))
+ (does broker (match (ask ?a1 ?q1 ?p1) (bid ?a2 ?q2 ?p2) ?q ?p)))
+
+(<= (next (value ?a2 ?q ?p bid))
+ (does broker (match (ask ?a1 ?q1 ?p1) (bid ?a2 ?q2 ?p2) ?q ?p)))
+
+; (<= (next (ask ?a ?q ?p))
+ ; (true (ask ?a ?q ?p))
+ ; (does broker noop))
+
+; (<= (next (bid ?a ?q ?p))
+ ; (true (bid ?a ?q ?p))
+ ; (does broker noop))
+
+(<= (goal broker 100)
+ (true stop))
+
+(<= (goal ?a 0)
+ (role ?a)
+ (not (true stop)))
+
+(<= (goal ?a ?p)
+ (true (value ?a ?q ?p ask)))
+
+(<= (goal ?a ?v)
+ (true (value ?a ?q ?p bid))
+ (save ?p ?v))
+
+(<= (save ?p ?v)
+ (subtract 100 ?p 0 ?v))
+
+(<= (subtract ?p ?p ?v ?v)
+ (num ?p)
+ (num ?v))
+
+(<= (subtract ?m ?p ?v1 ?v)
+ (succ ?n ?m)
+ (succ ?v1 ?v2)
+ (subtract ?n ?p ?v2 ?v))
+
+(<= terminal
+ (true stop))
+
+(<= terminal
+ (true (time 10)))
+
+(num 0)
+(num 1)
+(num 2)
+(num 3)
+(num 4)
+(num 5)
+(num 6)
+(num 7)
+(num 8)
+(num 9)
+(num 10)
+(num 11)
+(num 12)
+(num 13)
+(num 14)
+(num 15)
+(num 16)
+(num 17)
+(num 18)
+(num 19)
+(num 20)
+(num 21)
+(num 22)
+(num 23)
+(num 24)
+(num 25)
+(num 26)
+(num 27)
+(num 28)
+(num 29)
+(num 30)
+(num 31)
+(num 32)
+(num 33)
+(num 34)
+(num 35)
+(num 36)
+(num 37)
+(num 38)
+(num 39)
+(num 40)
+(num 41)
+(num 42)
+(num 43)
+(num 44)
+(num 45)
+(num 46)
+(num 47)
+(num 48)
+(num 49)
+(num 50)
+(num 51)
+(num 52)
+(num 53)
+(num 54)
+(num 55)
+(num 56)
+(num 57)
+(num 58)
+(num 59)
+(num 60)
+(num 61)
+(num 62)
+(num 63)
+(num 64)
+(num 65)
+(num 66)
+(num 67)
+(num 68)
+(num 69)
+(num 70)
+(num 71)
+(num 72)
+(num 73)
+(num 74)
+(num 75)
+(num 76)
+(num 77)
+(num 78)
+(num 79)
+(num 80)
+(num 81)
+(num 82)
+(num 83)
+(num 84)
+(num 85)
+(num 86)
+(num 87)
+(num 88)
+(num 89)
+(num 90)
+(num 91)
+(num 92)
+(num 93)
+(num 94)
+(num 95)
+(num 96)
+(num 97)
+(num 98)
+(num 99)
+(num 100)
+
+(succ 0 1)
+(succ 1 2)
+(succ 2 3)
+(succ 3 4)
+(succ 4 5)
+(succ 5 6)
+(succ 6 7)
+(succ 7 8)
+(succ 8 9)
+(succ 9 10)
+(succ 10 11)
+(succ 11 12)
+(succ 12 13)
+(succ 13 14)
+(succ 14 15)
+(succ 15 16)
+(succ 16 17)
+(succ 17 18)
+(succ 18 19)
+(succ 19 20)
+(succ 20 21)
+(succ 21 22)
+(succ 22 23)
+(succ 23 24)
+(succ 24 25)
+(succ 25 26)
+(succ 26 27)
+(succ 27 28)
+(succ 28 29)
+(succ 29 30)
+(succ 30 31)
+(succ 31 32)
+(succ 32 33)
+(succ 33 34)
+(succ 34 35)
+(succ 35 36)
+(succ 36 37)
+(succ 37 38)
+(succ 38 39)
+(succ 39 40)
+(succ 40 41)
+(succ 41 42)
+(succ 42 43)
+(succ 43 44)
+(succ 44 45)
+(succ 45 46)
+(succ 46 47)
+(succ 47 48)
+(succ 48 49)
+(succ 49 50)
+(succ 50 51)
+(succ 51 52)
+(succ 52 53)
+(succ 53 54)
+(succ 54 55)
+(succ 55 56)
+(succ 56 57)
+(succ 57 58)
+(succ 58 59)
+(succ 59 60)
+(succ 60 61)
+(succ 61 62)
+(succ 62 63)
+(succ 63 64)
+(succ 64 65)
+(succ 65 66)
+(succ 66 67)
+(succ 67 68)
+(succ 68 69)
+(succ 69 70)
+(succ 70 71)
+(succ 71 72)
+(succ 72 73)
+(succ 73 74)
+(succ 74 75)
+(succ 75 76)
+(succ 76 77)
+(succ 77 78)
+(succ 78 79)
+(succ 79 80)
+(succ 80 81)
+(succ 81 82)
+(succ 82 83)
+(succ 83 84)
+(succ 84 85)
+(succ 85 86)
+(succ 86 87)
+(succ 87 88)
+(succ 88 89)
+(succ 89 90)
+(succ 90 91)
+(succ 91 92)
+(succ 92 93)
+(succ 93 94)
+(succ 94 95)
+(succ 95 96)
+(succ 96 97)
+(succ 97 98)
+(succ 98 99)
+(succ 99 100)
Added: trunk/Toss/GGP/examples/Guard_Intruder.gdl
===================================================================
--- trunk/Toss/GGP/examples/Guard_Intruder.gdl (rev 0)
+++ trunk/Toss/GGP/examples/Guard_Intruder.gdl 2011-09-27 23:53:22 UTC (rev 1575)
@@ -0,0 +1,108 @@
+(role guard)
+(role intruder)
+
+(init (at guard 1 1))
+(init (at intruder 5 5))
+
+
+(co 1)
+(co 2)
+(co 3)
+(co 4)
+(co 5)
+
+(succ 1 2)
+(succ 2 3)
+(succ 3 4)
+(succ 4 5)
+
+
+
+(<= (goal ?r 0)
+(role ?r)
+(not terminal))
+
+(<= (goal ?r 0)
+(role ?r)
+(distinct ?r intruder)
+terminal
+(not remain))
+
+(<= (goal ?r 100)
+(role ?r)
+(distinct ?r intruder)
+terminal
+(true (at intruder ?x ?y)))
+
+(<= (goal intruder 0)
+terminal
+(true (at intruder ?x ?y)))
+
+(<= (goal intruder 100)
+terminal
+(not remain))
+
+(<= terminal
+(true (at guard ?x ?y))
+(true (at intruder ?x ?y)))
+
+(<= terminal
+(not remain))
+
+(<= remain
+(true (at intruder ?x ?y)))
+
+(<= (legal ?r stay)
+(true (at ?r ?x ?y)))
+
+(<= (legal intruder exit)
+(not terminal)
+(true (at intruder 1 1)))
+
+(<= (legal intruder exit)
+(not terminal)
+(true (at intruder 1 5)))
+
+(<= (legal ?r (move ?d))
+(not terminal)
+(true (at ?r ?u ?v))
+(adjacent ?u ?v ?d ?x ?y))
+
+(<= (adjacent ?x ?y1 north ?x ?y2)
+(co ?x)
+(succ ?y1 ?y2))
+
+(<= (adjacent ?x ?y1 south ?x ?y2)
+(co ?x)
+(succ ?y2 ?y1))
+
+(<= (adjacent ?x1 ?y east ?x2 ?y)
+(co ?y)
+(succ ?x1 ?x2))
+
+(<= (adjacent ?x1 ?y west ?x2 ?y)
+(co ?y)
+(succ ?x2 ?x1))
+
+(<= (next (at ?r ?x ?y))
+(does ?r stay)
+(true (at ?r ?x ?y)))
+
+(<= (next (at ?r ?x ?y))
+(does ?r (move ?d))
+(true (at ?r ?u ?v))
+(adjacent ?u ?v ?d ?x ?y)
+(not (capture ?r)))
+
+(<= (next (at intruder ?x ?y))
+(true (at intruder ?x ?y))
+(capture intruder))
+
+(<= (capture intruder)
+(true (at intruder ?x ?y))
+(true (at ?r ?u ?v))
+(does intruder (move ?d1))
+(does ?r (move ?d2))
+(adjacent ?x ?y ?d1 ?u ?v)
+(adjacent ?u ?v ?d2 ?x ?y))
+
Added: trunk/Toss/GGP/examples/Nine_Mens_Morris_0.11_2p.gdl
===================================================================
--- trunk/Toss/GGP/examples/Nine_Mens_Morris_0.11_2p.gdl (rev 0)
+++ trunk/Toss/GGP/examples/Nine_Mens_Morris_0.11_2p.gdl 2011-09-27 23:53:22 UTC (rev 1575)
@@ -0,0 +1,405 @@
+;; Nine Mens Morris
+;; Author: Martin Boelle
+;; v 0.1
+;;
+;; A non GDL description of the game can
+;; be found here:
+;; http://en.wikipedia.org/wiki/Nine_Men's_Morris
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+(role white)
+(role black)
+
+(init (spot 1 a blank))
+(init (spot 1 d- blank))
+(init (spot 1 g blank))
+(init (spot 2 b blank))
+(init (spot 2 d- blank))
+(init (spot 2 f blank))
+(init (spot 3 c blank))
+(init (spot 3 d- blank))
+(init (spot 3 e blank))
+(init (spot 4- a blank))
+(init (spot 4- b blank))
+(init (spot 4- c blank))
+(init (spot 4+ e blank))
+(init (spot 4+ f blank))
+(init (spot 4+ g blank))
+(init (spot 5 c blank))
+(init (spot 5 d+ blank))
+(init (spot 5 e blank))
+(init (spot 6 b blank))
+(init (spot 6 d+ blank))
+(init (spot 6 f blank))
+(init (spot 7 a blank))
+(init (spot 7 d+ blank))
+(init (spot 7 g blank))
+
+(init (turnOf white))
+(init (phase opening))
+
+(init (remainders white 9))
+(init (remainders black 9))
+
+(init (ply 1))
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; NEXT Relations
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+ ;; Player occupies empty spot
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(<= (next (spot ?x ?y ?player))
+ (does ?player (put ?x ?y)) )
+
+(<= (next (remainingPieces ?player z2))
+ (does ?player (put ?x ?y))
+ (true (remainingPieces ?player z1))
+ (-- z1 z2) )
+
+(<= (next (turnOf black))
+ (does white (put ?x ?y))
+ (not (closingMill ?x ?y white)) )
+
+(<= (next (turnOf white))
+ (does black (put ?x ?y))
+ (not (closingMill ?x ?y black)) )
+
+(<= (next (turnOf ?player))
+ (does ?player (put ?x ?y))
+ (closingMill ?x ?y ?player) )
+
+(<= (next millClosed)
+ (does ?player (put ?x ?y))
+ (closingMill ?x ?y ?player) )
+
+(<= (next (spot ?u ?v ?w)) ;; Frame Axiom
+ (does ?player (put ?x ?y))
+ (true (spot ?u ?v ?w))
+ (distinctSpot ?x ?y ?u ?v) )
+
+(<= (next (remainders ?anyPlayer ?u)) ;; Frame Axiom
+ (does ?player (put ?x ?y))
+ (true (remainders ?anyPlayer ?u)) )
+
+
+ ;; Player moves from ab to xy
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(<= (next (spot ?a ?b blank))
+ (does ?player (move ?a ?b ?x ?y)) )
+
+(<= (next (spot ?x ?y ?player))
+ (does ?player (move ?a ?b ?x ?y)) )
+
+(<= (next (turnOf black))
+ (does white (move ?a ?b ?x ?y))
+ (not (closingMill ?a ?b ?x ?y white)) )
+
+(<= (next (turnOf white))
+ (does black (move ?a ?b ?x ?y))
+ (not (closingMill ?a ?b ?x ?y black)) )
+
+(<= (next (turnOf ?player))
+ (does ?player (move ?a ?b ?x ?y))
+ (closingMill ?a ?b ?x ?y ?player) )
+
+(<= (next millClosed)
+ (does ?player (move ?a ?b ?x ?y))
+ (closingMill ?a ?b ?x ?y ?player) )
+
+(<= (next (spot ?u ?v ?w)) ;; Frame Axiom
+ (does ?player (move ?a ?b ?x ?y))
+ (true (spot ?u ?v ?w))
+ (distinctSpot ?a ?b ?u ?v)
+ (distinctSpot ?x ?y ?u ?v) )
+
+(<= (next (remainders ?anyPlayer ?u)) ;; Frame Axiom
+ (does ?player (move ?a ?b ?x ?y))
+ (true (remainders ?anyPlayer ?u)) )
+
+
+ ;; Player removes a piece
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(<= (next (spot ?x ?y blank))
+ (does ?player (pick ?x ?y)) )
+
+(<= (next (spot ?u ?v ?w)) ;; Frame Axiom
+ (does ?player (pick ?x ?y))
+ (true (spot ?u ?v ?w))
+ (distinctSpot ?x ?y ?u ?v) )
+
+(<= (next (remainders black ?z1))
+ (does white (pick ?x ?y))
+ (true (remainders black ?z2))
+ (++ ?z1 ?z2) )
+
+(<= (next (remainders white ?z1))
+ (does black (pick ?x ?y))
+ (true (remainders white ?z2))
+ (++ ?z1 ?z2) )
+
+(<= (next (turnOf white))
+ (does black (pick ?x ?y)) )
+
+(<= (next (turnOf black))
+ (does white (pick ?x ?y)) )
+
+(<= (next (remainders ?player ?u)) ;; Frame Axiom
+ (does ?player (pick ?x ?y))
+ (true (remainders ?player ?u)) )
+
+
+ ;; counting plyes to determine end of Opening Phase
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(<= (next (ply ?z2))
+ (does ?player (pick ?x ?y))
+ (true (ply ?z1))
+ (++ ?z1 ?z2) )
+
+(<= (next (ply ?z2))
+ (does ?player (put ?x ?y))
+ (not (closingMill ?x ?y ?player))
+ (true (ply ?z1))
+ (++ ?z1 ?z2) )
+
+(<= (next (ply ?z))
+ (does ?player (put ?x ?y))
+ (closingMill ?x ?y ?player)
+ (true (ply ?z)) )
+
+(<= (next (phase opening))
+ (true (phase opening))
+ (not (true (ply 18))) )
+
+(<= (next (phase midgame))
+ (true (phase opening))
+ (true (ply 18)) )
+
+(<= (next (phase midgame))
+ (true (phase midgame)) )
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; LEGAL Relations
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+(<= (legal ?player (put ?x ?y))
+ (true (spot ?x ?y blank))
+ (true (turnOf ?player))
+ (true (phase opening))
+ (not (true millClosed)) )
+
+(<= (legal ?player (move ?a ?b ?x ?y))
+ (true (spot ?a ?b ?player))
+ (true (spot ?x ?y blank))
+ (true (turnOf ?player))
+ (true (phase midgame))
+ (or (adjacent ?a ?b ?x ?y)
+ (true (remainders ?player 3)))
+ (not (true millClosed)) )
+
+(<= (legal white (pick ?x ?y))
+ (true (spot ?x ?y black))
+ (or (not (closingMill ?x ?y black))
+ (allInMill black))
+ (true (turnOf white))
+ (true millClosed) )
+
+(<= (legal black (pick ?x ?y))
+ (true (spot ?x ?y white))
+ (or (not (closingMill ?x ?y white))
+ (allInMill white))
+ (true (turnOf black))
+ (true millClosed) )
+
+(<= (legal white noop)
+ (true (turnOf black)) )
+
+
+(<= (legal black noop)
+ (true (turnOf white)) )
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; TERMINAL Relations
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+(<= terminal
+ (true (remainders ?player 2)) )
+
+(<= terminal
+ (true (jailed ?player)) )
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; GOAL Relations
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+(<= (goal white 100)
+ (true (remainders black 2)) )
+
+(<= (goal black 100)
+ (true (remainders white 2)) )
+
+(<= (goal ?player 0)
+ (true (remainders ?player 2)) )
+
+(<= (goal white 100)
+ (jailed black) )
+
+(<= (goal black 100)
+ (jailed white) )
+
+(<= (goal ?player 0)
+ (jailed player) )
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; View Definitions
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+(<= (closingMill ?x ?y ?player)
+ (true (spot ?x ?y ?z)) ;; binding ?x and ?y
+ (true (spot ?x1 ?y ?player))
+ (true (spot ?x2 ?y ?player))
+ (distinct ?x ?x1)
+ (distinct ?x ?x2)
+ (distinct ?x1 ?x2) )
+
+(<= (closingMill ?x ?y ?player)
+ (true (spot ?x ?y ?z)) ;; binding ?x and ?y
+ (true (spot ?x ?y1 ?player))
+ (true (spot ?x ?y2 ?player))
+ (distinct ?y ?y1)
+ (distinct ?y ?y2)
+ (distinct ?y1 ?y2) )
+
+
+(<= (closingMill ?a ?b ?x ?y ?player)
+ (true (spot ?a ?b ?z1)) ;; binding ?a and ?b
+ (true (spot ?x ?y ?z2)) ;; binding ?x and ?y
+ (true (spot ?x1 ?y ?player))
+ (true (spot ?x2 ?y ?player))
+ (distinct ?x ?x1)
+ (distinct ?x ?x2)
+ (distinct ?x1 ?x2)
+ (distinctSpot ?a ?b ?x1 ?y)
+ (distinctSpot ?a ?b ?x2 ?y) )
+
+
+
+(<= (closingMill ?a ?b ?x ?y ?player)
+ (true (spot ?a ?b ?z1)) ;; binding ?a and ?b
+ (true (spot ?x ?y ?z2)) ;; binding ?x and ?y
+ (true (spot ?x ?y1 ?player))
+ (true (spot ?x ?y2 ?player))
+ (distinct ?y ?y1)
+ (distinct ?y ?y2)
+ (distinct ?y1 ?y2)
+ (distinctSpot ?a ?b ?x ?y1)
+ (distinctSpot ?a ?b ?x ?y2) )
+
+
+(<= (nonMillStone ?player)
+ (true (spot ?x ?y ?player))
+ (not (closingMill ?x ?y ?player)) )
+
+(<= (allInMill ?player)
+ (not (nonMillStone ?player)) )
+
+(<= (jailed ?player)
+ (not (free ?player)) ...
[truncated message content] |