toss-devel-svn Mailing List for Toss (Page 16)
Status: Beta
Brought to you by:
lukaszkaiser
You can subscribe to this list here.
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(25) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(26) |
Feb
(38) |
Mar
(67) |
Apr
(22) |
May
(41) |
Jun
(30) |
Jul
(24) |
Aug
(32) |
Sep
(29) |
Oct
(34) |
Nov
(18) |
Dec
(2) |
2012 |
Jan
(19) |
Feb
(25) |
Mar
(16) |
Apr
(2) |
May
(18) |
Jun
(21) |
Jul
(11) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <luk...@us...> - 2011-03-21 09:38:41
|
Revision: 1373 http://toss.svn.sourceforge.net/toss/?rev=1373&view=rev Author: lukstafi Date: 2011-03-21 09:38:35 +0000 (Mon, 21 Mar 2011) Log Message: ----------- Test fixes. Modified Paths: -------------- trunk/Toss/Arena/DiscreteRule.ml trunk/Toss/Play/Game.ml trunk/Toss/Play/GameTest.ml Modified: trunk/Toss/Arena/DiscreteRule.ml =================================================================== --- trunk/Toss/Arena/DiscreteRule.ml 2011-03-20 16:56:34 UTC (rev 1372) +++ trunk/Toss/Arena/DiscreteRule.ml 2011-03-21 09:38:35 UTC (rev 1373) @@ -176,7 +176,24 @@ (* Find all embeddings of a rule. Does not guarantee that rewriting will succeed for all of them. *) let find_matchings model rule_obj = - Solver.M.evaluate model rule_obj.lhs_form + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf "find_matchings: lhs_form=\n%s\n...%!" + (Formula.sprint rule_obj.lhs_form); + ); + if !debug_level > 4 then ( + Printf.printf "find_matchings: model=\n%s\n...%!" + (Structure.sprint model); + ); + (* }}} *) + let res = Solver.M.evaluate model rule_obj.lhs_form in + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf "find_matchings: result=%s\n%!" + (AssignmentSet.str res) + ); + (* }}} *) + res (* Convert assignment to an embedding of the LHS structure. *) let assignment_to_embedding rule_obj asgn = Modified: trunk/Toss/Play/Game.ml =================================================================== --- trunk/Toss/Play/Game.ml 2011-03-20 16:56:34 UTC (rev 1372) +++ trunk/Toss/Play/Game.ml 2011-03-21 09:38:35 UTC (rev 1373) @@ -1206,34 +1206,40 @@ let play = match effort with | None -> play | Some effort -> - {play with agents=Array.map - (function - | Tree_search (subgames, sth, params, agents) -> - Tree_search ( - subgames, sth, {params with iters=effort}, - agents) - | Maximax_evgame ( - subgames, cooperative, depth, use_pruning) -> - Maximax_evgame - (subgames, cooperative, effort, use_pruning) - | (Random_move | External _) as agent -> agent - ) play.agents} in + {play with agents=Array.map + (function + | Tree_search (subgames, sth, params, agents) -> + Tree_search ( + subgames, sth, {params with iters=effort}, + agents) + | Maximax_evgame ( + subgames, cooperative, depth, use_pruning) -> + Maximax_evgame + (subgames, cooperative, effort, use_pruning) + | (Random_move | External _) as agent -> agent + ) play.agents} in (* {{{ log entry *) if !debug_level > 2 then printf "\nsuggest:\n%!"; (* }}} *) (match - toss ~grid_size:Move.cGRID_SIZE play play_state - with - | Aux.Left (bpos, moves, memory, _) -> - (* [suggest] does not update the state, rule application - should do it *) - (* {{{ log entry *) - - if !debug_level > 1 then - printf "suggest: pos %d out of %d -- %s\n%!" bpos - (Array.length moves) - (Move.move_gs_str (play.game, play_state.game_state) moves.(bpos)); + toss ~grid_size:Move.cGRID_SIZE play play_state + with + | Aux.Left (bpos, moves, memory, _) -> + (* [suggest] does not update the state, rule application + should do it *) + (* {{{ log entry *) + if !debug_level > 1 then + printf "suggest: pos %d out of %d -- %s\n%!" bpos + (Array.length moves) + (Move.move_gs_str (play.game, play_state.game_state) moves.(bpos)); (* }}} *) - Some (moves.(bpos), {play_state with memory=memory}) - | Aux.Right payoffs -> None) + Some (moves.(bpos), {play_state with memory=memory}) + | Aux.Right payoffs -> + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf "Suggest: found payoffs = %a\n%!" + (Aux.array_fprint (fun ppf -> Printf.fprintf ppf "%F")) payoffs + ); + (* }}} *) + None) Modified: trunk/Toss/Play/GameTest.ml =================================================================== --- trunk/Toss/Play/GameTest.ml 2011-03-20 16:56:34 UTC (rev 1372) +++ trunk/Toss/Play/GameTest.ml 2011-03-21 09:38:35 UTC (rev 1373) @@ -335,11 +335,11 @@ "play: breakthrough suggest in GDL simplified game" >:: (fun () -> let horizon, advr, state = - get_loc_game breakthrough_simpl_game 1 in + get_loc_game breakthrough_simpl_game 0 in (* Game.set_debug_level 5; *) let move_opt = (let p,ps = Game.initialize_default state ~advr ?horizon - ~loc:1 ~effort:1 + ~loc:0 ~effort:1 ~search_method:"alpha_beta_ord" () in Game.suggest p ps) in assert_bool "Game is not over yet -- some move expected." @@ -352,19 +352,19 @@ let struc = Structure.del_rel struc "cellholds_x2_y2_black" (Array.map (Structure.find_elem struc) - [|"cellholds_2_7__blank_"|]) in + [|"cellholds_2_7_MV1"|]) in let struc = Structure.del_rel struc "cellholds_x2_y2_white" (Array.map (Structure.find_elem struc) - [|"cellholds_3_2__blank_"|]) in + [|"cellholds_3_2_MV1"|]) in let struc = Structure.del_rel struc "cellholds_x2_y2_white" (Array.map (Structure.find_elem struc) - [|"cellholds_4_1__blank_"|]) in + [|"cellholds_4_1_MV1"|]) in let struc = Structure.add_rel struc "cellholds_x2_y2_black" (Array.map (Structure.find_elem struc) - [|"cellholds_4_1__blank_"|]) in + [|"cellholds_4_1_MV1"|]) in struc in let horizon, advr, state = get_loc_game ~update_struc breakthrough_simpl_game 0 in @@ -379,7 +379,7 @@ "game not over: "^move_gs_str (snd state) moves.(bpos) | Aux.Right poffs -> Printf.sprintf "{W: %F; B: %F}" poffs.(0) poffs.(1)) - (Aux.Right [| -1.0; 1.0 |]) move_opt; + (Aux.Right [| 0.0; 100.0 |]) move_opt; let payoffs = Array.to_list (Array.mapi (fun i v->string_of_int i,v) (fst state).Arena.graph.((snd state).Arena.cur_loc).Arena.payoffs) @@ -390,7 +390,7 @@ let answ = String.concat ", " (List.sort compare (List.map ev payoffs)) in assert_equal ~msg:"black wins: direct" ~printer:(fun x->x) - "0: -1., 1: 1." answ; + "0: 0., 1: 100." answ; ); @@ -1038,13 +1038,14 @@ let a () = Heuristic.debug_level := 4; FFTNF.debug_level := 4; + (* DiscreteRule.debug_level := 5; *) Game.set_debug_level 10 let a () = Heuristic.use_monotonic := false -let a () = +let a = match test_filter - ["Game:0:misc:3:play: breakthrough suggest in GDL simplified game"] + ["Game:0:misc:4:breakthrough payoff GDL simplified game"] tests with | Some tests -> ignore (run_test_tt ~verbose:true tests) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-20 16:56:40
|
Revision: 1372 http://toss.svn.sourceforge.net/toss/?rev=1372&view=rev Author: lukaszkaiser Date: 2011-03-20 16:56:34 +0000 (Sun, 20 Mar 2011) Log Message: ----------- Correct looping in Heuristic. Modified Paths: -------------- trunk/Toss/GGP/Makefile trunk/Toss/Play/Heuristic.ml trunk/Toss/www/navigation.xml Modified: trunk/Toss/GGP/Makefile =================================================================== --- trunk/Toss/GGP/Makefile 2011-03-19 19:24:33 UTC (rev 1371) +++ trunk/Toss/GGP/Makefile 2011-03-20 16:56:34 UTC (rev 1372) @@ -16,12 +16,12 @@ GDLTestDebug: %.black: examples/%.gdl ../TossServer - OCAMLRUNPARAM=b; export OCAMLRUNPARAM; ../TossServer -vv & + OCAMLRUNPARAM=b; export OCAMLRUNPARAM; ../TossServer -d 2 & java -jar gamecontroller-cli.jar play $< 600 10 1 -random 1 -remote 2 toss localhost 8110 1 | grep results killall -v TossServer %.white: examples/%.gdl ../TossServer - OCAMLRUNPARAM=b; export OCAMLRUNPARAM; ../TossServer -vv & + OCAMLRUNPARAM=b; export OCAMLRUNPARAM; ../TossServer -d 2 & java -jar gamecontroller-cli.jar play $< 600 10 1 -random 2 -remote 1 toss localhost 8110 1 | grep results killall -v TossServer Modified: trunk/Toss/Play/Heuristic.ml =================================================================== --- trunk/Toss/Play/Heuristic.ml 2011-03-19 19:24:33 UTC (rev 1371) +++ trunk/Toss/Play/Heuristic.ml 2011-03-20 16:56:34 UTC (rev 1372) @@ -623,6 +623,7 @@ List.filter (fun (rel,_) -> not (Strings.mem rel frels)) rels in let rec aux all_vars = function | Rel _ | Eq _ | In _ as phi -> phi + | Not (Rel _) | Not (Eq _) | Not (In _) as phi -> phi | Not psi -> aux all_vars (FormulaOps.nnf ~neg:true psi) | Or phis -> Or (List.map (aux all_vars) phis) | And phis (* as phi when (has_rels frels phi) *) -> Modified: trunk/Toss/www/navigation.xml =================================================================== --- trunk/Toss/www/navigation.xml 2011-03-19 19:24:33 UTC (rev 1371) +++ trunk/Toss/www/navigation.xml 2011-03-20 16:56:34 UTC (rev 1372) @@ -4,7 +4,7 @@ <navigation> <menu lang="en"> <item href="/" id="Home">Home</item> - <item href="/ideas.html" id="ideas">GSoC Ideas</item> + <!-- <item href="/ideas.html" id="ideas">GSoC Ideas</item> --> <item href="http://tplay.org">Play Online</item> <item href="http://sourceforge.net/project/showfiles.php?group_id=115606" >Download Toss</item> @@ -27,7 +27,7 @@ <menu lang="de"> <item href="/" id="Home">Home</item> - <item href="/ideas.html" id="ideas">GSoC Ideen</item> + <!-- <item href="/ideas.html" id="ideas">GSoC Ideen</item> --> <item href="http://tplay.org">Online Spielen</item> <item href="http://sourceforge.net/project/showfiles.php?group_id=115606" >Toss Runterladen</item> @@ -50,7 +50,7 @@ <menu lang="pl"> <item href="/" id="Home">Strona Domowa</item> - <item href="/ideas.html" id="ideas">Pomysły na GSoC</item> + <!-- <item href="/ideas.html" id="ideas">Pomysły na GSoC</item> --> <item href="http://tplay.org">Graj Online</item> <item href="http://sourceforge.net/project/showfiles.php?group_id=115606" >Ściągnij Tossa</item> @@ -73,7 +73,7 @@ <menu lang="fr"> <item href="/" id="Home">Accueil</item> - <item href="/ideas.html" id="ideas">Idées GSoC</item> + <!-- <item href="/ideas.html" id="ideas">Idées GSoC</item> --> <item href="http://tplay.org">Jouez en Ligne</item> <item href="http://sourceforge.net/project/showfiles.php?group_id=115606" >Téléchargez Toss</item> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-19 19:24:41
|
Revision: 1371 http://toss.svn.sourceforge.net/toss/?rev=1371&view=rev Author: lukstafi Date: 2011-03-19 19:24:33 +0000 (Sat, 19 Mar 2011) Log Message: ----------- Minor test fix (unchecked). Modified Paths: -------------- trunk/Toss/Play/GameTest.ml Modified: trunk/Toss/Play/GameTest.ml =================================================================== --- trunk/Toss/Play/GameTest.ml 2011-03-19 08:53:02 UTC (rev 1370) +++ trunk/Toss/Play/GameTest.ml 2011-03-19 19:24:33 UTC (rev 1371) @@ -50,10 +50,16 @@ horizon, adv_ratio, (state_game, {state with Arena.struc = new_struc; cur_loc = new_loc}) -let get_loc_game +let get_loc_game ?update_struc (lazy (horizon, adv_ratio, (state_game, state))) new_loc = horizon, adv_ratio, - (state_game, {state with Arena.cur_loc = new_loc}) + match update_struc with + | None -> + (state_game, {state with Arena.cur_loc = new_loc}) + | Some upd -> + (state_game, {state with + Arena.struc = upd state.Arena.struc; + cur_loc = new_loc}) let rec binary_to_assoc = function @@ -342,8 +348,26 @@ "breakthrough payoff GDL simplified game" >:: (fun () -> + let update_struc struc = + let struc = + Structure.del_rel struc "cellholds_x2_y2_black" + (Array.map (Structure.find_elem struc) + [|"cellholds_2_7__blank_"|]) in + let struc = + Structure.del_rel struc "cellholds_x2_y2_white" + (Array.map (Structure.find_elem struc) + [|"cellholds_3_2__blank_"|]) in + let struc = + Structure.del_rel struc "cellholds_x2_y2_white" + (Array.map (Structure.find_elem struc) + [|"cellholds_4_1__blank_"|]) in + let struc = + Structure.add_rel struc "cellholds_x2_y2_black" + (Array.map (Structure.find_elem struc) + [|"cellholds_4_1__blank_"|]) in + struc in let horizon, advr, state = - get_loc_game breakthrough_simpl_game 0 in + get_loc_game ~update_struc breakthrough_simpl_game 0 in (* Game.set_debug_level 5; *) let move_opt = (let p,ps = Game.initialize_default state ~advr ?horizon This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-19 08:53:08
|
Revision: 1370 http://toss.svn.sourceforge.net/toss/?rev=1370&view=rev Author: lukstafi Date: 2011-03-19 08:53:02 +0000 (Sat, 19 Mar 2011) Log Message: ----------- Basic GameTest tests using GGP/tests/breakthrough-simpl.toss Modified Paths: -------------- trunk/Toss/Play/GameTest.ml trunk/Toss/Play/Heuristic.ml Modified: trunk/Toss/Play/GameTest.ml =================================================================== --- trunk/Toss/Play/GameTest.ml 2011-03-18 17:59:48 UTC (rev 1369) +++ trunk/Toss/Play/GameTest.ml 2011-03-19 08:53:02 UTC (rev 1370) @@ -50,7 +50,12 @@ horizon, adv_ratio, (state_game, {state with Arena.struc = new_struc; cur_loc = new_loc}) +let get_loc_game + (lazy (horizon, adv_ratio, (state_game, state))) new_loc = + horizon, adv_ratio, + (state_game, {state with Arena.cur_loc = new_loc}) + let rec binary_to_assoc = function | [k;v]::tl -> (k,v)::(binary_to_assoc tl) | [] -> [] @@ -117,6 +122,9 @@ let breakthrough_game = lazy (None, 2.0, state_of_file "./examples/Breakthrough.toss") +let breakthrough_simpl_game = + lazy (None, 2.0, state_of_file "./GGP/tests/breakthrough-simpl.toss") + let tictactoe_game = lazy (None, 4.0, state_of_file "./examples/Tic-Tac-Toe.toss") @@ -318,6 +326,50 @@ (matches <> []) ); + "play: breakthrough suggest in GDL simplified game" >:: + (fun () -> + let horizon, advr, state = + get_loc_game breakthrough_simpl_game 1 in + (* Game.set_debug_level 5; *) + let move_opt = (let p,ps = Game.initialize_default state + ~advr ?horizon + ~loc:1 ~effort:1 + ~search_method:"alpha_beta_ord" () in + Game.suggest p ps) in + assert_bool "Game is not over yet -- some move expected." + (move_opt <> None) + ); + + "breakthrough payoff GDL simplified game" >:: + (fun () -> + let horizon, advr, state = + get_loc_game breakthrough_simpl_game 0 in + (* Game.set_debug_level 5; *) + let move_opt = (let p,ps = Game.initialize_default state + ~advr ?horizon + ~loc:0 ~effort:1 + ~search_method:"alpha_beta_ord" () in + Game.toss ~grid_size:Move.cGRID_SIZE p ps) in + assert_equal ~msg:"black wins: suggest" ~printer:(function + | Aux.Left (bpos, moves, _, _) -> + "game not over: "^move_gs_str (snd state) moves.(bpos) + | Aux.Right poffs -> + Printf.sprintf "{W: %F; B: %F}" poffs.(0) poffs.(1)) + (Aux.Right [| -1.0; 1.0 |]) move_opt; + let payoffs = Array.to_list + (Array.mapi (fun i v->string_of_int i,v) + (fst state).Arena.graph.((snd state).Arena.cur_loc).Arena.payoffs) + in + let ev (p,e) = + p^": "^(string_of_float + (Solver.M.get_real_val e (snd state).Arena.struc)) in + let answ = + String.concat ", " (List.sort compare (List.map ev payoffs)) in + assert_equal ~msg:"black wins: direct" ~printer:(fun x->x) + "0: -1., 1: 1." answ; + + ); + "gomoku8x8 suggest" >:: (fun () -> let horizon, advr, state = @@ -960,13 +1012,15 @@ let a () = run_test_tt ~verbose:true experiments let a () = + Heuristic.debug_level := 4; + FFTNF.debug_level := 4; Game.set_debug_level 10 let a () = Heuristic.use_monotonic := false let a () = match test_filter - ["Game:1:alpha_beta_ord-effort 2 3 4:15:connect4 simple"] + ["Game:0:misc:3:play: breakthrough suggest in GDL simplified game"] tests with | Some tests -> ignore (run_test_tt ~verbose:true tests) Modified: trunk/Toss/Play/Heuristic.ml =================================================================== --- trunk/Toss/Play/Heuristic.ml 2011-03-18 17:59:48 UTC (rev 1369) +++ trunk/Toss/Play/Heuristic.ml 2011-03-19 08:53:02 UTC (rev 1370) @@ -638,17 +638,23 @@ if vars = [] then phi else begin (* {{{ log entry *) - if !debug_level > 3 then ( + if !debug_level > 2 then ( Printf.printf "Heuristic: computing expanded description for %s...\n%!" (Formula.sprint phi) ); (* }}} *) + let asgns = Solver.M.evaluate struc phi in let substs = - AssignmentSet.fo_assgn_to_list elems vars - (Solver.M.evaluate struc phi) in + AssignmentSet.fo_assgn_to_list elems vars asgns in (* sort substitutions; TODO: optimizable *) let substs = trunc_to_vars vars substs in + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf + "Heuristic: computed substitutions for expansion...\n%!" + ); + (* }}} *) let all_vars = add_strings (List.map var_str vars) all_vars in match expanded_descr max_alt_descr elems rels struc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-18 17:59:54
|
Revision: 1369 http://toss.svn.sourceforge.net/toss/?rev=1369&view=rev Author: lukaszkaiser Date: 2011-03-18 17:59:48 +0000 (Fri, 18 Mar 2011) Log Message: ----------- Adding recent paper. Modified Paths: -------------- trunk/Toss/www/Publications/all.bib Added Paths: ----------- trunk/Toss/www/pub/first_order_counting_ggp.pdf Modified: trunk/Toss/www/Publications/all.bib =================================================================== --- trunk/Toss/www/Publications/all.bib 2011-03-18 16:57:31 UTC (rev 1368) +++ trunk/Toss/www/Publications/all.bib 2011-03-18 17:59:48 UTC (rev 1369) @@ -97,7 +97,31 @@ # ARTICLES +@inproceedings{KS11, + author = {\L{}ukasz Kaiser and \L{}ukasz Stafiniak}, + title = {First-Order Logic with Counting for General Game Playing}, + year = {2011}, + booktitle = {review}, + url = {/pub/first_order_counting_ggp.pdf}, + abstract = { +General Game Players (GGPs) are programs which can play an arbitrary game +given only its rules. Game Description Language (GDL) is a variant of +Datalog used in GGP competitions to specify the games. +GDL inherits from Datalog the use of Horn clauses as rules and recursion, +but it too requires stratification and does not allow to use quantifiers. +We present an alternative formalism for game description which is based +on first-order logic (FO). States of the game are represented by relational +structures, legal moves by structure rewriting rules guarded by FO formulas, +and the goals of the players by formulas which extend FO with counting. +The advantage of our formalism comes from more explicit state representation +and from the use of quantifiers in formulas. We show how to exploit existential +quantification in players' goals to generate heuristics for evaluating +positions in the game. The derived heuristics are good enough for +a basic alpha-beta agent to win against state of the art GGP. + } +} + @InProceedings{GK10, author = {Tobias Ganzow and {\L}ukasz Kaiser}, title = {New Algorithm for Weak Monadic Second-Order Logic on @@ -112,7 +136,7 @@ publisher = {Springer}, pages = {366--380}, url = - {http://www.liafa.jussieu.fr/~kaiser/pub/weak_mso_composition.pdf}, + {/pub/weak_mso_composition.pdf}, abstract = { Weak monadic second-order logic is a very expressive logic which has been used successfully for verification of software and hardware systems. @@ -146,7 +170,7 @@ booktitle = {Proceedings of AGI~'10}, publisher = {Atlantis Press}, year = {2010}, - url = {http://www.liafa.jussieu.fr/~kaiser/pub/playing_structure_rewriting_games.pdf}, + url = {/pub/playing_structure_rewriting_games.pdf}, abstract = { Achieving goals in a complex environment in which many players interact is a general task demanded from an AI agent. When goals of @@ -172,7 +196,7 @@ volume = {5734}, year = {2009}, pages = {415--427}, - url = {http://www.liafa.jussieu.fr/~kaiser/pub/graph_games_short.pdf}, + url = {/pub/graph_games_short.pdf}, abstract = { The description of a single state of a modelled system is often complex in practice, but few procedures for synthesis address this problem in depth. Added: trunk/Toss/www/pub/first_order_counting_ggp.pdf =================================================================== (Binary files differ) Property changes on: trunk/Toss/www/pub/first_order_counting_ggp.pdf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-18 16:57:39
|
Revision: 1368 http://toss.svn.sourceforge.net/toss/?rev=1368&view=rev Author: lukstafi Date: 2011-03-18 16:57:31 +0000 (Fri, 18 Mar 2011) Log Message: ----------- GameSimpl: stage 3: glueing conjoined relations completed; eliminating redundant equivalence relations. Modified Paths: -------------- trunk/Toss/Formula/Aux.ml trunk/Toss/Formula/Aux.mli trunk/Toss/GGP/GDL.ml trunk/Toss/GGP/GDL.mli trunk/Toss/GGP/GDLTest.ml trunk/Toss/GGP/GameSimpl.ml trunk/Toss/GGP/GameSimplTest.ml trunk/Toss/GGP/tests/breakthrough-raw.toss trunk/Toss/GGP/tests/breakthrough-simpl.toss trunk/Toss/GGP/tests/connect5-raw.toss trunk/Toss/GGP/tests/connect5-simpl.toss Modified: trunk/Toss/Formula/Aux.ml =================================================================== --- trunk/Toss/Formula/Aux.ml 2011-03-18 00:19:55 UTC (rev 1367) +++ trunk/Toss/Formula/Aux.ml 2011-03-18 16:57:31 UTC (rev 1368) @@ -54,6 +54,7 @@ module BasicOperators = struct let (-|) f g x = f (g x) + let (<|) f x = f x end open BasicOperators @@ -220,6 +221,14 @@ | _::tl -> aux (n+1) tl in aux 0 l +let pop_find p l = + let rec aux acc = function + | hd::tl when p hd -> hd, List.rev_append acc tl + | hd::tl (* when not p hd *) -> aux (hd::acc) tl + | [] -> raise Not_found in + aux [] l + + let maximal cmp l = let rec aux acc = function | hd::tl when Modified: trunk/Toss/Formula/Aux.mli =================================================================== --- trunk/Toss/Formula/Aux.mli 2011-03-18 00:19:55 UTC (rev 1367) +++ trunk/Toss/Formula/Aux.mli 2011-03-18 16:57:31 UTC (rev 1368) @@ -25,6 +25,8 @@ sig (** Function composition. *) val ( -| ) : ('a -> 'b) -> ('c -> 'a) -> 'c -> 'b + (** Function application (to avoid parentheses). *) + val ( <| ) : ('a -> 'b) -> 'a -> 'b end val int_pow : int -> int -> int @@ -141,6 +143,9 @@ counting from zero. *) val find_index : 'a -> 'a list -> int +(** Find an element satisfying the predicate and separate it from the list. *) +val pop_find : ('a -> bool) -> 'a list -> 'a * 'a list + (** Return the list of maximal elements, under the given less-or-equal comparison (the input does not need to be sorted). (Currently, of equal elements only the last one is preserved.) *) Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-03-18 00:19:55 UTC (rev 1367) +++ trunk/Toss/GGP/GDL.ml 2011-03-18 16:57:31 UTC (rev 1368) @@ -537,10 +537,12 @@ (** Expand static relations that do not have ground facts and have arity above the threshold. *) let expand_arity_above = ref 0 + (** Generate all tuples for equivalences, to faciliate further transformations of formulas in the game definition (outside of translation). *) -let equivalences_all_tuples = ref (* false *) true +type pair_matrix = Pairs_all | Pairs_triang | Pairs_star +let equivalences_all_tuples = ref Pairs_triang open Aux.BasicOperators @@ -1609,14 +1611,14 @@ (term_str a) (term_str b); assert false -(* + let triang_matrix elems = let rec aux acc = function | [] -> acc | hd::tl -> aux (List.map (fun e->[|hd; e|]) tl @ acc) tl in aux [] elems -*) + let term_to_blank masks next_arg = let mask_cands = Aux.map_try (fun mask -> @@ -1769,17 +1771,20 @@ (List.map (fun t -> snd (toss_var masks t)) terms) in constrained_vars := vars @ !constrained_vars; let tups = - if !equivalences_all_tuples - then - (* generating more relations to faciliate "contraction" of - co-occurring relations in GameSimpl, which will also clean - the redundant atoms *) - Aux.concat_map (fun v -> Aux.map_some (fun w -> - if v=w then None else Some [|v; w|]) vars) vars - else - (* (4b) are equivalences, so we just build a "star" *) - match vars with [] -> [] - | v::vs -> List.map (fun w -> [|v; w|]) vs in + match !equivalences_all_tuples with + | Pairs_all -> + Aux.concat_map (fun v -> Aux.map_some (fun w -> + if v=w then None else Some [|v; w|]) vars) vars + | Pairs_triang -> + (* generating more relations to faciliate "contraction" of + co-occurring relations in GameSimpl -- since it + GameSimpl handles inversion, no need for bidirectional + links *) + triang_matrix vars + | Pairs_star -> + (* (4b) are equivalences, so we just build a "star" *) + match vars with [] -> [] + | v::vs -> List.map (fun w -> [|v; w|]) vs in List.map (fun tup -> Formula.Rel (rname, tup)) tups ) terms ) pos_path_subterms) in @@ -1800,16 +1805,16 @@ (List.map (fun t -> snd (toss_var masks t)) terms) in (* these don't get constrained since they'll occur negatively *) let tups = - if !equivalences_all_tuples - then - Aux.concat_map - (fun v -> - if v = ntossvar then [] - else [[|v; ntossvar|]; [|ntossvar; v|]]) tossvars - else - Aux.map_some (fun v -> - if v = ntossvar then None - else Some [|v; ntossvar|]) tossvars in + match !equivalences_all_tuples with + | Pairs_all -> + Aux.concat_map + (fun v -> + if v = ntossvar then [] + else [[|v; ntossvar|]; [|ntossvar; v|]]) tossvars + | Pairs_triang | Pairs_star -> + Aux.map_some (fun v -> + if v = ntossvar then None + else Some [|v; ntossvar|]) tossvars in List.map (fun tup -> Formula.Rel (rname, tup)) tups | _ -> [] ) pos_path_subterms in @@ -2128,14 +2133,15 @@ (List.map (fun t -> snd (toss_var masks t)) terms) in constrained_vars := vars @ !constrained_vars; let tups = - if !equivalences_all_tuples - then - Aux.concat_map (fun v -> Aux.map_some (fun w -> - if v=w then None else Some [|v; w|]) vars) vars - else - match vars with [] -> [] - | v::vs -> Aux.map_some (fun w -> - if v=w then None else Some [|v; w|]) vs in + match !equivalences_all_tuples with + | Pairs_all -> + Aux.concat_map (fun v -> Aux.map_some (fun w -> + if v=w then None else Some [|v; w|]) vars) vars + | Pairs_triang -> + triang_matrix vars + | Pairs_star -> + match vars with [] -> [] + | v::vs -> List.map (fun w -> [|v; w|]) vs in List.map (fun tup -> Formula.Rel (rname, tup)) tups ) terms ) neg_path_subterms in @@ -3431,7 +3437,7 @@ } in (* {{{ log entry *) (* * - let file = open_out "./GGP/tests/connect5-raw.toss" in + let file = open_out "./GGP/tests/breakthrough-raw.toss" in output_string file (Arena.state_str result); close_out file; * *) @@ -3451,7 +3457,7 @@ ) loc_noop_legal in (* {{{ log entry *) (* * - let file = open_out "./GGP/tests/connect5-simpl.toss" in + let file = open_out "./GGP/tests/breakthrough-simpl.toss" in output_string file (Arena.state_str result); close_out file; * *) Modified: trunk/Toss/GGP/GDL.mli =================================================================== --- trunk/Toss/GGP/GDL.mli 2011-03-18 00:19:55 UTC (rev 1367) +++ trunk/Toss/GGP/GDL.mli 2011-03-18 16:57:31 UTC (rev 1368) @@ -6,6 +6,9 @@ val aggregate_drop_negative : bool ref val aggregate_fixpoint : bool ref +type pair_matrix = Pairs_all | Pairs_triang | Pairs_star +val equivalences_all_tuples : pair_matrix ref + val manual_translation : bool ref val manual_game : string ref val top_exec_path : string ref Modified: trunk/Toss/GGP/GDLTest.ml =================================================================== --- trunk/Toss/GGP/GDLTest.ml 2011-03-18 00:19:55 UTC (rev 1367) +++ trunk/Toss/GGP/GDLTest.ml 2011-03-18 16:57:31 UTC (rev 1368) @@ -146,5 +146,5 @@ let breakthrough = load_rules "./GGP/examples/breakthrough.gdl" in let connect5 = load_rules "./GGP/examples/connect5.gdl" in let tictactoe = load_rules "./GGP/examples/tictactoe.gdl" in - let gdl_def, toss_def = GDL.translate_game (Const "x") connect5 in + let gdl_def, toss_def = GDL.translate_game (Const "white") breakthrough in ignore gdl_def; ignore connect5; ignore breakthrough; ignore tictactoe Modified: trunk/Toss/GGP/GameSimpl.ml =================================================================== --- trunk/Toss/GGP/GameSimpl.ml 2011-03-18 00:19:55 UTC (rev 1367) +++ trunk/Toss/GGP/GameSimpl.ml 2011-03-18 16:57:31 UTC (rev 1368) @@ -7,6 +7,9 @@ rules is specified by transformations described below. Rules can be refined or new simplification rules added to each stage. + Assuming that relations beginning with EQ__ are equivalences, + eliminate redundant occurrences. + TODO: use [DiscreteRule.special_rel_of rel = Some "opt"] instead of [DiscreteRule.special_rel_of rel <> None]? (To protect against GDL using identifiers starting with underscore.) @@ -48,7 +51,8 @@ (3) Add intersections of non-fluent relations to the structure when they co-occur in formulas. For binary relations, also add - intersections of a relation and an inverse of another. + intersections of a relation and an inverse of another. Filter out + unnecessary equivalence relations. (3a) Eliminate conjoined static (non-fluents and not defined) relations in formulas that are applied to the same arguments and @@ -60,16 +64,23 @@ one, and introduce a new relation for intersection of one with the inverse of the other. - (3c) Repeat till no more atoms can be glued in this way. + (3c) Filter out relations beginning with "EQ__" by: (3c1) + collecting equivalent elements in families of sets indexed by EQ + relations; (3c2) keeping an EQ relation, outside of glueing group, + only if its arguments are not yet in the same partition wrt. the + relation. Do it after glueing not to preclude intersections, take + into account the glueing reductions. - (3d) Since too long names would be unreadable anyway, introduce + (3d) Repeat till no more atoms can be glued in this way. + + (3e) Since too long names would be unreadable anyway, introduce fresh relation names for the glued relations and remember the correspondence in game data. - (3e) The eliminated co-occurrences are relevant only for tuples + (3f) The eliminated co-occurrences are relevant only for tuples present in rewrite rules (LHS structures), not for absent ones (since these are conjoined negations). Replace them in the LHS - structures as in (3a)-(3b), but only if all of replaced relations + structures as in (3a)-(3c), but only if all of replaced relations occur as non-embedded (i.e. "tau_h") (since embedded relations will have reuired-to-be-absent occurrences, and these cannot be handled by conjoining). @@ -437,7 +448,7 @@ (Tups.inter graph1 inv_graph) in Structure.add_rels struc grel tuples in - (* preparing (3a-b-c) *) + (* preparing (3a-d) *) let add_rel rel acc = match rel with | Rel (rel,_) -> Aux.Strings.add rel acc @@ -451,6 +462,8 @@ let signat = ref signat in let glued = ref [] in (* bindings introduced by [glue] *) let glued_inv = ref [] in (* bingings introduced by [glue_inv] *) + let is_equiv rel = + String.length rel >= 4 && String.sub rel 0 4 = "EQ__" in (* 3a *) let glue rels = let args_keys = @@ -500,9 +513,55 @@ else (rel1, args1)::loop more | (args, rel)::rels -> (rel, args)::loop rels | [] -> [] in - loop rels - in - (* the step of 3c *) + loop rels in + (* 3c *) + let glue_equiv rels = + (* only partition, process later, add the original grels to + filtered rels *) + let grels, rels = List.partition (fun (rel,_) -> + List.mem_assoc rel !glued || List.mem_assoc rel !glued_inv) rels in + let eq_sets = Aux.concat_map (fun (rel, args) -> + if List.mem_assoc rel !glued + then List.map (fun r->r,args) (List.assoc rel !glued) + else if List.mem_assoc rel !glued_inv + then + let rel1, rel2 = List.assoc rel !glued_inv in + [rel1, args; rel2, args] + else assert false) grels in + (* 3c1 *) + let eq_sets = + Aux.collect (List.filter (is_equiv -| fst) eq_sets) in + let build_sets tups = + List.fold_left (fun sets args -> + let args = Array.to_list args in + (let try set, sets = + Aux.pop_find (fun set -> + List.exists (fun a->List.mem a set) args) sets in + Aux.unique_sorted (args @ set) :: sets + with Not_found -> args::sets) + ) [] tups in + let eq_sets = + List.map (fun (rel, tups) -> rel, build_sets tups) eq_sets in + (* 3c2 *) + let _, rels = List.fold_left (fun (eq_sets, rels as old) + (rel, args as atom) -> + let sets, eq_sets = + try Aux.pop_assoc rel eq_sets + with Not_found -> [], eq_sets in + let argset = Array.to_list args in + (let try set, sets = + Aux.pop_find (fun set -> + List.exists (fun a->List.mem a set) argset) sets in + if List.for_all (fun a->List.mem a set) argset + then old + else + (rel, Aux.unique_sorted (argset @ set) :: sets)::eq_sets, + atom::rels + with Not_found -> (rel, argset::sets)::eq_sets, atom::rels) + ) (eq_sets, []) rels in + grels @ rels in + + (* the step of 3d *) let gluable rel = not (List.mem rel fluents) && not (List.mem_assoc rel game.Arena.defined_rels) in @@ -515,7 +574,8 @@ | phi -> Aux.Right phi) conjs in let result = List.map (fun (rel, args) -> Rel (rel, args)) - (glue_inv (glue poslits)) in + (*glue_equiv <| glue_inv <| glue <| poslits why wrong?*) + (glue_equiv (glue_inv (glue poslits))) in And (result @ subtasks)); map_Or = (fun disjs -> let neglits, subtasks = Aux.partition_map (function @@ -525,7 +585,7 @@ List.map (fun (rel, args) -> Not (Rel (rel, args))) (glue_inv (glue neglits)) in Or (result @ subtasks))} in - (* 3c *) + (* 3d *) let rec glue_fixpoint phi = let old_used_rels = !used_rels in let res = glue_phi (FormulaOps.flatten_formula phi) in @@ -533,7 +593,7 @@ else glue_fixpoint res in let game = Arena.map_to_formulas glue_fixpoint game in - (* 3d *) + (* 3e *) let more_data = Aux.map_some (fun (crel, orig_rel) -> if Aux.Strings.mem crel !used_rels then @@ -554,7 +614,7 @@ let state = {state with Arena.struc = !struc} in let signat = !signat in - (* 3e-3a *) + (* 3f-3a *) (* rather than keeping the unaffected relations/tuples, we only return the replaced ones *) let glue_lhs rels = @@ -569,7 +629,7 @@ Printf.printf "rels=%s\n%!" (String.concat ", " rels); assert false) ) args_keys in - (* 3e-3b *) + (* 3f-3b *) let glue_inv_lhs rels = let rels = List.map (fun (rel,args) -> args,rel) rels in let rec loop = function @@ -590,9 +650,53 @@ else loop more | _::rels -> loop rels | [] -> [] in - loop rels - in - (* 3e *) + loop rels in + + (* 3f-3c *) + let glue_equiv_lhs rels = + let grels, rels = List.partition (fun (rel,_) -> + List.mem_assoc rel !glued || List.mem_assoc rel !glued_inv) rels in + let eq_sets = Aux.concat_map (fun (rel, args) -> + if List.mem_assoc rel !glued + then List.map (fun r->r,args) (List.assoc rel !glued) + else if List.mem_assoc rel !glued_inv + then + let rel1, rel2 = List.assoc rel !glued_inv in + [rel1, args; rel2, args] + else assert false) grels in + (* 3c1 *) + let eq_sets = + Aux.collect (List.filter (is_equiv -| fst) eq_sets) in + let build_sets tups = + List.fold_left (fun sets args -> + let args = Array.to_list args in + (let try set, sets = + Aux.pop_find (fun set -> + List.exists (fun a->List.mem a set) args) sets in + Aux.unique_sorted (args @ set) :: sets + with Not_found -> args::sets) + ) [] tups in + let eq_sets = + List.map (fun (rel, tups) -> rel, build_sets tups) eq_sets in + (* 3c2 *) + let _, drels = List.fold_left (fun (eq_sets, drels) + (rel, args as atom) -> + let sets, eq_sets = + try Aux.pop_assoc rel eq_sets + with Not_found -> [], eq_sets in + let argset = Array.to_list args in + (let try set, sets = + Aux.pop_find (fun set -> + List.exists (fun a->List.mem a set) argset) sets in + if List.for_all (fun a->List.mem a set) argset + then (rel, set::sets)::eq_sets, atom::drels + else (rel, Aux.unique_sorted (argset @ set) :: sets) + :: eq_sets, drels + with Not_found -> (rel, argset::sets)::eq_sets, drels) + ) (eq_sets, []) rels in + drels in + + (* 3f *) let glue_struc lhs emb_rels = let cands = Structure.StringMap.fold (fun rel tups cands -> @@ -613,13 +717,18 @@ lhs, cands ) (lhs, cands) result in let result = glue_inv_lhs cands in - List.fold_left - (fun lhs (grel, (rel1, rel2), args, inv_args) -> + let lhs, cands = List.fold_left + (fun (lhs, cands) (grel, (rel1, rel2), args, inv_args) -> let lhs = Structure.add_rel lhs grel args in let lhs = Structure.del_rel lhs rel1 args in let lhs = Structure.del_rel lhs rel2 inv_args in - lhs - ) lhs result in + let cands = (grel, args):: + List.filter (fun (rel,_) -> rel<>rel1 && rel<>rel2) cands in + lhs, cands + ) (lhs, cands) result in + let result = glue_equiv_lhs cands in + List.fold_left (fun lhs (drel, args) -> + Structure.del_rel lhs drel args) lhs result in let game = Arena.map_to_discrete (fun r -> {r with DiscreteRule.lhs_struc = glue_struc r.DiscreteRule.lhs_struc r.DiscreteRule.emb_rels}) Modified: trunk/Toss/GGP/GameSimplTest.ml =================================================================== --- trunk/Toss/GGP/GameSimplTest.ml 2011-03-18 00:19:55 UTC (rev 1367) +++ trunk/Toss/GGP/GameSimplTest.ml 2011-03-18 16:57:31 UTC (rev 1368) @@ -48,7 +48,7 @@ ] -let a = +let a = Aux.run_test_if_target "GameSimplTest" tests let a () = Modified: trunk/Toss/GGP/tests/breakthrough-raw.toss =================================================================== --- trunk/Toss/GGP/tests/breakthrough-raw.toss 2011-03-18 00:19:55 UTC (rev 1367) +++ trunk/Toss/GGP/tests/breakthrough-raw.toss 2011-03-18 16:57:31 UTC (rev 1368) @@ -1,5 +1,4 @@ PLAYERS white, black -DATA RULE move_x1_y1_x2_y2_0: [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | _opt_cellholds_x2_y2_black { @@ -92,10 +91,8 @@ cellholds_x2_y2_white(cellholds_x377_y369__blank_))) RULE move_x_y1_x_y2_0: [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | - EQ___cellholds_x2_y2_MV1_x2 { + EQ___cellholds_x2_y2_MV1_x2 (cellholds_x_y1__blank_, cellholds_x_y2__blank_); - (cellholds_x_y2__blank_, cellholds_x_y1__blank_) - }; _opt_cellholds_x2_y2_black {cellholds_x_y1__blank_; control__blank_}; _opt_cellholds_x2_y2_white (control__blank_); _opt_control_black {cellholds_x_y1__blank_; cellholds_x_y2__blank_}; @@ -228,10 +225,8 @@ cellholds_x2_y2_white(cellholds_x377_y369__blank_))) RULE move_x_y1_x_y2_1: [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | - EQ___cellholds_x2_y2_MV1_x2 { + EQ___cellholds_x2_y2_MV1_x2 (cellholds_x_y1__blank_, cellholds_x_y2__blank_); - (cellholds_x_y2__blank_, cellholds_x_y1__blank_) - }; _opt_cellholds_x2_y2_black (control__blank_); _opt_cellholds_x2_y2_white {cellholds_x_y1__blank_; control__blank_}; _opt_control_black {cellholds_x_y1__blank_; cellholds_x_y2__blank_}; Modified: trunk/Toss/GGP/tests/breakthrough-simpl.toss =================================================================== --- trunk/Toss/GGP/tests/breakthrough-simpl.toss 2011-03-18 00:19:55 UTC (rev 1367) +++ trunk/Toss/GGP/tests/breakthrough-simpl.toss 2011-03-18 16:57:31 UTC (rev 1368) @@ -4,7 +4,8 @@ EQ___cellholds_x2_y2_MV1_x2__AND__succ__cellholds_x2_y2_MV1_y2__cellholds_x2_y2_MV1_y2, R0: succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_x2__AND__succ__cellholds_x2_y2_MV1_y2__cellholds_x2_y2_MV1_y2, - R2: EQ___cellholds_x2_y2_MV1_x2__AND_INV__R1, + R2: + EQ___cellholds_x2_y2_MV1_x2__AND_INV__succ__cellholds_x2_y2_MV1_y2__cellholds_x2_y2_MV1_y2, R: succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_x2__AND_INV__succ__cellholds_x2_y2_MV1_y2__cellholds_x2_y2_MV1_y2 RULE move_x1_y1_x2_y2_0: @@ -79,19 +80,21 @@ ex cellholds_x377_y369__blank_ (cellholds_x2_y2_white(cellholds_x377_y369__blank_) and not control_MV1(cellholds_x377_y369__blank_))) -RULE move_x_y1_x_y2_0: - [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | - _opt_cellholds_x2_y2_black {cellholds_x_y1__blank_; control__blank_}; - _opt_cellholds_x2_y2_white (control__blank_); - _opt_control_black {cellholds_x_y1__blank_; cellholds_x_y2__blank_}; - _opt_control_white {cellholds_x_y1__blank_; cellholds_x_y2__blank_}; - cellholds_x2_y2_white (cellholds_x_y1__blank_); - control_white (control__blank_) +RULE move_x1_y1_x2_y2_1: + [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | + R0 (cellholds_x2_y2__blank_, cellholds_x1_y1__blank_); + _opt_cellholds_x2_y2_black (control__blank_); + _opt_cellholds_x2_y2_white { + cellholds_x1_y1__blank_; cellholds_x2_y2__blank_; control__blank_}; + _opt_control_black {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; + _opt_control_white {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; + cellholds_x2_y2_black (cellholds_x1_y1__blank_); + control_black (control__blank_) | ] -> - [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | - cellholds_x2_y2_white (cellholds_x_y2__blank_); - control_black (control__blank_) + [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | + cellholds_x2_y2_black (cellholds_x2_y2__blank_); + control_white (control__blank_) | ] emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, @@ -113,9 +116,9 @@ ex cellholds_x377_y369__blank_ (cellholds_x2_y2_white(cellholds_x377_y369__blank_) and not control_MV1(cellholds_x377_y369__blank_))) -RULE move_x1_y1_x2_y2_1: +RULE move_x1_y1_x2_y2_10: [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | - R0 (cellholds_x2_y2__blank_, cellholds_x1_y1__blank_); + R (cellholds_x1_y1__blank_, cellholds_x2_y2__blank_); _opt_cellholds_x2_y2_black (control__blank_); _opt_cellholds_x2_y2_white { cellholds_x1_y1__blank_; cellholds_x2_y2__blank_; control__blank_}; @@ -149,21 +152,20 @@ ex cellholds_x377_y369__blank_ (cellholds_x2_y2_white(cellholds_x377_y369__blank_) and not control_MV1(cellholds_x377_y369__blank_))) -RULE move_x1_y1_x2_y2_10: - [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | - R (cellholds_x1_y1__blank_, cellholds_x2_y2__blank_); - _opt_cellholds_x2_y2_black (control__blank_); - _opt_cellholds_x2_y2_white { - cellholds_x1_y1__blank_; cellholds_x2_y2__blank_; control__blank_}; - _opt_control_black {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; - _opt_control_white {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; - cellholds_x2_y2_black (cellholds_x1_y1__blank_); - control_black (control__blank_) +RULE move_x_y1_x_y2_0: + [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | + R1 (cellholds_x_y1__blank_, cellholds_x_y2__blank_); + _opt_cellholds_x2_y2_black {cellholds_x_y1__blank_; control__blank_}; + _opt_cellholds_x2_y2_white (control__blank_); + _opt_control_black {cellholds_x_y1__blank_; cellholds_x_y2__blank_}; + _opt_control_white {cellholds_x_y1__blank_; cellholds_x_y2__blank_}; + cellholds_x2_y2_white (cellholds_x_y1__blank_); + control_white (control__blank_) | ] -> - [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | - cellholds_x2_y2_black (cellholds_x2_y2__blank_); - control_white (control__blank_) + [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | + cellholds_x2_y2_white (cellholds_x_y2__blank_); + control_black (control__blank_) | ] emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, @@ -187,6 +189,7 @@ not control_MV1(cellholds_x377_y369__blank_))) RULE move_x_y1_x_y2_1: [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | + R2 (cellholds_x_y1__blank_, cellholds_x_y2__blank_); _opt_cellholds_x2_y2_black (control__blank_); _opt_cellholds_x2_y2_white {cellholds_x_y1__blank_; control__blank_}; _opt_control_black {cellholds_x_y1__blank_; cellholds_x_y2__blank_}; @@ -406,7 +409,7 @@ (cellholds_1_2_MV1, cellholds_2_3_MV1); (cellholds_1_1_MV1, cellholds_2_2_MV1) }; - R2 { + R1 { (cellholds_8_7_MV1, cellholds_8_8_MV1); (cellholds_8_6_MV1, cellholds_8_7_MV1); (cellholds_8_5_MV1, cellholds_8_6_MV1); @@ -464,6 +467,64 @@ (cellholds_1_2_MV1, cellholds_1_3_MV1); (cellholds_1_1_MV1, cellholds_1_2_MV1) }; + R2 { + (cellholds_8_8_MV1, cellholds_8_7_MV1); + (cellholds_8_7_MV1, cellholds_8_6_MV1); + (cellholds_8_6_MV1, cellholds_8_5_MV1); + (cellholds_8_5_MV1, cellholds_8_4_MV1); + (cellholds_8_4_MV1, cellholds_8_3_MV1); + (cellholds_8_3_MV1, cellholds_8_2_MV1); + (cellholds_8_2_MV1, cellholds_8_1_MV1); + (cellholds_7_8_MV1, cellholds_7_7_MV1); + (cellholds_7_7_MV1, cellholds_7_6_MV1); + (cellholds_7_6_MV1, cellholds_7_5_MV1); + (cellholds_7_5_MV1, cellholds_7_4_MV1); + (cellholds_7_4_MV1, cellholds_7_3_MV1); + (cellholds_7_3_MV1, cellholds_7_2_MV1); + (cellholds_7_2_MV1, cellholds_7_1_MV1); + (cellholds_6_8_MV1, cellholds_6_7_MV1); + (cellholds_6_7_MV1, cellholds_6_6_MV1); + (cellholds_6_6_MV1, cellholds_6_5_MV1); + (cellholds_6_5_MV1, cellholds_6_4_MV1); + (cellholds_6_4_MV1, cellholds_6_3_MV1); + (cellholds_6_3_MV1, cellholds_6_2_MV1); + (cellholds_6_2_MV1, cellholds_6_1_MV1); + (cellholds_5_8_MV1, cellholds_5_7_MV1); + (cellholds_5_7_MV1, cellholds_5_6_MV1); + (cellholds_5_6_MV1, cellholds_5_5_MV1); + (cellholds_5_5_MV1, cellholds_5_4_MV1); + (cellholds_5_4_MV1, cellholds_5_3_MV1); + (cellholds_5_3_MV1, cellholds_5_2_MV1); + (cellholds_5_2_MV1, cellholds_5_1_MV1); + (cellholds_4_8_MV1, cellholds_4_7_MV1); + (cellholds_4_7_MV1, cellholds_4_6_MV1); + (cellholds_4_6_MV1, cellholds_4_5_MV1); + (cellholds_4_5_MV1, cellholds_4_4_MV1); + (cellholds_4_4_MV1, cellholds_4_3_MV1); + (cellholds_4_3_MV1, cellholds_4_2_MV1); + (cellholds_4_2_MV1, cellholds_4_1_MV1); + (cellholds_3_8_MV1, cellholds_3_7_MV1); + (cellholds_3_7_MV1, cellholds_3_6_MV1); + (cellholds_3_6_MV1, cellholds_3_5_MV1); + (cellholds_3_5_MV1, cellholds_3_4_MV1); + (cellholds_3_4_MV1, cellholds_3_3_MV1); + (cellholds_3_3_MV1, cellholds_3_2_MV1); + (cellholds_3_2_MV1, cellholds_3_1_MV1); + (cellholds_2_8_MV1, cellholds_2_7_MV1); + (cellholds_2_7_MV1, cellholds_2_6_MV1); + (cellholds_2_6_MV1, cellholds_2_5_MV1); + (cellholds_2_5_MV1, cellholds_2_4_MV1); + (cellholds_2_4_MV1, cellholds_2_3_MV1); + (cellholds_2_3_MV1, cellholds_2_2_MV1); + (cellholds_2_2_MV1, cellholds_2_1_MV1); + (cellholds_1_8_MV1, cellholds_1_7_MV1); + (cellholds_1_7_MV1, cellholds_1_6_MV1); + (cellholds_1_6_MV1, cellholds_1_5_MV1); + (cellholds_1_5_MV1, cellholds_1_4_MV1); + (cellholds_1_4_MV1, cellholds_1_3_MV1); + (cellholds_1_3_MV1, cellholds_1_2_MV1); + (cellholds_1_2_MV1, cellholds_1_1_MV1) + }; cellholds_x2_1_MV1 { cellholds_8_1_MV1; cellholds_7_1_MV1; cellholds_6_1_MV1; cellholds_5_1_MV1; cellholds_4_1_MV1; cellholds_3_1_MV1; Modified: trunk/Toss/GGP/tests/connect5-raw.toss =================================================================== --- trunk/Toss/GGP/tests/connect5-raw.toss 2011-03-18 00:19:55 UTC (rev 1367) +++ trunk/Toss/GGP/tests/connect5-raw.toss 2011-03-18 16:57:31 UTC (rev 1368) @@ -1,5 +1,4 @@ PLAYERS x, o -DATA RULE mark_x149_y149_0: [cell_x149_y149__blank_, control__blank_ | _opt_cell_x_y_b (control__blank_); @@ -23,22 +22,12 @@ EQ___cell_x_y_MV1_x(cell_x160_a23__blank_, cell_x160_c31__blank_) and EQ___cell_x_y_MV1_x(cell_x160_a23__blank_, cell_x160_d23__blank_) and EQ___cell_x_y_MV1_x(cell_x160_a23__blank_, cell_x160_e23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_b23__blank_, cell_x160_a23__blank_) and EQ___cell_x_y_MV1_x(cell_x160_b23__blank_, cell_x160_c31__blank_) and EQ___cell_x_y_MV1_x(cell_x160_b23__blank_, cell_x160_d23__blank_) and EQ___cell_x_y_MV1_x(cell_x160_b23__blank_, cell_x160_e23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_c31__blank_, cell_x160_a23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_c31__blank_, cell_x160_b23__blank_) and EQ___cell_x_y_MV1_x(cell_x160_c31__blank_, cell_x160_d23__blank_) and EQ___cell_x_y_MV1_x(cell_x160_c31__blank_, cell_x160_e23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_d23__blank_, cell_x160_a23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_d23__blank_, cell_x160_b23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_d23__blank_, cell_x160_c31__blank_) and EQ___cell_x_y_MV1_x(cell_x160_d23__blank_, cell_x160_e23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_e23__blank_, cell_x160_a23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_e23__blank_, cell_x160_b23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_e23__blank_, cell_x160_c31__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_e23__blank_, cell_x160_d23__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x160_d23__blank_, cell_x160_e23__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x160_c31__blank_, @@ -58,22 +47,12 @@ EQ___cell_x_y_MV1_y(cell_a24_y160__blank_, cell_c32_y160__blank_) and EQ___cell_x_y_MV1_y(cell_a24_y160__blank_, cell_d24_y160__blank_) and EQ___cell_x_y_MV1_y(cell_a24_y160__blank_, cell_e24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_b24_y160__blank_, cell_a24_y160__blank_) and EQ___cell_x_y_MV1_y(cell_b24_y160__blank_, cell_c32_y160__blank_) and EQ___cell_x_y_MV1_y(cell_b24_y160__blank_, cell_d24_y160__blank_) and EQ___cell_x_y_MV1_y(cell_b24_y160__blank_, cell_e24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_c32_y160__blank_, cell_a24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_c32_y160__blank_, cell_b24_y160__blank_) and EQ___cell_x_y_MV1_y(cell_c32_y160__blank_, cell_d24_y160__blank_) and EQ___cell_x_y_MV1_y(cell_c32_y160__blank_, cell_e24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_d24_y160__blank_, cell_a24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_d24_y160__blank_, cell_b24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_d24_y160__blank_, cell_c32_y160__blank_) and EQ___cell_x_y_MV1_y(cell_d24_y160__blank_, cell_e24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_e24_y160__blank_, cell_a24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_e24_y160__blank_, cell_b24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_e24_y160__blank_, cell_c32_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_e24_y160__blank_, cell_d24_y160__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_d24_y160__blank_, cell_e24_y160__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_c32_y160__blank_, @@ -139,22 +118,12 @@ EQ___cell_x_y_MV1_x(cell_x171_a25__blank_, cell_x171_c33__blank_) and EQ___cell_x_y_MV1_x(cell_x171_a25__blank_, cell_x171_d25__blank_) and EQ___cell_x_y_MV1_x(cell_x171_a25__blank_, cell_x171_e25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_b25__blank_, cell_x171_a25__blank_) and EQ___cell_x_y_MV1_x(cell_x171_b25__blank_, cell_x171_c33__blank_) and EQ___cell_x_y_MV1_x(cell_x171_b25__blank_, cell_x171_d25__blank_) and EQ___cell_x_y_MV1_x(cell_x171_b25__blank_, cell_x171_e25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_c33__blank_, cell_x171_a25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_c33__blank_, cell_x171_b25__blank_) and EQ___cell_x_y_MV1_x(cell_x171_c33__blank_, cell_x171_d25__blank_) and EQ___cell_x_y_MV1_x(cell_x171_c33__blank_, cell_x171_e25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_d25__blank_, cell_x171_a25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_d25__blank_, cell_x171_b25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_d25__blank_, cell_x171_c33__blank_) and EQ___cell_x_y_MV1_x(cell_x171_d25__blank_, cell_x171_e25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_e25__blank_, cell_x171_a25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_e25__blank_, cell_x171_b25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_e25__blank_, cell_x171_c33__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_e25__blank_, cell_x171_d25__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x171_d25__blank_, cell_x171_e25__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x171_c33__blank_, @@ -174,22 +143,12 @@ EQ___cell_x_y_MV1_y(cell_a26_y171__blank_, cell_c34_y171__blank_) and EQ___cell_x_y_MV1_y(cell_a26_y171__blank_, cell_d26_y171__blank_) and EQ___cell_x_y_MV1_y(cell_a26_y171__blank_, cell_e26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_b26_y171__blank_, cell_a26_y171__blank_) and EQ___cell_x_y_MV1_y(cell_b26_y171__blank_, cell_c34_y171__blank_) and EQ___cell_x_y_MV1_y(cell_b26_y171__blank_, cell_d26_y171__blank_) and EQ___cell_x_y_MV1_y(cell_b26_y171__blank_, cell_e26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_c34_y171__blank_, cell_a26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_c34_y171__blank_, cell_b26_y171__blank_) and EQ___cell_x_y_MV1_y(cell_c34_y171__blank_, cell_d26_y171__blank_) and EQ___cell_x_y_MV1_y(cell_c34_y171__blank_, cell_e26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_d26_y171__blank_, cell_a26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_d26_y171__blank_, cell_b26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_d26_y171__blank_, cell_c34_y171__blank_) and EQ___cell_x_y_MV1_y(cell_d26_y171__blank_, cell_e26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_e26_y171__blank_, cell_a26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_e26_y171__blank_, cell_b26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_e26_y171__blank_, cell_c34_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_e26_y171__blank_, cell_d26_y171__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_d26_y171__blank_, cell_e26_y171__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_c34_y171__blank_, @@ -272,22 +231,12 @@ EQ___cell_x_y_MV1_x(cell_x160_a23__blank_, cell_x160_c31__blank_) and EQ___cell_x_y_MV1_x(cell_x160_a23__blank_, cell_x160_d23__blank_) and EQ___cell_x_y_MV1_x(cell_x160_a23__blank_, cell_x160_e23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_b23__blank_, cell_x160_a23__blank_) and EQ___cell_x_y_MV1_x(cell_x160_b23__blank_, cell_x160_c31__blank_) and EQ___cell_x_y_MV1_x(cell_x160_b23__blank_, cell_x160_d23__blank_) and EQ___cell_x_y_MV1_x(cell_x160_b23__blank_, cell_x160_e23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_c31__blank_, cell_x160_a23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_c31__blank_, cell_x160_b23__blank_) and EQ___cell_x_y_MV1_x(cell_x160_c31__blank_, cell_x160_d23__blank_) and EQ___cell_x_y_MV1_x(cell_x160_c31__blank_, cell_x160_e23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_d23__blank_, cell_x160_a23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_d23__blank_, cell_x160_b23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_d23__blank_, cell_x160_c31__blank_) and EQ___cell_x_y_MV1_x(cell_x160_d23__blank_, cell_x160_e23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_e23__blank_, cell_x160_a23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_e23__blank_, cell_x160_b23__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_e23__blank_, cell_x160_c31__blank_) and - EQ___cell_x_y_MV1_x(cell_x160_e23__blank_, cell_x160_d23__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x160_d23__blank_, cell_x160_e23__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x160_c31__blank_, @@ -307,22 +256,12 @@ EQ___cell_x_y_MV1_y(cell_a24_y160__blank_, cell_c32_y160__blank_) and EQ___cell_x_y_MV1_y(cell_a24_y160__blank_, cell_d24_y160__blank_) and EQ___cell_x_y_MV1_y(cell_a24_y160__blank_, cell_e24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_b24_y160__blank_, cell_a24_y160__blank_) and EQ___cell_x_y_MV1_y(cell_b24_y160__blank_, cell_c32_y160__blank_) and EQ___cell_x_y_MV1_y(cell_b24_y160__blank_, cell_d24_y160__blank_) and EQ___cell_x_y_MV1_y(cell_b24_y160__blank_, cell_e24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_c32_y160__blank_, cell_a24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_c32_y160__blank_, cell_b24_y160__blank_) and EQ___cell_x_y_MV1_y(cell_c32_y160__blank_, cell_d24_y160__blank_) and EQ___cell_x_y_MV1_y(cell_c32_y160__blank_, cell_e24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_d24_y160__blank_, cell_a24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_d24_y160__blank_, cell_b24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_d24_y160__blank_, cell_c32_y160__blank_) and EQ___cell_x_y_MV1_y(cell_d24_y160__blank_, cell_e24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_e24_y160__blank_, cell_a24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_e24_y160__blank_, cell_b24_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_e24_y160__blank_, cell_c32_y160__blank_) and - EQ___cell_x_y_MV1_y(cell_e24_y160__blank_, cell_d24_y160__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_d24_y160__blank_, cell_e24_y160__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_c32_y160__blank_, @@ -388,22 +327,12 @@ EQ___cell_x_y_MV1_x(cell_x171_a25__blank_, cell_x171_c33__blank_) and EQ___cell_x_y_MV1_x(cell_x171_a25__blank_, cell_x171_d25__blank_) and EQ___cell_x_y_MV1_x(cell_x171_a25__blank_, cell_x171_e25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_b25__blank_, cell_x171_a25__blank_) and EQ___cell_x_y_MV1_x(cell_x171_b25__blank_, cell_x171_c33__blank_) and EQ___cell_x_y_MV1_x(cell_x171_b25__blank_, cell_x171_d25__blank_) and EQ___cell_x_y_MV1_x(cell_x171_b25__blank_, cell_x171_e25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_c33__blank_, cell_x171_a25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_c33__blank_, cell_x171_b25__blank_) and EQ___cell_x_y_MV1_x(cell_x171_c33__blank_, cell_x171_d25__blank_) and EQ___cell_x_y_MV1_x(cell_x171_c33__blank_, cell_x171_e25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_d25__blank_, cell_x171_a25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_d25__blank_, cell_x171_b25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_d25__blank_, cell_x171_c33__blank_) and EQ___cell_x_y_MV1_x(cell_x171_d25__blank_, cell_x171_e25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_e25__blank_, cell_x171_a25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_e25__blank_, cell_x171_b25__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_e25__blank_, cell_x171_c33__blank_) and - EQ___cell_x_y_MV1_x(cell_x171_e25__blank_, cell_x171_d25__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x171_d25__blank_, cell_x171_e25__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x171_c33__blank_, @@ -423,22 +352,12 @@ EQ___cell_x_y_MV1_y(cell_a26_y171__blank_, cell_c34_y171__blank_) and EQ___cell_x_y_MV1_y(cell_a26_y171__blank_, cell_d26_y171__blank_) and EQ___cell_x_y_MV1_y(cell_a26_y171__blank_, cell_e26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_b26_y171__blank_, cell_a26_y171__blank_) and EQ___cell_x_y_MV1_y(cell_b26_y171__blank_, cell_c34_y171__blank_) and EQ___cell_x_y_MV1_y(cell_b26_y171__blank_, cell_d26_y171__blank_) and EQ___cell_x_y_MV1_y(cell_b26_y171__blank_, cell_e26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_c34_y171__blank_, cell_a26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_c34_y171__blank_, cell_b26_y171__blank_) and EQ___cell_x_y_MV1_y(cell_c34_y171__blank_, cell_d26_y171__blank_) and EQ___cell_x_y_MV1_y(cell_c34_y171__blank_, cell_e26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_d26_y171__blank_, cell_a26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_d26_y171__blank_, cell_b26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_d26_y171__blank_, cell_c34_y171__blank_) and EQ___cell_x_y_MV1_y(cell_d26_y171__blank_, cell_e26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_e26_y171__blank_, cell_a26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_e26_y171__blank_, cell_b26_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_e26_y171__blank_, cell_c34_y171__blank_) and - EQ___cell_x_y_MV1_y(cell_e26_y171__blank_, cell_d26_y171__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_d26_y171__blank_, cell_e26_y171__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_c34_y171__blank_, @@ -511,22 +430,12 @@ EQ___cell_x_y_MV1_x(cell_x51_a7__blank_, cell_x51_c7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_a7__blank_, cell_x51_d7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_a7__blank_, cell_x51_e7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_b7__blank_, cell_x51_a7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_b7__blank_, cell_x51_c7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_b7__blank_, cell_x51_d7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_b7__blank_, cell_x51_e7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_c7__blank_, cell_x51_a7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_c7__blank_, cell_x51_b7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_c7__blank_, cell_x51_d7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_c7__blank_, cell_x51_e7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_d7__blank_, cell_x51_a7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_d7__blank_, cell_x51_b7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_d7__blank_, cell_x51_c7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_d7__blank_, cell_x51_e7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_e7__blank_, cell_x51_a7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_e7__blank_, cell_x51_b7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_e7__blank_, cell_x51_c7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_e7__blank_, cell_x51_d7__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x51_a7__blank_, cell_x51_b7__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x51_b7__blank_, @@ -544,22 +453,12 @@ EQ___cell_x_y_MV1_y(cell_a8_y51__blank_, cell_c8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_a8_y51__blank_, cell_d8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_a8_y51__blank_, cell_e8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_b8_y51__blank_, cell_a8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_b8_y51__blank_, cell_c8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_b8_y51__blank_, cell_d8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_b8_y51__blank_, cell_e8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_c8_y51__blank_, cell_a8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_c8_y51__blank_, cell_b8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_c8_y51__blank_, cell_d8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_c8_y51__blank_, cell_e8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_d8_y51__blank_, cell_a8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_d8_y51__blank_, cell_b8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_d8_y51__blank_, cell_c8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_d8_y51__blank_, cell_e8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_e8_y51__blank_, cell_a8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_e8_y51__blank_, cell_b8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_e8_y51__blank_, cell_c8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_e8_y51__blank_, cell_d8_y51__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_a8_y51__blank_, cell_b8_y51__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_b8_y51__blank_, @@ -626,22 +525,12 @@ EQ___cell_x_y_MV1_x(cell_x40_a5__blank_, cell_x40_c5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_a5__blank_, cell_x40_d5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_a5__blank_, cell_x40_e5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_b5__blank_, cell_x40_a5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_b5__blank_, cell_x40_c5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_b5__blank_, cell_x40_d5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_b5__blank_, cell_x40_e5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_c5__blank_, cell_x40_a5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_c5__blank_, cell_x40_b5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_c5__blank_, cell_x40_d5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_c5__blank_, cell_x40_e5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_d5__blank_, cell_x40_a5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_d5__blank_, cell_x40_b5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_d5__blank_, cell_x40_c5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_d5__blank_, cell_x40_e5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_e5__blank_, cell_x40_a5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_e5__blank_, cell_x40_b5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_e5__blank_, cell_x40_c5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_e5__blank_, cell_x40_d5__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x40_a5__blank_, cell_x40_b5__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x40_b5__blank_, @@ -659,22 +548,12 @@ EQ___cell_x_y_MV1_y(cell_a6_y40__blank_, cell_c6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_a6_y40__blank_, cell_d6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_a6_y40__blank_, cell_e6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_b6_y40__blank_, cell_a6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_b6_y40__blank_, cell_c6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_b6_y40__blank_, cell_d6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_b6_y40__blank_, cell_e6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_c6_y40__blank_, cell_a6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_c6_y40__blank_, cell_b6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_c6_y40__blank_, cell_d6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_c6_y40__blank_, cell_e6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_d6_y40__blank_, cell_a6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_d6_y40__blank_, cell_b6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_d6_y40__blank_, cell_c6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_d6_y40__blank_, cell_e6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_e6_y40__blank_, cell_a6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_e6_y40__blank_, cell_b6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_e6_y40__blank_, cell_c6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_e6_y40__blank_, cell_d6_y40__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_a6_y40__blank_, cell_b6_y40__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_b6_y40__blank_, @@ -742,22 +621,12 @@ EQ___cell_x_y_MV1_x(cell_x62_a9__blank_, cell_x62_c9__blank_) and EQ___cell_x_y_MV1_x(cell_x62_a9__blank_, cell_x62_d9__blank_) and EQ___cell_x_y_MV1_x(cell_x62_a9__blank_, cell_x62_e9__blank_) and - EQ___cell_x_y_MV1_x(cell_x62_b9__blank_, cell_x62_a9__blank_) and EQ___cell_x_y_MV1_x(cell_x62_b9__blank_, cell_x62_c9__blank_) and EQ___cell_x_y_MV1_x(cell_x62_b9__blank_, cell_x62_d9__blank_) and EQ___cell_x_y_MV1_x(cell_x62_b9__blank_, cell_x62_e9__blank_) and - EQ___cell_x_y_MV1_x(cell_x62_c9__blank_, cell_x62_a9__blank_) and - EQ___cell_x_y_MV1_x(cell_x62_c9__blank_, cell_x62_b9__blank_) and EQ___cell_x_y_MV1_x(cell_x62_c9__blank_, cell_x62_d9__blank_) and EQ___cell_x_y_MV1_x(cell_x62_c9__blank_, cell_x62_e9__blank_) and - EQ___cell_x_y_MV1_x(cell_x62_d9__blank_, cell_x62_a9__blank_) and - EQ___cell_x_y_MV1_x(cell_x62_d9__blank_, cell_x62_b9__blank_) and - EQ___cell_x_y_MV1_x(cell_x62_d9__blank_, cell_x62_c9__blank_) and EQ___cell_x_y_MV1_x(cell_x62_d9__blank_, cell_x62_e9__blank_) and - EQ___cell_x_y_MV1_x(cell_x62_e9__blank_, cell_x62_a9__blank_) and - EQ___cell_x_y_MV1_x(cell_x62_e9__blank_, cell_x62_b9__blank_) and - EQ___cell_x_y_MV1_x(cell_x62_e9__blank_, cell_x62_c9__blank_) and - EQ___cell_x_y_MV1_x(cell_x62_e9__blank_, cell_x62_d9__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x62_a9__blank_, cell_x62_b9__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x62_b9__blank_, @@ -781,37 +650,17 @@ EQ___cell_x_y_MV1_y(cell_a10_y62__blank_, cell_e10_y62__blank_) and EQ___cell_x_y_MV1_y(cell_b10_y62__blank_, - cell_a10_y62__blank_) and - EQ___cell_x_y_MV1_y(cell_b10_y62__blank_, cell_c10_y62__blank_) and EQ___cell_x_y_MV1_y(cell_b10_y62__blank_, cell_d10_y62__blank_) and EQ___cell_x_y_MV1_y(cell_b10_y62__blank_, cell_e10_y62__blank_) and EQ___cell_x_y_MV1_y(cell_c10_y62__blank_, - cell_a10_y62__blank_) and - EQ___cell_x_y_MV1_y(cell_c10_y62__blank_, - cell_b10_y62__blank_) and - EQ___cell_x_y_MV1_y(cell_c10_y62__blank_, cell_d10_y62__blank_) and EQ___cell_x_y_MV1_y(cell_c10_y62__blank_, cell_e10_y62__blank_) and EQ___cell_x_y_MV1_y(cell_d10_y62__blank_, - cell_a10_y62__blank_) and - EQ___cell_x_y_MV1_y(cell_d10_y62__blank_, - cell_b10_y62__blank_) and - EQ___cell_x_y_MV1_y(cell_d10_y62__blank_, - cell_c10_y62__blank_) and - EQ___cell_x_y_MV1_y(cell_d10_y62__blank_, cell_e10_y62__blank_) and - EQ___cell_x_y_MV1_y(cell_e10_y62__blank_, - cell_a10_y62__blank_) and - EQ___cell_x_y_MV1_y(cell_e10_y62__blank_, - cell_b10_y62__blank_) and - EQ___cell_x_y_MV1_y(cell_e10_y62__blank_, - cell_c10_y62__blank_) and - EQ___cell_x_y_MV1_y(cell_e10_y62__blank_, - cell_d10_y62__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_a10_y62__blank_, cell_b10_y62__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_b10_y62__blank_, @@ -878,22 +727,12 @@ EQ___cell_x_y_MV1_x(cell_x40_a5__blank_, cell_x40_c5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_a5__blank_, cell_x40_d5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_a5__blank_, cell_x40_e5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_b5__blank_, cell_x40_a5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_b5__blank_, cell_x40_c5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_b5__blank_, cell_x40_d5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_b5__blank_, cell_x40_e5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_c5__blank_, cell_x40_a5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_c5__blank_, cell_x40_b5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_c5__blank_, cell_x40_d5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_c5__blank_, cell_x40_e5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_d5__blank_, cell_x40_a5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_d5__blank_, cell_x40_b5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_d5__blank_, cell_x40_c5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_d5__blank_, cell_x40_e5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_e5__blank_, cell_x40_a5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_e5__blank_, cell_x40_b5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_e5__blank_, cell_x40_c5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_e5__blank_, cell_x40_d5__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x40_a5__blank_, cell_x40_b5__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x40_b5__blank_, @@ -912,22 +751,12 @@ EQ___cell_x_y_MV1_y(cell_a6_y40__blank_, cell_c6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_a6_y40__blank_, cell_d6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_a6_y40__blank_, cell_e6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_b6_y40__blank_, cell_a6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_b6_y40__blank_, cell_c6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_b6_y40__blank_, cell_d6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_b6_y40__blank_, cell_e6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_c6_y40__blank_, cell_a6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_c6_y40__blank_, cell_b6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_c6_y40__blank_, cell_d6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_c6_y40__blank_, cell_e6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_d6_y40__blank_, cell_a6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_d6_y40__blank_, cell_b6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_d6_y40__blank_, cell_c6_y40__blank_) and EQ___cell_x_y_MV1_y(cell_d6_y40__blank_, cell_e6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_e6_y40__blank_, cell_a6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_e6_y40__blank_, cell_b6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_e6_y40__blank_, cell_c6_y40__blank_) and - EQ___cell_x_y_MV1_y(cell_e6_y40__blank_, cell_d6_y40__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_a6_y40__blank_, cell_b6_y40__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_b6_y40__blank_, @@ -1001,22 +830,12 @@ EQ___cell_x_y_MV1_x(cell_x51_a7__blank_, cell_x51_c7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_a7__blank_, cell_x51_d7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_a7__blank_, cell_x51_e7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_b7__blank_, cell_x51_a7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_b7__blank_, cell_x51_c7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_b7__blank_, cell_x51_d7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_b7__blank_, cell_x51_e7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_c7__blank_, cell_x51_a7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_c7__blank_, cell_x51_b7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_c7__blank_, cell_x51_d7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_c7__blank_, cell_x51_e7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_d7__blank_, cell_x51_a7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_d7__blank_, cell_x51_b7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_d7__blank_, cell_x51_c7__blank_) and EQ___cell_x_y_MV1_x(cell_x51_d7__blank_, cell_x51_e7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_e7__blank_, cell_x51_a7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_e7__blank_, cell_x51_b7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_e7__blank_, cell_x51_c7__blank_) and - EQ___cell_x_y_MV1_x(cell_x51_e7__blank_, cell_x51_d7__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x51_a7__blank_, cell_x51_b7__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x51_b7__blank_, @@ -1034,22 +853,12 @@ EQ___cell_x_y_MV1_y(cell_a8_y51__blank_, cell_c8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_a8_y51__blank_, cell_d8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_a8_y51__blank_, cell_e8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_b8_y51__blank_, cell_a8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_b8_y51__blank_, cell_c8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_b8_y51__blank_, cell_d8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_b8_y51__blank_, cell_e8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_c8_y51__blank_, cell_a8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_c8_y51__blank_, cell_b8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_c8_y51__blank_, cell_d8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_c8_y51__blank_, cell_e8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_d8_y51__blank_, cell_a8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_d8_y51__blank_, cell_b8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_d8_y51__blank_, cell_c8_y51__blank_) and EQ___cell_x_y_MV1_y(cell_d8_y51__blank_, cell_e8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_e8_y51__blank_, cell_a8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_e8_y51__blank_, cell_b8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_e8_y51__blank_, cell_c8_y51__blank_) and - EQ___cell_x_y_MV1_y(cell_e8_y51__blank_, cell_d8_y51__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_a8_y51__blank_, cell_b8_y51__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_b8_y51__blank_, @@ -1116,22 +925,12 @@ EQ___cell_x_y_MV1_x(cell_x40_a5__blank_, cell_x40_c5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_a5__blank_, cell_x40_d5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_a5__blank_, cell_x40_e5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_b5__blank_, cell_x40_a5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_b5__blank_, cell_x40_c5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_b5__blank_, cell_x40_d5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_b5__blank_, cell_x40_e5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_c5__blank_, cell_x40_a5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_c5__blank_, cell_x40_b5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_c5__blank_, cell_x40_d5__blank_) and EQ___cell_x_y_MV1_x(cell_x40_c5__blank_, cell_x40_e5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_d5__blank_, cell_x40_a5__blank_) and - EQ___cell_x_y_MV1_x(cell_x40_d5__blank_, cell_... [truncated message content] |
From: <luk...@us...> - 2011-03-18 00:20:02
|
Revision: 1367 http://toss.svn.sourceforge.net/toss/?rev=1367&view=rev Author: lukaszkaiser Date: 2011-03-18 00:19:55 +0000 (Fri, 18 Mar 2011) Log Message: ----------- Release preparations and documentation fixes and additions. Modified Paths: -------------- trunk/Toss/Makefile trunk/Toss/www/contact.xml trunk/Toss/www/ideas.xml Modified: trunk/Toss/Makefile =================================================================== --- trunk/Toss/Makefile 2011-03-17 22:03:28 UTC (rev 1366) +++ trunk/Toss/Makefile 2011-03-18 00:19:55 UTC (rev 1367) @@ -6,16 +6,19 @@ TossServer: Server/Server.native cp _build/Server/Server.native TossServer -RELEASE=0.5 +RELEASE=0.6 Release: Client Server doc - rm -f *~ Formula/*~ Solver/*~ Arena/*~ Play/*~ Client/*~ www/*~ + rm -f *~ Formula/*~ Solver/*~ Arena/*~ Play/*~ GGP/*~ \ + Language/*~ Server/*~ Client/*~ www/*~ WebClient/~ + make -C www/reference make -C www mkdir ../toss_$(RELEASE) cp -r * ../toss_$(RELEASE) mv ../toss_$(RELEASE) . - find toss_$(RELEASE) -name '.svn' -exec rm -rf {} \; rm -rf toss_$(RELEASE)/Toss.docdir - mv toss_$(RELEASE)/_build/Toss.docdir toss_$(RELEASE)/doc + rm -f toss_$(RELEASE)/www/code_doc + mv toss_$(RELEASE)/_build/Toss.docdir toss_$(RELEASE)/www/code_doc rm -rf toss_$(RELEASE)/_build toss_$(RELEASE)/gmon.out zip -r toss_$(RELEASE).zip toss_$(RELEASE) rm -rf toss_$(RELEASE) Modified: trunk/Toss/www/contact.xml =================================================================== --- trunk/Toss/www/contact.xml 2011-03-17 22:03:28 UTC (rev 1366) +++ trunk/Toss/www/contact.xml 2011-03-18 00:19:55 UTC (rev 1367) @@ -39,10 +39,10 @@ </par> </section> <section title="Email" lang="fr"> - <par>Toss is an open source project hosted by + <par>Toss est un projet open source hébergé par <a href="http://sourceforge.net">SourceForge</a> - and distributed under the BSD licence.<br/></par> - <par>Contact us by writing to: + et distribué sous la licence BSD.<br/></par> + <par>Contactez-nous par écrit à <mailto address="tos...@li..."/> </par> </section> @@ -71,12 +71,20 @@ Toss Subversion Repository</a></item> </itemize> </section> + <section title="Toss Liens" lang="fr"> + <itemize> + <item><a href="http://sourceforge.net/projects/toss/">Projet Toss à + SourceForge.net</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/"> + Toss Subversion Repository</a></item> + </itemize> + </section> <section title="Game Playing Links" lang="en"> <itemize> <item><a href="http://www.apronus.com/chess/wbeditor.php">Apronus Chess - Board Editor</a> is our favorite site for simple chess boards. + Board Editor</a> is our favorite site for simple chess board editing. </item> <item><a href="http://www.dozingcatsoftware.com/Gridlock/">Gridlock</a> @@ -155,8 +163,40 @@ Turn</a> możesz zagrać w różne gry planszowe.</item> </itemize> </section> + <section title="Liens vers les Programmes les Jeux" lang="fr"> + <itemize> + <item><a href="http://www.apronus.com/chess/wbeditor.php">Apronus Chess + Board Editor</a> est notre site favori pour l'édition simple + d'échiquier. + </item> + <item><a href="http://www.dozingcatsoftware.com/Gridlock/">Gridlock</a> + est une collection de jeux open-source. Il est agréable de jouer + mais ne permet pas de changer le jeu. + </item> + <item><a href="http://www.zillions-of-games.com/">Zillions of Games</a> + est un langage de définition des jeux avec un simulateur et un grand + bibliothèque de jeux. Il est très agréable mais malheureusement + pas open source. + </item> + + <item><a href="http://www.kurnik.pl/">Kurnik</a> + est un site polonais sur lequel vous pouvez jouer à des jeux divers. + </item> + + <item><a href="http://abstractstrategy.com/main.html">Abstract + Strategy Games</a> site vous permet d'apprendre et de jouer + à des jeux abstraits de stratégie. + </item> + + <item><a href="http://www.yourturnmyturn.com/">Your Turn My + Turn</a> vous permet de jouer à divers jeux en ligne. + </item> + </itemize> + </section> + + <section title="Modelling Links" lang="en"> <itemize> <item><a href="http://edu.kde.org/step/">Step</a> @@ -212,19 +252,37 @@ </item> </itemize> </section> + <section title="Liens de Modélisation" lang="fr"> + <itemize> + <item><a href="http://edu.kde.org/step/">Step</a> + est un simulateur open-source de physique, une partie de KDE Education + Projet. Il peut être utilisé pour simulation de systèmes avec + la dynamique continue. + </item> + <item><a href="http://www.iseesystems.com/softwares/Education/StellaSoftware.aspx">STELLA</a> est un simulateur commercial, permettant d'utiliser la + dynamique continue et discrète. + </item> + <item><a href="http://ptolemy.eecs.berkeley.edu/">Ptolemy</a> projet + étudie de modélisation, de simulation et la conception de systèmes + concurrents, en temps réel. Ce projet permet d'utiliser différents + modèles de calcul qui régissent les interactions entre les composants. + </item> + </itemize> + </section> + + <section title="Team" lang="en"> <par>Toss originates from our work in the <a href="http://www.algosyn.rwth-aachen.de/">AlgoSyn</a> research group. Many people contributed, here we name just a few. Current leaders:</par> <itemize> - <item>Łukasz Kaiser (<mailto address="luk...@gm..."/>)</item> + <item>Łukasz Kaiser (<mailto address="luk...@gm..."/>)</item> <item>Tobias Ganzow</item> - <item>Łukasz Stafiniak</item> - <item>Michał Wójcik</item> + <item>Łukasz Stafiniak</item> + <item>Michał Wójcik</item> </itemize> - <par>Friends who helped us a lot with discussion and code.</par> <itemize> <item>Dietmar Berwanger</item> @@ -238,19 +296,17 @@ <item>Peter Cholewinski</item> </itemize> </section> - <section title="Team" lang="de"> <par>Toss hat angefangen während der Arbeit im <a href="http://www.algosyn.rwth-aachen.de/">AlgoSyn</a> Graduiertenkolleg. Viele haben dazu beigetragen, hier benennen wir nur einige Mitwirkende. Zur Zeit programmieren am meisten:</par> <itemize> - <item>Łukasz Kaiser (<mailto address="luk...@gm..."/>)</item> + <item>Łukasz Kaiser (<mailto address="luk...@gm..."/>)</item> <item>Tobias Ganzow</item> - <item>Łukasz Stafiniak</item> - <item>Michał Wójcik</item> + <item>Łukasz Stafiniak</item> + <item>Michał Wójcik</item> </itemize> - <par>Freunde die uns sehr geholfen haben.</par> <itemize> <item>Dietmar Berwanger</item> @@ -264,19 +320,17 @@ <item>Peter Cholewinski</item> </itemize> </section> - <section title="Team" lang="pl"> <par>Toss wywodzi się z prac i dyskusji w gronie <a href="http://www.algosyn.rwth-aachen.de/">AlgoSyn</a>. Wiele osób pracowało nad Tossem w różnych okresach, tutaj wymieniamy tylko niektóre z nich. Obecnie najwięcej pracują:</par> <itemize> - <item>Łukasz Kaiser (<mailto address="luk...@gm..."/>)</item> + <item>Łukasz Kaiser (<mailto address="luk...@gm..."/>)</item> <item>Tobias Ganzow</item> - <item>Łukasz Stafiniak</item> - <item>Michał Wójcik</item> + <item>Łukasz Stafiniak</item> + <item>Michał Wójcik</item> </itemize> - <par>Przyjaciele, którzy bardzo nam pomogli.</par> <itemize> <item>Dietmar Berwanger</item> @@ -290,5 +344,29 @@ <item>Peter Cholewinski</item> </itemize> </section> + <section title="Team" lang="fr"> + <par>Toss Toss est originaire de notre travail dans le groupe de + recherche <a href="http://www.algosyn.rwth-aachen.de/">AlgoSyn</a>. + Plusieurs personnes ont contribué, ici, nous n'en nommer pas tous. + Les dirigeants actuels:</par> + <itemize> + <item>Łukasz Kaiser (<mailto address="luk...@gm..."/>)</item> + <item>Tobias Ganzow</item> + <item>Łukasz Stafiniak</item> + <item>Michał Wójcik</item> + </itemize> + <par>Les amis qui nous ont aidé par la discussion et le code.</par> + <itemize> + <item>Dietmar Berwanger</item> + <item>Matko Botincan</item> + <item>Diana Fischer</item> + </itemize> + <par>Un autre groupe de personnes, qui ont travaillé sur la version + la plus ancienne de Toss (environ 2004), a été dirigée par:</par> + <itemize> + <item>Alexander Kharitonov</item> + <item>Peter Cholewinski</item> + </itemize> + </section> </personal> Modified: trunk/Toss/www/ideas.xml =================================================================== --- trunk/Toss/www/ideas.xml 2011-03-17 22:03:28 UTC (rev 1366) +++ trunk/Toss/www/ideas.xml 2011-03-18 00:19:55 UTC (rev 1367) @@ -46,11 +46,11 @@ <itemize> <item>Toss Mailing List: <mailto address="tos...@li..."/></item> - <item>Łukasz Kaiser (GSoC admin): + <item>Łukasz Kaiser (GSoC admin): <mailto address="luk...@gm..."/></item> - <item>Łukasz Stafiniak (GSoC backup admin): + <item>Łukasz Stafiniak (GSoC backup admin): <mailto address="luk...@gm..."/></item> - <item>Michał Wójcik: + <item>Michał Wójcik: <mailto address="mic...@gm..."/></item> </itemize> </section> @@ -85,8 +85,8 @@ project, but it can become very interesting in the last phase! <br/><br/></par> <par><em>Possible Mentors (in order of preference):</em> - Michał Wójcik, Tobias Ganzow, - Łukasz Stafiniak, Łukasz Kaiser + Michał Wójcik, Tobias Ganzow, + Łukasz Stafiniak, Łukasz Kaiser </par> </section> @@ -121,7 +121,7 @@ and to be able to use and debug them in parallel. <br/><br/></par> <par><em>Possible Mentors (in order of preference):</em> - Łukasz Kaiser, Tobias Ganzow, Łukasz Stafiniak + Łukasz Kaiser, Tobias Ganzow, Łukasz Stafiniak </par> </section> @@ -160,7 +160,7 @@ interface design is necessary, and a lot of testing to make it right. <br/><br/></par> <par><em>Possible Mentors (in order of preference):</em> - Dietmar Berwanger, Michał Wójcik, Diana Fischer + Dietmar Berwanger, Michał Wójcik, Diana Fischer </par> </section> @@ -198,7 +198,7 @@ their optimization techniques or constraint solving will be helpful. <br/><br/></par> <par><em>Possible Mentors (in order of preference):</em> - Tobias Ganzow, Łukasz Kaiser, Łukasz Stafiniak + Tobias Ganzow, Łukasz Kaiser, Łukasz Stafiniak </par> </section> @@ -240,7 +240,7 @@ Still, passion for GGP is the best recommendation for this project! <br/><br/></par> <par><em>Possible Mentors (in order of preference):</em> - Łukasz Stafiniak, Łukasz Kaiser, maybe someone from GGP Galaxy + Łukasz Stafiniak, Łukasz Kaiser, maybe someone from GGP Galaxy </par> </section> @@ -275,7 +275,7 @@ already improve playing strength. OCaml experience is required. <br/><br/></par> <par><em>Possible Mentors (in order of preference):</em> - Łukasz Stafiniak, Łukasz Kaiser + Łukasz Stafiniak, Łukasz Kaiser </par> </section> @@ -312,9 +312,52 @@ to hard, depending on how much effort one makes to adapt automatic play. <br/><br/></par> <par><em>Possible Mentors (in order of preference):</em> - Łukasz Kaiser, Dietmar Berwanger, Tobias Ganzow + Łukasz Kaiser, Dietmar Berwanger, Tobias Ganzow </par> </section> + <section title="Idea: Language for Games and Strategies"> + <par><em>Description and Goals.</em> + At present, one can only define a fixed game in a .toss file and only + in the fixed syntax. It should be allowed to also define preferences + of the players (heuristics) and their strategies — e.g. choices of + playout methods (UCT or Maximax) or their parameters. And use a more + friendly and defineable syntax. This project will adapt + the merged Speagram code with Toss to these ends. + <br/><br/></par> + <par><em>Deliverables.</em> + By mid-terms the merged Speagram code should be functional both + as Toss parser and at least for most of the old Speagram examples. + By the end it should fully support varying syntax, maybe using + defined relations for types, and allow to define players' strategies. + <br/><br/></par> + <par><em>Modules (in planned construction order).</em> + <enumerate> + <item>Clean up Language directory, remove higher-order functions</item> + <item>Change rewriting engine in Language to the Toss one</item> + <item>Change external actions in Language to the ones used in Toss game + parsing (add, change rules, model, defines relations, etc.)</item> + <item>Test the Language module as Toss parser</item> + <item>Use defined rels instead of Language types</item> + <item>Allow strategy definitions in Language</item> + </enumerate> + <br/></par> + <par><em>Needed Skills and Difficulty.</em> + This project is ambitious and requires good knowledge of OCaml. + The general goal is to make a nice language for games and strategies, + the proposed way is just one of the possibilities. If you have + a passion for linguistics and want to mix it with formal models, + this is something for you! Just think what is possible in such a rich + formal model as Toss — you can finally give formal semantics to + actions in all tenses ("I did / do / will do"), as well as preferences + and subgoals ("I prefer / would like to") and many other expressions + of this kind. That's difficult, but it may be very rewarding! + <br/><br/></par> + <par><em>Possible Mentors (in order of preference):</em> + Łukasz Kaiser, Łukasz Stafiniak + </par> + </section> + + </personal> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-17 22:03:37
|
Revision: 1366 http://toss.svn.sourceforge.net/toss/?rev=1366&view=rev Author: lukstafi Date: 2011-03-17 22:03:28 +0000 (Thu, 17 Mar 2011) Log Message: ----------- FormulaOps: Generalized maps over formulas and real expressions; fixed flatten_ands. Arena: print game data; refined game comparison. GameSimpl: fixed and improved reduction of equal and complement relations (stage 1); stage 3: intersections of relations and of a relation with inverse of another (remaining: handling of superfluous EQ equivalences). Modified Paths: -------------- trunk/Toss/Arena/Arena.ml trunk/Toss/Arena/Arena.mli trunk/Toss/Arena/DiscreteRule.ml trunk/Toss/Formula/Formula.ml trunk/Toss/Formula/Formula.mli trunk/Toss/Formula/FormulaOps.ml trunk/Toss/Formula/FormulaOps.mli trunk/Toss/GGP/GDL.ml trunk/Toss/GGP/GDLTest.ml trunk/Toss/GGP/GameSimpl.ml trunk/Toss/GGP/GameSimpl.mli trunk/Toss/GGP/GameSimplTest.ml trunk/Toss/GGP/tests/breakthrough-raw.toss trunk/Toss/GGP/tests/breakthrough-simpl.toss trunk/Toss/GGP/tests/connect5-raw.toss trunk/Toss/GGP/tests/connect5-simpl.toss trunk/Toss/Solver/Structure.ml trunk/Toss/Solver/Structure.mli Modified: trunk/Toss/Arena/Arena.ml =================================================================== --- trunk/Toss/Arena/Arena.ml 2011-03-17 18:58:07 UTC (rev 1365) +++ trunk/Toss/Arena/Arena.ml 2011-03-17 22:03:28 UTC (rev 1366) @@ -341,6 +341,11 @@ Format.fprintf ppf "@[<1>PLAYERS@ %a@]@ " (Aux.fprint_sep_list "," Format.pp_print_string) (List.map fst (List.sort (fun (_,x) (_,y) -> x-y) player_names)); + if data <> [] then + Format.fprintf ppf "@[<1>DATA@ %a@]@ " + (Aux.fprint_sep_list "," + (fun ppf (k,v) -> Format.fprintf ppf "@[<1>%s@,:@ %s@]" k v)) + data; List.iter (fun (rname, r) -> Format.fprintf ppf "@[<1>RULE %s:@ %a@]@ " rname ContinuousRule.fprint r) rules; @@ -420,6 +425,12 @@ }}) game.rules}, {state with struc = f state.struc} + +let map_to_discrete f game = + {game with + rules = List.map (fun (rn, r) -> + rn, {r with ContinuousRule.discrete = + f r.ContinuousRule.discrete}) game.rules} (* Compare two (game, state) pairs and explain the first difference met. Formulas and expressions are compared for syntactical @@ -458,14 +469,38 @@ let pnames2 = List.sort cmp_pn g2.player_names in if pnames1 <> pnames2 then raise (Diff_result "Game players are given in different order."); - let norm_loc loc = - {loc with - moves = List.sort Pervasives.compare loc.moves; - payoffs = Array.map ( - FormulaOps.map_to_formulas_expr FormulaOps.flatten_formula) - loc.payoffs} in - if Array.map norm_loc g1.graph <> Array.map norm_loc g2.graph - then raise (Diff_result "Games have different graphs"); + Array.iteri (fun i loc1 -> + let loc2 = g2.graph.(i) in + let dmoves1 = Aux.list_diff loc1.moves loc2.moves in + if dmoves1 <> [] then raise (Diff_result ( + let label, dest = List.hd dmoves1 in + Printf.sprintf + "At location %d, only the first game has label %s->%d" + i label.rule dest)); + let dmoves2 = Aux.list_diff loc2.moves loc1.moves in + if dmoves2 <> [] then raise (Diff_result ( + let label, dest = List.hd dmoves1 in + Printf.sprintf + "At location %d, only the second game has label %s->%d" + i label.rule dest)); + if loc1.player <> loc2.player then raise (Diff_result ( + Printf.sprintf + "At location %d, the first game has player %d, second %d" + i loc1.player loc2.player)); + Array.iteri (fun p poff1 -> + let poff1 = + FormulaOps.map_to_formulas_expr FormulaOps.flatten_formula + poff1 in + let poff2 = + FormulaOps.map_to_formulas_expr FormulaOps.flatten_formula + loc2.payoffs.(p) in + if poff1 <> poff2 then raise (Diff_result ( + Printf.sprintf + "At location %d, payffs for player %d differ:\n%s\nvs.\n%s" + i p (Formula.real_str poff1) + (Formula.real_str poff2))); + ) loc1.payoffs + ) g1.graph; if List.sort Pervasives.compare g1.defined_rels <> List.sort Pervasives.compare g2.defined_rels then raise (Diff_result "Games have different defined relations"); Modified: trunk/Toss/Arena/Arena.mli =================================================================== --- trunk/Toss/Arena/Arena.mli 2011-03-17 18:58:07 UTC (rev 1365) +++ trunk/Toss/Arena/Arena.mli 2011-03-17 22:03:28 UTC (rev 1366) @@ -116,6 +116,10 @@ (Structure.structure -> Structure.structure) -> game * game_state -> game * game_state +(** Map to the structure representation of discrete part of rules. *) +val map_to_discrete : + (DiscreteRule.rule -> DiscreteRule.rule) -> game -> game + (** Compare two (game, state) pairs and explain the first difference met. Formulas and expressions are compared for syntactical equality. Players need to be given in the same order. Data is Modified: trunk/Toss/Arena/DiscreteRule.ml =================================================================== --- trunk/Toss/Arena/DiscreteRule.ml 2011-03-17 18:58:07 UTC (rev 1365) +++ trunk/Toss/Arena/DiscreteRule.ml 2011-03-17 22:03:28 UTC (rev 1366) @@ -425,7 +425,7 @@ | None -> false | Some sp -> sp = "new" || sp = "del" || sp = "right" || sp = "lhs") in - (* We name the new elements with their rule correspondents (note + (* We name the matched elements with their rule correspondents (note that in the nonstruct case the LHS and RHS elements have the same names due to renaming during rule compilation). *) let model = @@ -920,6 +920,17 @@ | phi -> Right phi) conjs in let lhs_extracted = posi @ nega in let precond = Formula.And conjs in + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf + "translate_from_precond:\nposi=\n%s\nnega=\n%s\nprecond=\n%s\n%!" + (Formula.sprint (Formula.And (List.map (fun (rel,args) -> + Formula.Rel (rel,args)) posi))) + (Formula.sprint (Formula.And (List.map (fun (rel,args) -> + Formula.Rel (rel,args)) nega))) + (Formula.sprint precond) + ); + (* }}} *) let fvars = FormulaOps.free_vars precond in let local_vars = List.filter (fun v-> Modified: trunk/Toss/Formula/Formula.ml =================================================================== --- trunk/Toss/Formula/Formula.ml 2011-03-17 18:58:07 UTC (rev 1365) +++ trunk/Toss/Formula/Formula.ml 2011-03-17 22:03:28 UTC (rev 1366) @@ -106,6 +106,10 @@ ;; +let is_atom = function + Rel _ | Eq _ | In _ | RealExpr _ -> true + | _ -> false + (* Helper power function, used in parser. *) let rec pow p n = if n = 0 then Const 1. else if n = 1 then p else Times (p, pow p (n-1)) Modified: trunk/Toss/Formula/Formula.mli =================================================================== --- trunk/Toss/Formula/Formula.mli 2011-03-17 18:58:07 UTC (rev 1365) +++ trunk/Toss/Formula/Formula.mli 2011-03-17 22:03:28 UTC (rev 1366) @@ -70,6 +70,7 @@ val compare : formula -> formula -> int +val is_atom : formula -> bool (** {2 Printing Functions} *) Modified: trunk/Toss/Formula/FormulaOps.ml =================================================================== --- trunk/Toss/Formula/FormulaOps.ml 2011-03-17 18:58:07 UTC (rev 1365) +++ trunk/Toss/Formula/FormulaOps.ml 2011-03-17 22:03:28 UTC (rev 1366) @@ -123,6 +123,72 @@ | Rel _ | Eq _ | In _ -> true | _ -> false +(* Generalized map over formula and real expression types. *) +type formula_and_expr_map = { + map_Rel : string -> fo_var array -> formula; + map_Eq : fo_var -> fo_var -> formula; + map_In : fo_var -> mso_var -> formula; + map_RealExpr : real_expr -> sign_op -> formula; + map_Not : formula -> formula; + map_And : formula list -> formula; + map_Or : formula list -> formula; + map_Ex : var list -> formula -> formula; + map_All : var list -> formula -> formula; + + map_RVar : string -> real_expr; + map_Const : float -> real_expr; + map_Times : real_expr -> real_expr -> real_expr; + map_Plus : real_expr -> real_expr -> real_expr; + map_Fun : string -> fo_var -> real_expr; + map_Char : formula -> real_expr; + map_Sum : fo_var list -> formula -> real_expr -> real_expr +} + +let identity_map = { + map_Rel = (fun rel args -> Rel (rel, args)); + map_Eq = (fun x y -> Eq (x, y)); + map_In = (fun x ys -> In (x, ys)); + map_RealExpr = (fun expr sign -> RealExpr (expr, sign)); + map_Not = (fun phi -> Not phi); + map_And = (fun conjs -> And conjs); + map_Or = (fun disjs -> Or disjs); + map_Ex = (fun vs phi -> Ex (vs, phi)); + map_All = (fun vs phi -> All (vs, phi)); + + map_RVar = (fun v -> RVar v); + map_Const = (fun c -> Const c); + map_Times = (fun expr1 expr2 -> Times (expr1, expr2)); + map_Plus = (fun expr1 expr2 -> Plus (expr1, expr2)); + map_Fun = (fun f v -> Fun (f, v)); + map_Char = (fun phi -> Char phi); + map_Sum = (fun vs guard expr -> Sum (vs, guard, expr)) +} + +let rec map_formula gmap = function + | Rel (rel, args) -> gmap.map_Rel rel args + | Eq (x, y) -> gmap.map_Eq x y + | In (x, ys) -> gmap.map_In x ys + | RealExpr (expr, sign) -> + gmap.map_RealExpr (map_real_expr gmap expr) sign + | Not phi -> gmap.map_Not (map_formula gmap phi) + | And conjs -> gmap.map_And (List.map (map_formula gmap) conjs) + | Or disjs -> gmap.map_Or (List.map (map_formula gmap) disjs) + | Ex (vs, phi) -> gmap.map_Ex vs (map_formula gmap phi) + | All (vs, phi) -> gmap.map_All vs (map_formula gmap phi) + +and map_real_expr gmap = function + | RVar v -> gmap.map_RVar v + | Const c -> gmap.map_Const c + | Times (expr1, expr2) -> + gmap.map_Times (map_real_expr gmap expr1) (map_real_expr gmap expr2) + | Plus (expr1, expr2) -> + gmap.map_Plus (map_real_expr gmap expr1) (map_real_expr gmap expr2) + | Fun (f, v) -> gmap.map_Fun f v + | Char phi -> gmap.map_Char (map_formula gmap phi) + | Sum (vs, guard, expr) -> + gmap.map_Sum vs (map_formula gmap guard) (map_real_expr gmap expr) + + (* Map [f] to all literals (i.e. atoms or not(atom)'s) in the given formula. Preserves order of subformulas. *) let rec map_to_literals f g = function @@ -534,10 +600,6 @@ (* Simplify. *) (* ------------------------------------------------------------------------- *) -let is_atom = function - Rel _ | Eq _ | In _ | RealExpr _ -> true - | _ -> false - let str_contains c s = try let _ = String.index s c in true with Not_found -> false @@ -694,43 +756,37 @@ if simp_p = p && simp_q = q then Times (p, q) else simplify_re ~do_pnf ~do_formula (Times (simp_p, simp_q)) + (* Flatten "and"s and "or"s in a formula -- i.e. associativity. Remove double negation along the way. *) -let rec flatten_formula phi = - let rec flat_and = function - | And conjs -> Aux.concat_map flat_and conjs - | phi -> - match flatten_formula phi with - | And _ as phi -> flat_and phi - | phi -> [phi] in - let rec flat_or = function - | Or disjs -> Aux.concat_map flat_or disjs - | phi -> - match flatten_formula phi with - | Or _ as phi -> flat_or phi - | phi -> [phi] in - match phi with - | Or [phi] -> flatten_formula phi - | And [phi] -> flatten_formula phi - | Or _ -> Or (flat_or phi) - | And _ -> And (flat_and phi) - | All (vs, phi) -> All (vs, flatten_formula phi) - | Ex (vs, phi) -> Ex (vs, flatten_formula phi) - | Not (Not phi) -> flatten_formula phi - | Not phi -> Not (flatten_formula phi) - | (Rel _ | Eq _ | In _ | RealExpr _) as atom -> atom +let flatten_formula = + let flat_and = function And conjs -> conjs | phi -> [phi] in + let flat_or = function Or disjs -> disjs | phi -> [phi] in + map_formula {identity_map with + map_And = (function + | [conj] -> conj + | conjs -> And (Aux.concat_map flat_and conjs)); + map_Or = (function + | [disj] -> disj + | disjs -> Or (Aux.concat_map flat_or disjs)); + map_Not = (function Not phi -> phi | phi -> Not phi)} -let rec flatten_ors = function - | Or disjs -> Aux.concat_map flatten_ors disjs +let rec flatten_or = function + | Or disjs -> Aux.concat_map flatten_or disjs + | Not (Not phi) | Not (And [Not phi]) | Not (Or [Not phi]) -> + flatten_or phi | phi -> [phi] (* Formula as a list of conjuncts, with one level of distributing negation over disjunction and pushing quantifiers inside. *) let rec flatten_ands = function | And conjs -> Aux.concat_map flatten_ands conjs + | Or [phi] -> flatten_ands phi + | Not (And [phi]) -> flatten_ands (Not phi) | Not (Or disjs) -> - List.map (fun d -> Not d) - (Aux.concat_map flatten_ors disjs) + Aux.concat_map flatten_ands + (List.map (fun d -> Not d) + (Aux.concat_map flatten_or disjs)) | All (vs, phi) -> List.map (fun phi -> All (vs, phi)) (flatten_ands phi) | Ex (vs, phi) as arg -> @@ -742,6 +798,7 @@ let bound_phi = match bound_conjs with | [phi] -> phi | _ -> And bound_conjs in free_conjs @ [Ex (vs, bound_phi)]) + | Not (Not phi) -> flatten_ands phi | phi -> [phi] (* Simplify the formula by removing relational literals, depending on @@ -750,7 +807,9 @@ track of the sign (variance) of a position. (Does not descend the real part currently.) [implies] is applied to atoms only. Repeat the removal till fixpoint since it can "unpack" literals e.g. from - conjunctions to disjunctions. *) + conjunctions to disjunctions. + + TODO: traverse the real part too. *) let remove_redundant ?(implies=(=)) phi = let implied_by x y = implies y x in let literal neg phis = Modified: trunk/Toss/Formula/FormulaOps.mli =================================================================== --- trunk/Toss/Formula/FormulaOps.mli 2011-03-17 18:58:07 UTC (rev 1365) +++ trunk/Toss/Formula/FormulaOps.mli 2011-03-17 22:03:28 UTC (rev 1366) @@ -19,6 +19,34 @@ (** {2 Mapping to atoms and variable substitution.} *) +(** Generalized map over formula and real expression types. *) +type formula_and_expr_map = { + map_Rel : string -> fo_var array -> formula; + map_Eq : fo_var -> fo_var -> formula; + map_In : fo_var -> mso_var -> formula; + map_RealExpr : real_expr -> sign_op -> formula; + map_Not : formula -> formula; + map_And : formula list -> formula; + map_Or : formula list -> formula; + map_Ex : var list -> formula -> formula; + map_All : var list -> formula -> formula; + + map_RVar : string -> real_expr; + map_Const : float -> real_expr; + map_Times : real_expr -> real_expr -> real_expr; + map_Plus : real_expr -> real_expr -> real_expr; + map_Fun : string -> fo_var -> real_expr; + map_Char : formula -> real_expr; + map_Sum : fo_var list -> formula -> real_expr -> real_expr +} + +(** Identity map to be refined using the [with] clause. *) +val identity_map : formula_and_expr_map + +(** Map through the structure adjusting subformulas/subexpressions. *) +val map_formula : formula_and_expr_map -> formula -> formula +val map_real_expr : formula_and_expr_map -> real_expr -> real_expr + (** Map [f] to all literals (i.e. atoms or not(atom)'s) in the given formula. Preserves order of subformulas. *) val map_to_literals : (formula -> formula) -> (real_expr -> real_expr) -> Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-03-17 18:58:07 UTC (rev 1365) +++ trunk/Toss/GGP/GDL.ml 2011-03-17 22:03:28 UTC (rev 1366) @@ -540,7 +540,7 @@ (** Generate all tuples for equivalences, to faciliate further transformations of formulas in the game definition (outside of translation). *) -let equivalences_all_tuples = ref false (* true *) +let equivalences_all_tuples = ref (* false *) true open Aux.BasicOperators Modified: trunk/Toss/GGP/GDLTest.ml =================================================================== --- trunk/Toss/GGP/GDLTest.ml 2011-03-17 18:58:07 UTC (rev 1365) +++ trunk/Toss/GGP/GDLTest.ml 2011-03-17 22:03:28 UTC (rev 1366) @@ -140,9 +140,9 @@ | None -> () let a () = - GDL.debug_level := 4; - GameSimpl.debug_level := 4; - DiscreteRule.debug_level := 4; + (* GDL.debug_level := 4; *) + (* GameSimpl.debug_level := 4; *) + (* DiscreteRule.debug_level := 4; *) let breakthrough = load_rules "./GGP/examples/breakthrough.gdl" in let connect5 = load_rules "./GGP/examples/connect5.gdl" in let tictactoe = load_rules "./GGP/examples/tictactoe.gdl" in Modified: trunk/Toss/GGP/GameSimpl.ml =================================================================== --- trunk/Toss/GGP/GameSimpl.ml 2011-03-17 18:58:07 UTC (rev 1365) +++ trunk/Toss/GGP/GameSimpl.ml 2011-03-17 22:03:28 UTC (rev 1366) @@ -5,17 +5,28 @@ The simplification of structures, associated formulas and Toss rules is specified by transformations described below. Rules can - be refined or new rules added to each stage. + be refined or new simplification rules added to each stage. - (1) Identify relations in the structure that are not fluents nor + TODO: use [DiscreteRule.special_rel_of rel = Some "opt"] + instead of [DiscreteRule.special_rel_of rel <> None]? (To protect + against GDL using identifiers starting with underscore.) + + (1) Reduce equivalent or complement relations. + + (1a) If [introduce_complement] is on, for each (unary) predicate + that does not have its complement in the structure, introduce the + complement. + + (1b) Identify relations in the structure that are not fluents nor defined relations and that are equal to or are complements of other relations in the structure. Select a single relation / a predicate (called "the original" below), that is smaller than its - complement (if the complement is in the signature), and replace - all selected relations with it (or its negation), in all formulas - of the definition. Remove the other relations from the structure. + complement (if the complement is in the signature, but see (1a)), + and replace all selected relations with it (or its negation), in + all formulas of the definition. Remove the other relations from + the structure. - (1a) We need to update LHS structures of rules (for presentation + (1c) We need to update LHS structures of rules (for presentation and game modification purposes, since the simple transformation above of the "embedding formula" suffices for the "compiled" rule representation). Replace the identified relations in the "embedded @@ -23,9 +34,9 @@ that occur positively in the LHS and are complements of their original. Derive all the tuples of embedded relations that are required to be absent for a match (not present, even optionally, - in the LHS). (1a1) Rename relations equivalent to their - originals. (1a2) Remove the non-optional tuples for relations that - are complements of their originals and (1a3) add tuples of + in the LHS). (1c1) Rename relations equivalent to their + originals. (1c2) Remove the non-optional tuples for relations that + are complements of their originals and (1c3) add tuples of originals that are complements of relations that are required to be absent. @@ -35,18 +46,43 @@ that are weaker/stronger than another present over the same tuple in the given conjunction/disjunction. - (3) For each pair of static unary predicates with nonempty - intersection, introduce new predicate for their conjunction. For - each pair of static binary predicates, introduce two new - predicates: one for their conjunction and the other for - conjunction of one of the predicates and the inverse of the other. + (3) Add intersections of non-fluent relations to the structure + when they co-occur in formulas. For binary relations, also add + intersections of a relation and an inverse of another. - (3a) Replace each conjunction of pair of unary/binary predicates - over the same variables, with one of introduced predicates. For - several possibilities of replacement pick one arbitrarily - (currently, in the order of occurrence in the formula). + (3a) Eliminate conjoined static (non-fluents and not defined) + relations in formulas that are applied to the same arguments and + introduce a new relation for their conjunction (by intersetcting + their tuples). - (4) Remove from the structure relations that are no longer used. + (3b) For binary static relations, collect pairs such that one + relation is applied to arguments in reverse order than the other + one, and introduce a new relation for intersection of one with the + inverse of the other. + + (3c) Repeat till no more atoms can be glued in this way. + + (3d) Since too long names would be unreadable anyway, introduce + fresh relation names for the glued relations and remember the + correspondence in game data. + + (3e) The eliminated co-occurrences are relevant only for tuples + present in rewrite rules (LHS structures), not for absent ones + (since these are conjoined negations). Replace them in the LHS + structures as in (3a)-(3b), but only if all of replaced relations + occur as non-embedded (i.e. "tau_h") (since embedded relations + will have reuired-to-be-absent occurrences, and these cannot be + handled by conjoining). + + TODO or warning: with the current specification (and + implementation), inconsistency between the structure-based + representation and the "embedding formula"-based representation of + discrete rules is possible: when the optimization replaces (in the + embedding formula) a conjunction of relations considered embedded. + + (4) Update rewrite rule signatures to contain all introduced + relations. Remove from the structures relations that are no longer + used. *) open Formula @@ -54,6 +90,7 @@ let debug_level = ref 0 +let introduce_complement = ref true (* Collect universally quantified subformulas and compute the size of @@ -80,12 +117,13 @@ let trunk, univs = separate_univ phi in trunk - List.fold_left (+) 0 (List.map FormulaOps.size univs) +module Tups = Structure.Tuples -let simplify ?(join_rel_names=fun x _ -> x) (game, state) = +let simplify (game, state) = let struc = state.Arena.struc in let signat = Structure.rel_signature struc in let nelems = Structure.Elems.cardinal struc.Structure.elements in - let tcard tups = Structure.Tuples.cardinal tups in + let tcard tups = Tups.cardinal tups in let fluents = Aux.unique_sorted (Aux.concat_map (fun (_,r) -> @@ -97,7 +135,71 @@ (String.concat ", " fluents) ); (* }}} *) - (* prepare for (1) and (2) *) + (* 1 *) + let add_rel rel acc = + match rel with + | Rel (rel,_) -> Aux.Strings.add rel acc + | _ -> acc in + let used_rels = + Arena.fold_over_formulas ~include_defined_rels:false + (FormulaOps.fold_over_atoms add_rel) + game Aux.Strings.empty in + let complemented = ref [] in + let predicate_tups = + Structure.Elems.fold (fun e tups -> Tups.add [|e|] tups) + struc.Structure.elements Tups.empty in + let struc = ref struc in + let signat = ref signat in + let used_rels = ref used_rels in + let complements = + List.fold_left (fun table (rel,arity) -> + let rel_tups = + Structure.StringMap.find rel !struc.Structure.relations in + let ntups = tcard rel_tups in + let crel = + Structure.StringMap.fold (fun rel2 rel2_tups crel -> + let arity2 = List.assoc rel2 !signat in + if crel <> None || arity2 <> arity then crel + else + let ntups2 = tcard rel2_tups in + if ntups >= ntups2 && + ntups + ntups2 = Aux.int_pow nelems arity && + not (List.mem rel2 fluents) && + Tups.is_empty (Tups.inter rel_tups rel2_tups) + then ( + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf "Complements: rel=%s; crel=%s\n%!" rel rel2 + ); + (* }}} *) + Some rel2 + ) else None + ) !struc.Structure.relations None in + let crel = + if not !introduce_complement || arity <> 1 || + crel <> None || ntups <= nelems / 2 + then crel + else + (* 1a *) + let crel = + Aux.not_conflicting_name ~truncate:true !used_rels "C" in + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf "Complemented: crel=%s\n%!" crel + ); + (* }}} *) + complemented := (crel, rel) :: !complemented; + struc := Structure.add_rels !struc crel + (Tups.elements (Tups.diff predicate_tups rel_tups)); + signat := (crel, arity) :: !signat; + used_rels := Aux.Strings.add crel !used_rels; + Some crel in + Aux.StrMap.add rel crel table + ) Aux.StrMap.empty !signat in + let struc = !struc in + let signat = !signat in + let complements rel = Aux.StrMap.find rel complements in + (* prepare for (1bc) and (2) *) let subset_table = List.fold_left (fun table (rel,arity) -> let rel_tups = @@ -105,7 +207,7 @@ let row = List.fold_left (fun row (rel2,arity2) -> if arity2 = arity && - Structure.Tuples.subset rel_tups + Tups.subset rel_tups (Structure.StringMap.find rel2 struc.Structure.relations) then Aux.Strings.add rel2 row else row @@ -122,42 +224,22 @@ (* }}} *) let included_in rel1 rel2 = Aux.Strings.mem rel2 (Aux.StrMap.find rel1 subset_table) in - let compl_table = - List.fold_left (fun table (rel,arity) -> - let rel_tups = - Structure.StringMap.find rel struc.Structure.relations in - let row = - List.fold_left (fun row (rel2,arity2) -> - if arity2 <> arity then row - else - let rel2_tups = - Structure.StringMap.find rel2 struc.Structure.relations in - let ntups = tcard rel_tups and ntups2 = tcard rel2_tups in - if ntups >= ntups2 && - ntups + ntups2 = Aux.int_pow nelems arity && - Structure.Tuples.is_empty - (Structure.Tuples.inter rel_tups rel2_tups) - then Aux.Strings.add rel2 row - else row - ) Aux.Strings.empty signat in - Aux.StrMap.add rel row table - ) Aux.StrMap.empty signat in - let complement rel1 rel2 = - Aux.Strings.mem rel2 (Aux.StrMap.find rel1 compl_table) in - (* 1 *) + (* 1b *) let equivalent = List.map (fun (rel1, arity) -> - try - let rel2, _ = - List.find (fun (rel2, arity2) -> - arity = arity2 && - not (List.mem rel2 fluents || - List.mem_assoc rel2 game.Arena.defined_rels) && - (complement rel1 rel2 || - (included_in rel1 rel2 && included_in rel2 rel1)) - ) signat in - rel1, (rel2, complement rel1 rel2) - with Not_found -> rel1, (rel1, false) + match complements rel1 with + | Some rel2 -> rel1, (rel2, true) + | None -> + try + let rel2, _ = + List.find (fun (rel2, arity2) -> + arity = arity2 && + not (List.mem rel2 fluents || + List.mem_assoc rel2 game.Arena.defined_rels) && + included_in rel1 rel2 && included_in rel2 rel1 + ) signat in + rel1, (rel2, false) + with Not_found -> rel1, (rel1, false) ) signat in let removable rel = let spec = DiscreteRule.special_rel_of rel in @@ -165,6 +247,7 @@ match spec with | None -> rel | Some spec -> DiscreteRule.orig_rel_of rel in + rel <> "" && not (List.mem rel fluents) && not (List.mem_assoc rel game.Arena.defined_rels) && not (List.exists (fun (_,(rel2,_)) -> rel2=rel) equivalent) && @@ -195,7 +278,7 @@ (* Also have to apply to LHS structures... Don't use {!ContinuousRule.apply_to_sides} as we don't need to recompile. *) - (* 1a *) + (* 1c *) let map_rhs rhs = Structure.clear_rels rhs removable in let game = {game with @@ -216,9 +299,9 @@ let tups = try Structure.StringMap.find rel lhs_struc.Structure.relations - with Not_found -> Structure.Tuples.empty in + with Not_found -> Tups.empty in if removable rel && - not (Structure.Tuples.is_empty tups) && + not (Tups.is_empty tups) && snd (List.assoc rel equivalent) (* is complement *) then ( (* {{{ log entry *) @@ -236,10 +319,10 @@ Aux.unique_sorted (kept_emb_rels @ added_emb_rels) in let new_emb_rels = Aux.list_diff added_emb_rels kept_emb_rels in - let ltups = Structure.Tuples.elements in + let ltups = Tups.elements in let lhs_neg_tups = r.ContinuousRule.compiled.DiscreteRule.lhs_neg_tups in - (* 1a1: renaming removable relations to their originals *) + (* 1c1: renaming removable relations to their originals *) let lhs_struc = Structure.StringMap.fold (fun rel tups lhs_struc -> let spec = DiscreteRule.special_rel_of rel in @@ -254,13 +337,13 @@ match spec with | None -> orig | Some spec -> "_"^spec^"_"^orig in - if not neg (* 1a1 *) - || (neg && spec = Some "opt") (* not-1a2 *) + if not neg (* 1c1 *) + || (neg && spec = Some "opt") (* not-1c2 *) then Structure.add_rels lhs_struc orig (ltups tups) else if List.mem_assoc rel lhs_neg_tups && spec <> Some "opt" - then (* 1a3 *) + then (* 1c3 *) Structure.add_rels lhs_struc orig (List.assoc rel lhs_neg_tups) else lhs_struc @@ -327,7 +410,34 @@ let game = Arena.map_to_formulas (FormulaOps.remove_redundant ~implies) game in - (* 4 *) + (* 3 *) + let intersect_rels struc grel rels = + let rel_graphs = + List.map (fun rel -> + Structure.StringMap.find rel struc.Structure.relations) rels in + let graph = + match rel_graphs with + | [] -> assert false + | [tups] -> tups + | hd::tl -> + List.fold_left Tups.inter hd tl in + let tuples = Tups.elements graph in + Structure.add_rels struc grel tuples in + let intersect_with_inv struc grel rel1 rel2 = + let graph1 = + Structure.StringMap.find rel1 struc.Structure.relations in + let tuples2 = + Tups.elements + (Structure.StringMap.find rel2 struc.Structure.relations) in + let inv_graph = + Structure.tuples_of_list (List.map (function + | [|e1; e2|] -> [|e2; e1|] + | _ -> assert false) tuples2) in + let tuples = Tups.elements + (Tups.inter graph1 inv_graph) in + Structure.add_rels struc grel tuples in + + (* preparing (3a-b-c) *) let add_rel rel acc = match rel with | Rel (rel,_) -> Aux.Strings.add rel acc @@ -336,19 +446,215 @@ Arena.fold_over_formulas ~include_defined_rels:false (FormulaOps.fold_over_atoms add_rel) game Aux.Strings.empty in + let used_rels = ref used_rels in + let struc = ref state.Arena.struc in + let signat = ref signat in + let glued = ref [] in (* bindings introduced by [glue] *) + let glued_inv = ref [] in (* bingings introduced by [glue_inv] *) + (* 3a *) + let glue rels = + let args_keys = + Aux.collect (List.map (fun (rel,args)->args,rel) rels) in + List.map (function + | args, [rel] -> rel, args + | args, rels -> + let rels = List.sort String.compare rels in + (let try grel = Aux.rev_assoc !glued rels in + grel, args + with Not_found -> + let grel = + Aux.not_conflicting_name ~truncate:true !used_rels "R" in + used_rels := Aux.Strings.add grel !used_rels; + glued := (grel, rels) :: !glued; + struc := intersect_rels !struc grel rels; + signat := (grel, Array.length args) :: !signat; + grel, args) + ) args_keys in + (* 3b *) + let glue_inv rels = + (* there are no ambiguities because equal-args rels have been + collected by (3a) *) + let rels = List.map (fun (rel,args) -> args,rel) rels in + let rec loop = function + | ([|arg1;arg2|] as args1, rel1)::more -> + let args2 = [|arg2; arg1|] in + if List.mem_assoc args2 more + then + let rel2, more = Aux.pop_assoc args2 more in + let rels = + if rel1 < rel2 then rel1, rel2 else rel2, rel1 in + let rel, args, inv_rel, inv_args = + if rel1 == fst rels + then rel1, args1, rel2, args2 + else rel2, args2, rel1, args1 in + (let try grel = Aux.rev_assoc !glued_inv rels in + (grel, args)::loop more + with Not_found -> + let grel = + Aux.not_conflicting_name ~truncate:true !used_rels "R" in + used_rels := Aux.Strings.add grel !used_rels; + glued_inv := (grel, rels) :: !glued_inv; + struc := intersect_with_inv !struc grel rel1 rel2; + signat := (grel, Array.length args) :: !signat; + (grel, args)::loop more) + else (rel1, args1)::loop more + | (args, rel)::rels -> (rel, args)::loop rels + | [] -> [] in + loop rels + in + (* the step of 3c *) + let gluable rel = + not (List.mem rel fluents) && + not (List.mem_assoc rel game.Arena.defined_rels) in + let glue_phi = + FormulaOps.map_formula {FormulaOps.identity_map with + FormulaOps.map_And = (fun conjs -> + let poslits, subtasks = + Aux.partition_map (function + | Rel (rel, args) when gluable rel -> Aux.Left (rel, args) + | phi -> Aux.Right phi) conjs in + let result = + List.map (fun (rel, args) -> Rel (rel, args)) + (glue_inv (glue poslits)) in + And (result @ subtasks)); + map_Or = (fun disjs -> + let neglits, subtasks = Aux.partition_map (function + | Not (Rel (rel,args)) when gluable rel -> Aux.Left (rel, args) + | phi -> Aux.Right phi) disjs in + let result = + List.map (fun (rel, args) -> Not (Rel (rel, args))) + (glue_inv (glue neglits)) in + Or (result @ subtasks))} in + (* 3c *) + let rec glue_fixpoint phi = + let old_used_rels = !used_rels in + let res = glue_phi (FormulaOps.flatten_formula phi) in + if old_used_rels == !used_rels then res + else glue_fixpoint res in + let game = + Arena.map_to_formulas glue_fixpoint game in + (* 3d *) + let more_data = + Aux.map_some (fun (crel, orig_rel) -> + if Aux.Strings.mem crel !used_rels then + Some (crel, "C__"^orig_rel) + else None) !complemented + @ List.map (fun (grel,crels) -> + grel, String.concat "__AND__" crels) !glued + @ List.map (fun (grel,(rel,inv_rel)) -> + grel, rel^"__AND_INV__"^inv_rel) !glued_inv in + (* {{{ log entry *) + if !debug_level > 1 then ( + Printf.printf "GameSimpl: new data\n%s\n%!" + (String.concat "\n" (List.map (fun (k,v)->k^" = "^v) more_data)) + ); + (* }}} *) + let game = {game with + Arena.data = more_data @ game.Arena.data} in + let state = {state with Arena.struc = !struc} in + let signat = !signat in + + (* 3e-3a *) + (* rather than keeping the unaffected relations/tuples, we only + return the replaced ones *) + let glue_lhs rels = + let args_keys = + Aux.collect (List.map (fun (rel,args)->args,rel) rels) in + Aux.map_some (function + | args, [rel] -> None + | args, rels -> + let rels = List.sort String.compare rels in + (try Some (Aux.rev_assoc !glued rels, rels, args) + with Not_found -> + Printf.printf "rels=%s\n%!" (String.concat ", " rels); + assert false) + ) args_keys in + (* 3e-3b *) + let glue_inv_lhs rels = + let rels = List.map (fun (rel,args) -> args,rel) rels in + let rec loop = function + | ([|arg1;arg2|] as args1, rel1)::more -> + let args2 = [|arg2; arg1|] in + if List.mem_assoc args2 more + then + let rel2, more = Aux.pop_assoc args2 more in + let rels = + if rel1 < rel2 then rel1, rel2 else rel2, rel1 in + let rel, args, inv_rel, inv_args = + if rel1 == fst rels + then rel1, args1, rel2, args2 + else rel2, args2, rel1, args1 in + (let try grel = Aux.rev_assoc !glued_inv rels in + (grel, rels, args, inv_args)::loop more + with Not_found -> assert false) + else loop more + | _::rels -> loop rels + | [] -> [] in + loop rels + in + (* 3e *) + let glue_struc lhs emb_rels = + let cands = Structure.StringMap.fold + (fun rel tups cands -> + if DiscreteRule.special_rel_of rel = None && gluable rel && + not (List.mem rel emb_rels) + then + List.map (fun tup->rel, tup) (Tups.elements tups) + @ cands + else cands) lhs.Structure.relations [] in + let result = glue_lhs cands in + let lhs, cands = List.fold_left + (fun (lhs, cands) (grel, rels, args) -> + let lhs = Structure.add_rel lhs grel args in + let lhs = List.fold_left (fun lhs drel -> + Structure.del_rel lhs drel args) lhs rels in + let cands = (grel, args):: + List.filter (fun (rel,_) -> not (List.mem rel rels)) cands in + lhs, cands + ) (lhs, cands) result in + let result = glue_inv_lhs cands in + List.fold_left + (fun lhs (grel, (rel1, rel2), args, inv_args) -> + let lhs = Structure.add_rel lhs grel args in + let lhs = Structure.del_rel lhs rel1 args in + let lhs = Structure.del_rel lhs rel2 inv_args in + lhs + ) lhs result in + let game = Arena.map_to_discrete + (fun r -> {r with DiscreteRule.lhs_struc = + glue_struc r.DiscreteRule.lhs_struc r.DiscreteRule.emb_rels}) + game in + + (* 4 *) + (* since relations relevant for LHS structures occur in the + "embedding formula", we can freely remove from all structures + static relations that do not occur in any formula *) + let used_rels = + Arena.fold_over_formulas ~include_defined_rels:false + (FormulaOps.fold_over_atoms add_rel) + game Aux.Strings.empty in let clear_rel rel = let rel = if DiscreteRule.special_rel_of rel = None then rel else DiscreteRule.orig_rel_of rel in let res = - not (List.mem_assoc rel game.Arena.defined_rels) && - not (Aux.Strings.mem rel used_rels) in + not (List.mem rel fluents) && + not (List.mem_assoc rel game.Arena.defined_rels) && + not (Aux.Strings.mem rel used_rels) in (* {{{ log entry *) if !debug_level > 2 && res then ( Printf.printf "GameSimpl: removing relation %s\n%!" rel ); (* }}} *) res in + let game = Arena.map_to_discrete + (fun r -> {r with DiscreteRule.emb_rels = + List.filter (not -| clear_rel) r.DiscreteRule.emb_rels}) + game in Arena.map_to_structures - (fun struc -> Structure.clear_rels struc clear_rel) + (fun struc -> + let struc = + List.fold_left (fun struc (rel, arity) -> + Structure.add_rel_name rel arity struc) struc signat in + Structure.clear_rels struc clear_rel) (game, state) Modified: trunk/Toss/GGP/GameSimpl.mli =================================================================== --- trunk/Toss/GGP/GameSimpl.mli 2011-03-17 18:58:07 UTC (rev 1365) +++ trunk/Toss/GGP/GameSimpl.mli 2011-03-17 22:03:28 UTC (rev 1366) @@ -10,5 +10,5 @@ good heuristic. Very crude for now, not using the structure yet. *) val niceness : Formula.formula -> int -val simplify : ?join_rel_names:(string -> string -> string) -> +val simplify : Arena.game * Arena.game_state -> Arena.game * Arena.game_state Modified: trunk/Toss/GGP/GameSimplTest.ml =================================================================== --- trunk/Toss/GGP/GameSimplTest.ml 2011-03-17 18:58:07 UTC (rev 1365) +++ trunk/Toss/GGP/GameSimplTest.ml 2011-03-17 22:03:28 UTC (rev 1366) @@ -48,7 +48,7 @@ ] -let a = +let a = Aux.run_test_if_target "GameSimplTest" tests let a () = Modified: trunk/Toss/GGP/tests/breakthrough-raw.toss =================================================================== --- trunk/Toss/GGP/tests/breakthrough-raw.toss 2011-03-17 18:58:07 UTC (rev 1365) +++ trunk/Toss/GGP/tests/breakthrough-raw.toss 2011-03-17 22:03:28 UTC (rev 1366) @@ -1,4 +1,5 @@ PLAYERS white, black +DATA RULE move_x1_y1_x2_y2_0: [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | _opt_cellholds_x2_y2_black { @@ -31,23 +32,19 @@ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and index__cellholds_x2_y2_MV1_x2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and not - not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and - not ex cellholds_x376_1__blank_ (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and index__cellholds_x2_y2_MV1_x2(cellholds_x376_1__blank_) and cellholds_x2_y2_black(cellholds_x376_1__blank_)) and - not - not - ex cellholds_x377_y369__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and - cellholds_x2_y2_white(cellholds_x377_y369__blank_))) + ex cellholds_x377_y369__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and + cellholds_x2_y2_white(cellholds_x377_y369__blank_))) RULE move_x1_y1_x2_y2_00: [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | _opt_cellholds_x2_y2_black { @@ -80,27 +77,25 @@ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and index__cellholds_x2_y2_MV1_x2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and not - not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and - not ex cellholds_x376_1__blank_ (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and index__cellholds_x2_y2_MV1_x2(cellholds_x376_1__blank_) and cellholds_x2_y2_black(cellholds_x376_1__blank_)) and - not - not - ex cellholds_x377_y369__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and - cellholds_x2_y2_white(cellholds_x377_y369__blank_))) + ex cellholds_x377_y369__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and + cellholds_x2_y2_white(cellholds_x377_y369__blank_))) RULE move_x_y1_x_y2_0: [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | - EQ___cellholds_x2_y2_MV1_x2 + EQ___cellholds_x2_y2_MV1_x2 { (cellholds_x_y1__blank_, cellholds_x_y2__blank_); + (cellholds_x_y2__blank_, cellholds_x_y1__blank_) + }; _opt_cellholds_x2_y2_black {cellholds_x_y1__blank_; control__blank_}; _opt_cellholds_x2_y2_white (control__blank_); _opt_control_black {cellholds_x_y1__blank_; cellholds_x_y2__blank_}; @@ -128,23 +123,19 @@ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and index__cellholds_x2_y2_MV1_x2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and not - not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and - not ex cellholds_x376_1__blank_ (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and index__cellholds_x2_y2_MV1_x2(cellholds_x376_1__blank_) and cellholds_x2_y2_black(cellholds_x376_1__blank_)) and - not - not - ex cellholds_x377_y369__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and - cellholds_x2_y2_white(cellholds_x377_y369__blank_))) + ex cellholds_x377_y369__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and + cellholds_x2_y2_white(cellholds_x377_y369__blank_))) RULE move_x1_y1_x2_y2_1: [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | _opt_cellholds_x2_y2_black (control__blank_); @@ -177,23 +168,19 @@ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and index__cellholds_x2_y2_MV1_x2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and not - not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and - not ex cellholds_x376_1__blank_ (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and index__cellholds_x2_y2_MV1_x2(cellholds_x376_1__blank_) and cellholds_x2_y2_black(cellholds_x376_1__blank_)) and - not - not - ex cellholds_x377_y369__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and - cellholds_x2_y2_white(cellholds_x377_y369__blank_))) + ex cellholds_x377_y369__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and + cellholds_x2_y2_white(cellholds_x377_y369__blank_))) RULE move_x1_y1_x2_y2_10: [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | _opt_cellholds_x2_y2_black (control__blank_); @@ -226,27 +213,25 @@ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and index__cellholds_x2_y2_MV1_x2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and not - not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and - not ex cellholds_x376_1__blank_ (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and index__cellholds_x2_y2_MV1_x2(cellholds_x376_1__blank_) and cellholds_x2_y2_black(cellholds_x376_1__blank_)) and - not - not - ex cellholds_x377_y369__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and - cellholds_x2_y2_white(cellholds_x377_y369__blank_))) + ex cellholds_x377_y369__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and + cellholds_x2_y2_white(cellholds_x377_y369__blank_))) RULE move_x_y1_x_y2_1: [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | - EQ___cellholds_x2_y2_MV1_x2 + EQ___cellholds_x2_y2_MV1_x2 { (cellholds_x_y1__blank_, cellholds_x_y2__blank_); + (cellholds_x_y2__blank_, cellholds_x_y1__blank_) + }; _opt_cellholds_x2_y2_black (control__blank_); _opt_cellholds_x2_y2_white {cellholds_x_y1__blank_; control__blank_}; _opt_control_black {cellholds_x_y1__blank_; cellholds_x_y2__blank_}; @@ -274,23 +259,19 @@ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and index__cellholds_x2_y2_MV1_x2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and not - not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and - not ex cellholds_x376_1__blank_ (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and index__cellholds_x2_y2_MV1_x2(cellholds_x376_1__blank_) and cellholds_x2_y2_black(cellholds_x376_1__blank_)) and - not - not - ex cellholds_x377_y369__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and - cellholds_x2_y2_white(cellholds_x377_y369__blank_))) + ex cellholds_x377_y369__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and + cellholds_x2_y2_white(cellholds_x377_y369__blank_))) LOC 0 { PLAYER white PAYOFF { Modified: trunk/Toss/GGP/tests/breakthrough-simpl.toss =================================================================== --- trunk/Toss/GGP/tests/breakthrough-simpl.toss 2011-03-17 18:58:07 UTC (rev 1365) +++ trunk/Toss/GGP/tests/breakthrough-simpl.toss 2011-03-17 22:03:28 UTC (rev 1366) @@ -1,19 +1,22 @@ PLAYERS white, black +DATA + R1: + EQ___cellholds_x2_y2_MV1_x2__AND__succ__cellholds_x2_y2_MV1_y2__cellholds_x2_y2_MV1_y2, + R0: + succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_x2__AND__succ__cellholds_x2_y2_MV1_y2__cellholds_x2_y2_MV1_y2, + R2: EQ___cellholds_x2_y2_MV1_x2__AND_INV__R1, + R: + succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_x2__AND_INV__succ__cellholds_x2_y2_MV1_y2__cellholds_x2_y2_MV1_y2 RULE move_x1_y1_x2_y2_0: [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | + R (cellholds_x2_y2__blank_, cellholds_x1_y1__blank_); _opt_cellholds_x2_y2_black { cellholds_x1_y1__blank_; cellholds_x2_y2__blank_; control__blank_}; _opt_cellholds_x2_y2_white (control__blank_); _opt_control_black {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; _opt_control_white {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; cellholds_x2_y2_white (cellholds_x1_y1__blank_); - control_white (control__blank_); - index__cellholds_x2_y2_MV1_y2 { - cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; - succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_x2 - (cellholds_x2_y2__blank_, cellholds_x1_y1__blank_); - succ__cellholds_x2_y2_MV1_y2__cellholds_x2_y2_MV1_y2 - (cellholds_x1_y1__blank_, cellholds_x2_y2__blank_) + control_white (control__blank_) | ] -> [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | @@ -27,32 +30,29 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and + not control_MV1(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and + (cellholds_x2_y2_black(cellholds_x375_y368__blank_) and + not control_MV1(cellholds_x375_y368__blank_)) and not ex cellholds_x376_1__blank_ (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and + not control_MV1(cellholds_x376_1__blank_) and cellholds_x2_y2_black(cellholds_x376_1__blank_)) and ex cellholds_x377_y369__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - cellholds_x2_y2_white(cellholds_x377_y369__blank_))) + (cellholds_x2_y2_white(cellholds_x377_y369__blank_) and + not control_MV1(cellholds_x377_y369__blank_))) RULE move_x1_y1_x2_y2_00: [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | + R0 (cellholds_x1_y1__blank_, cellholds_x2_y2__blank_); _opt_cellholds_x2_y2_black { cellholds_x1_y1__blank_; cellholds_x2_y2__blank_; control__blank_}; _opt_cellholds_x2_y2_white (control__blank_); _opt_control_black {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; _opt_control_white {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; cellholds_x2_y2_white (cellholds_x1_y1__blank_); - control_white (control__blank_); - index__cellholds_x2_y2_MV1_y2 { - cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; - succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_x2 - (cellholds_x1_y1__blank_, cellholds_x2_y2__blank_); - succ__cellholds_x2_y2_MV1_y2__cellholds_x2_y2_MV1_y2 - (cellholds_x1_y1__blank_, cellholds_x2_y2__blank_) + control_white (control__blank_) | ] -> [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | @@ -66,37 +66,32 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and + not control_MV1(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and + (cellholds_x2_y2_black(cellholds_x375_y368__blank_) and + not control_MV1(cellholds_x375_y368__blank_)) and not ex cellholds_x376_1__blank_ (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and + not control_MV1(cellholds_x376_1__blank_) and cellholds_x2_y2_black(cellholds_x376_1__blank_)) and ex cellholds_x377_y369__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - cellholds_x2_y2_white(cellholds_x377_y369__blank_))) -RULE move_x1_y1_x2_y2_1: - [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | - _opt_cellholds_x2_y2_black (control__blank_); - _opt_cellholds_x2_y2_white { - cellholds_x1_y1__blank_; cellholds_x2_y2__blank_; control__blank_}; - _opt_control_black {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; - _opt_control_white {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; - cellholds_x2_y2_black (cellholds_x1_y1__blank_); - control_black (control__blank_); - index__cellholds_x2_y2_MV1_y2 { - cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; - succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_x2 - (cellholds_x2_y2__blank_, cellholds_x1_y1__blank_); - succ__cellholds_x2_y2_MV1_y2__cellholds_x2_y2_MV1_y2 - (cellholds_x2_y2__blank_, cellholds_x1_y1__blank_) + (cellholds_x2_y2_white(cellholds_x377_y369__blank_) and + not control_MV1(cellholds_x377_y369__blank_))) +RULE move_x_y1_x_y2_0: + [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | + _opt_cellholds_x2_y2_black {cellholds_x_y1__blank_; control__blank_}; + _opt_cellholds_x2_y2_white (control__blank_); + _opt_control_black {cellholds_x_y1__blank_; cellholds_x_y2__blank_}; + _opt_control_white {cellholds_x_y1__blank_; cellholds_x_y2__blank_}; + cellholds_x2_y2_white (cellholds_x_y1__blank_); + control_white (control__blank_) | ] -> - [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | - cellholds_x2_y2_black (cellholds_x2_y2__blank_); - control_white (control__blank_) + [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | + cellholds_x2_y2_white (cellholds_x_y2__blank_); + control_black (control__blank_) | ] emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, @@ -105,32 +100,29 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and + not control_MV1(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and + (cellholds_x2_y2_black(cellholds_x375_y368__blank_) and + not control_MV1(cellholds_x375_y368__blank_)) and not ex cellholds_x376_1__blank_ (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and + not control_MV1(cellholds_x376_1__blank_) and cellholds_x2_y2_black(cellholds_x376_1__blank_)) and ex cellholds_x377_y369__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - cellholds_x2_y2_white(cellholds_x377_y369__blank_))) -RULE move_x1_y1_x2_y2_10: + (cellholds_x2_y2_white(cellholds_x377_y369__blank_) and + not control_MV1(cellholds_x377_y369__blank_))) +RULE move_x1_y1_x2_y2_1: [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | + R0 (cellholds_x2_y2__blank_, cellholds_x1_y1__blank_); _opt_cellholds_x2_y2_black (control__blank_); _opt_cellholds_x2_y2_white { cellholds_x1_y1__blank_; cellholds_x2_y2__blank_; control__blank_}; _opt_control_black {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; _opt_control_white {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; cellholds_x2_y2_black (cellholds_x1_y1__blank_); - control_black (control__blank_); - index__cellholds_x2_y2_MV1_y2 { - cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; - succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_x2 - (cellholds_x1_y1__blank_, cellholds_x2_y2__blank_); - succ__cellholds_x2_y2_MV1_y2__cellholds_x2_y2_MV1_y2 - (cellholds_x2_y2__blank_, cellholds_x1_y1__blank_) + control_black (control__blank_) | ] -> [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | @@ -144,36 +136,34 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and + not control_MV1(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - ... [truncated message content] |
From: <luk...@us...> - 2011-03-17 18:58:16
|
Revision: 1365 http://toss.svn.sourceforge.net/toss/?rev=1365&view=rev Author: lukaszkaiser Date: 2011-03-17 18:58:07 +0000 (Thu, 17 Mar 2011) Log Message: ----------- Adding bits of french translation. Modified Paths: -------------- trunk/Toss/www/contact.xml trunk/Toss/www/create.xml trunk/Toss/www/develop.xml trunk/Toss/www/docs.xml trunk/Toss/www/examples.xml trunk/Toss/www/gui_interface.xml trunk/Toss/www/ideas.xml trunk/Toss/www/index.xml trunk/Toss/www/navigation.xml trunk/Toss/www/play.xml trunk/Toss/www/xsl/publications.xsl Modified: trunk/Toss/www/contact.xml =================================================================== --- trunk/Toss/www/contact.xml 2011-03-16 16:04:48 UTC (rev 1364) +++ trunk/Toss/www/contact.xml 2011-03-17 18:58:07 UTC (rev 1365) @@ -7,6 +7,7 @@ <title lang="en">Contact and Links</title> <title lang="de">Kontakt und Links</title> <title lang="pl">Kontakt i Linki</title> + <title lang="fr">Contact et Liens</title> <history> <link id="contact" href="/contact.html">Contact</link> </history> @@ -37,6 +38,14 @@ <mailto address="tos...@li..."/>. </par> </section> + <section title="Email" lang="fr"> + <par>Toss is an open source project hosted by + <a href="http://sourceforge.net">SourceForge</a> + and distributed under the BSD licence.<br/></par> + <par>Contact us by writing to: + <mailto address="tos...@li..."/> + </par> + </section> <section title="Toss Links" lang="en"> <itemize> Modified: trunk/Toss/www/create.xml =================================================================== --- trunk/Toss/www/create.xml 2011-03-16 16:04:48 UTC (rev 1364) +++ trunk/Toss/www/create.xml 2011-03-17 18:58:07 UTC (rev 1365) @@ -7,6 +7,7 @@ <title lang="en">Create New Games</title> <title lang="de">Neue Spiele Erzeugen</title> <title lang="pl">Stwórz Nową Grę</title> + <title lang="fr">Créez de Nouveaux Jeux</title> <history> <link id="create" href="/create.html">Create</link> </history> @@ -53,6 +54,21 @@ bezpośrednio edytować pliki .toss w edytorze tekstu.</par> </section> + <section title="Deux Façons de Créer un Nouveau Jeu" lang="fr"> + <par>Si vous avez fini de jouer les jeux déjà définis dans Toss, + il est temps de commencer le vrai plaisir – créez votre propre jeu! + Il y a deux façons de créer un jeu dans Toss.</par> + <itemize> + <item>Vous pouvez utiliser l'interface graphique pour éditer + et créer des jeux.</item> + <item>Vous pouvez éditer les fichiers .toss directement.</item> + </itemize> + <par>Si vous prévoyez de faire de petits changements ou une jeu facile, + l'interface graphique pourrait être la meilleure option. Pour les + grandes ou complètement nouveaux jeux, il est plus commode de modifier + les fichiers dans votre éditeur de texte favori.</par> + </section> + <section title="Creating Games the in the Toss GUI" lang="en"> <par>To start the Toss GUI do the following.</par> @@ -70,7 +86,6 @@ several other features.<br/></par> <par><br/><toss-video/></par> </section> - <section title="Spiele im Toss GUI Erzeugen" lang="de"> <par>Um die Toss GUI zu starten, muss man:</par> <itemize> @@ -87,8 +102,6 @@ definiert und wo auch andere Features erklärt sind.<br/></par> <par><br/><toss-video/></par> </section> - - <section title="Tworzenie Gier w Interfejsie Graficznym Tossa" lang="pl"> <par>Aby uruchomić interfejs graficzny Tossa:</par> <itemize> @@ -105,6 +118,24 @@ a także wyjaśnione niektóre bardziej zaawansowane możliwości.<br/></par> <par><br/><toss-video/></par> </section> + <section title="Créer des Jeux dans l'Interface Graphique de Toss" lang="fr"> + <par>Pour démarrer l'interface graphique de Toss, procédez comme suit.</par> + <itemize> + <item><em>Téléchargez</em> Toss sur la + <a href="http://sourceforge.net/project/showfiles.php?group_id=115606"> + SourceForge Télécharger Site</a>.</item> + <item><em>Exécutez Toss</em> en cliquant <em>Toss.py</em>. + Vous pouvez commencer par l'ouverture d'un fichier dans du répertoire + <em>examples</em>.</item> + </itemize> + <par> + Lorsque vous avez le bon GUI, nous vous recommandons de regarder le + <a href="http://vimeo.com/10110495">Toss Tutoriel</a> ci-dessous, + qui montre toutes les étapes nécessaires pour définir un jeu simple + en Toss et explique plusieurs autres fonctions. + <br/></par> + <par><br/><toss-video/></par> + </section> <section title="Creating Games in your Text Editor" lang="en"> @@ -122,7 +153,6 @@ <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Tic-Tac-Toe.toss?revision=1349">Tic-Tac-Toe</a></item> </itemize> </section> - <section title="Spiele in Text Form erschaffen" lang="de"> <par>Wir glauben, dass es für kompliziertere Spiele einfacher ist, ein Texteditor zu benutzen als die Toss GUI immer zu starten. @@ -140,7 +170,6 @@ <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Tic-Tac-Toe.toss?revision=1349">Tic-Tac-Toe</a></item> </itemize> </section> - <section title="Tworzenie Gier w Edytorze Tekstu" lang="pl"> <par>Gdy gry stają się bardziej skomplikowane, łatwiej bezpośrednio edytować pliki .toss niż za każdym razem uruchamiać GUI Tossa. @@ -157,6 +186,21 @@ <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Tic-Tac-Toe.toss?revision=1349">Tic-Tac-Toe</a></item> </itemize> </section> + <section title="La Création de Jeux dans l'Éditeur de Texte" lang="fr"> + <par>Pour les plus grands jeux, nous trouvons qu'il est plus facile de + les modifier dans le texte forme que avec l'interface graphique. Pour + comprendre la signification de texte dans les fichiers .toss, vous + devriez se familiariser avec Toss (par exemple passer par le tutoriel + ci-dessus) et au moins parcourir + <a href="reference/reference.pdf">Reference.pdf</a>, regardez à notre + <a href="docs.html">documentation</a>. Après cela, vous pouvez simplement + éditer le fichier .toss, peut-être en commençant par l'un de ces. + </par> + <itemize> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Breakthrough.toss?revision=1349">Breakthrough</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Chess.toss?revision=1349">Chess</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Tic-Tac-Toe.toss?revision=1349">Tic-Tac-Toe</a></item> + </itemize> + </section> - </personal> Modified: trunk/Toss/www/develop.xml =================================================================== --- trunk/Toss/www/develop.xml 2011-03-16 16:04:48 UTC (rev 1364) +++ trunk/Toss/www/develop.xml 2011-03-17 18:58:07 UTC (rev 1365) @@ -7,6 +7,7 @@ <title lang="en">Develop Toss</title> <title lang="de">Toss Ausbauen</title> <title lang="pl">Programuj Tossa</title> + <title lang="fr">Développez Toss</title> <history> <link id="develop" href="/develop.html">Develop Toss</link> </history> @@ -89,8 +90,34 @@ zadziałało.</item> </itemize> </section> + <section title="Préparation" lang="fr"> + <itemize> + <item>Sauf les interfaces, le Toss est programmé en + <a href="http://caml.inria.fr/">Objective Caml</a>. + Vous avez besoin d'une bonne compréhension de OCaml et + une installation complète OCaml de travailler sur le Toss. + </item> + <item>Toss <em>build system</em> est basé sur <em>ocamlbuild</em> + et utilise <em>Makefiles</em> pour la compilation des parties C. + Vous avez besoin d'un système qui a ceci à construire Toss. + </item> + <item>Si vous souhaitez développer Toss sur Ubuntu, voici + une commande avec une liste des paquets à installer. + <br/> + sudo apt-get install g++ python-qt4 python-dev pyqt4-dev-tools + ocaml-findlib menhir libounit-ocaml-dev libapache2-mod-python + sqlite3 python-pysqlite2 + </item> + <item>Cette commande checkout du + <a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/">Toss + SVN Repository</a> dans le répertoire <em>Toss</em>.<br/> + svn co https://toss.svn.sourceforge.net/svnroot/toss/trunk/Toss Toss + </item> + <item>Dans le répertoire Toss exécuter <em>make</em> et vérifier + que c'est bien.</item> + </itemize> + </section> - <section title="Understanding Toss" lang="en"> <itemize> <item><a href="create.html">Create</a> at least one simple game @@ -133,6 +160,21 @@ można dowiedzieć się, skąd czerpaliśmy pomysły w Tossie.</item> </itemize> </section> + <section title="Comprendre Toss" lang="fr"> + <itemize> + <item><a href="create.html">Créez</a> au moins un jeu simple + pour commencer.</item> + <item>Familiarisez-vous avec la <a href="docs.html">documentation + Toss</a>. + </item> + <item>N'oubliez pas de lire le document + <a href="reference/reference.pdf">reference.pdf</a>.</item> + <item>Si vous commencez à regarder le code, vous pourriez trouver la + <a href="code_doc/">documentation des interfaces</a> pratique.</item> + <item>Parcourir les <a href="Publications/">papiers et entretiens</a> + sur Toss pour comprendre d'où viennent les idées.</item> + </itemize> + </section> <section title="Working with the Toss Team" lang="en"> @@ -143,11 +185,11 @@ <itemize> <item>Toss Mailing List: <mailto address="tos...@li..."/></item> - <item>Łukasz Kaiser: + <item>Łukasz Kaiser: <mailto address="luk...@gm..."/></item> - <item>Łukasz Stafiniak: + <item>Łukasz Stafiniak: <mailto address="luk...@gm..."/></item> - <item>Michał Wójcik: + <item>Michał Wójcik: <mailto address="mic...@gm..."/></item> </itemize> </section> @@ -160,11 +202,11 @@ <itemize> <item>Toss Mailingliste: <mailto address="tos...@li..."/></item> - <item>Łukasz Kaiser: + <item>Łukasz Kaiser: <mailto address="luk...@gm..."/></item> - <item>Łukasz Stafiniak: + <item>Łukasz Stafiniak: <mailto address="luk...@gm..."/></item> - <item>Michał Wójcik: + <item>Michał Wójcik: <mailto address="mic...@gm..."/></item> </itemize> </section> @@ -177,13 +219,30 @@ <itemize> <item>Lista mailingowa Tossa: <mailto address="tos...@li..."/></item> - <item>Łukasz Kaiser: + <item>Łukasz Kaiser: <mailto address="luk...@gm..."/></item> - <item>Łukasz Stafiniak: + <item>Łukasz Stafiniak: <mailto address="luk...@gm..."/></item> - <item>Michał Wójcik: + <item>Michał Wójcik: <mailto address="mic...@gm..."/></item> </itemize> </section> + <section title="Travailler avec l'Équipe de Toss" lang="fr"> + <par>Si vous avez une idée, une demande, vous voulez devenir un développeur + ou tout simplement voudrais parler, contactez-nous! Les développeurs + Toss de plus engagés répondre aux questions Toss sur leur e-mails privés + (ci-dessous), mais <em>toss-devel</em> est l'adresse que nous préférons. + </par> + <itemize> + <item>Liste de diffusion de Toss: + <mailto address="tos...@li..."/></item> + <item>Łukasz Kaiser: + <mailto address="luk...@gm..."/></item> + <item>Łukasz Stafiniak: + <mailto address="luk...@gm..."/></item> + <item>Michał Wójcik: + <mailto address="mic...@gm..."/></item> + </itemize> + </section> </personal> Modified: trunk/Toss/www/docs.xml =================================================================== --- trunk/Toss/www/docs.xml 2011-03-16 16:04:48 UTC (rev 1364) +++ trunk/Toss/www/docs.xml 2011-03-17 18:58:07 UTC (rev 1365) @@ -7,6 +7,7 @@ <title lang="en">Documentation</title> <title lang="de">Dokumentation</title> <title lang="pl">Dokumentacja</title> + <title lang="fr">Documentation</title> <history> <link id="docs" href="/docs.html">Documentation</link> </history> @@ -17,20 +18,25 @@ or just watch the video tutorial below to get started.<br/></par> <par><br/><toss-video/></par> </section> - <section title="Toss Benutzen" lang="de"> <par>Um zu lehrnen wie man Toss benutzt um neue Spiele zu erschaffen, besuche die <a href="create.html">Neue Spiele Erzeugen</a> Seite oder fange schnell an mit dem Video Tutorial unten.<br/></par> <par><br/><toss-video/></par> </section> - <section title="Używanie Tossa" lang="pl"> <par>Żeby nauczyć się tworzyć gry w Tossie najlepiej odwiedzić stronę o <a href="create.html">Tworzeniu Nowych Gier</a> albo szybko obejrzeć poniższy tutorial.<br/></par> <par><br/><toss-video/></par> </section> + <section title="Utilisation de Toss" lang="fr"> + <par>Si vous voulez apprendre à utiliser Toss pour créer des jeux, + aller à la <a href="create.html">Créez des Jeux</a> site ou + simplement regarder la vidéo tutoriel ci-dessous pour commencer. + <br/></par> + <par><br/><toss-video/></par> + </section> <section title="Reference" lang="en"> @@ -58,6 +64,14 @@ <a href="reference/">html</a> w niższej jakości też jest dostępna gdy trzeba coś szybko sprawdzić.</par> </section> + <section title="Référence" lang="fr"> + <par>Le Toss Design et Spécification est un document dans lequel nous + essayons de décrire le modèle mathématique de Toss et les idées + principales utilisées dans Toss. Le document est le meilleur lire + comme <a href="reference/reference.pdf">Reference.pdf</a>, mais + une <a href="reference/">version html</a> est disponible ainsi, + pour vérifier les faits rapidement.</par> + </section> <section title="Code Documentation" lang="en"> @@ -79,6 +93,13 @@ ocamldoca</a>. To najbardziej aktualna informacja o kodzie Tossa, naszych modułach i ich interfejsach. </section> + <section title="Documentation du Code" lang="fr"> + Nous générons <a href="code_doc/">la documentation à des commentaires + de code</a> en utilisant + <a href="http://caml.inria.fr/pub/docs/manual-ocaml/manual029.html"> + ocamldoc</a>. Il donne des informations plus actualisées sur notre + code, modules et de leurs interfaces. + </section> <section title="Scientific Background of Toss" lang="en"> @@ -109,7 +130,6 @@ </itemize> </section> - <section title="Mathematische Grundlagen von Toss" lang="de"> <par>Um mehr über Toss zu erfahren, folge diese Links.</par> <itemize> @@ -164,4 +184,32 @@ </itemize> </section> + <section title="Contexte Scientifique de Toss" lang="fr"> + <par>Pour en savoir plus sur le contexte mathématique et + la conception de Toss, utiliser les liens suivants.</par> + <itemize> + <item><em>Description compacte</em> du modèle mathématique de Toss + et notre algorithme jouer UCT peuvent être trouvées dans le document + <a href="pub/playing_structure_rewriting_games.pdf">Playing + Structure Rewriting Games</a>. + </item> + + <item><em>Complexité</em> d'un fragment syntaxique du Toss a été analysée + dans le papier <a href="pub/graph_games_short.pdf">Synthesis + for Structure Rewriting Systems</a>. + </item> + + <item><em>Présentation</em> sur les mathématiques du Toss a été donné + sur <em>IIT Kanpur</em> et est + <a href="http://www2.cse.iitk.ac.in/~fsttcs/2009/videos/star/LukaszKaiser.avi"> + en ligne</a>. + </item> + + <item><em>Courte présentation</em> concentre sur AI a été donné + à <em>AGI 2010</em> et est + <a href="http://www.vimeo.com/15326245">en ligne</a> aussi. + </item> + </itemize> + </section> + </personal> Modified: trunk/Toss/www/examples.xml =================================================================== --- trunk/Toss/www/examples.xml 2011-03-16 16:04:48 UTC (rev 1364) +++ trunk/Toss/www/examples.xml 2011-03-17 18:58:07 UTC (rev 1365) @@ -7,6 +7,7 @@ <title lang="en">Examples</title> <title lang="de">Beispiele</title> <title lang="pl">Przykłady</title> + <title lang="fr">Exemples</title> <history> <link id="create" href="/create.html">Create New Games</link> <link id="examples" href="/examples.html">Examples</link> @@ -26,7 +27,6 @@ <image src="tic_tac_toe_screen_small.png" /> </a> </section> - <section title="Drei Gewinnt (Tic-Tac-Toe)" lang="de"> <par>Tic-Tac-Toe ist das einfachste Spiel in Toss. Die Spieler müssen nur die P und Q Prädikate an leere Positionen @@ -41,7 +41,6 @@ <image src="tic_tac_toe_screen_small.png" /> </a> </section> - <section title="Kółko i Krzyżyk (Tic-Tac-Toe)" lang="pl"> <par>Kółko i Krzyżyk to jedna z najprostszych gier w Tossie. Gracze muszą tylko używac predykatów P i Q i wstawiać je na @@ -56,8 +55,20 @@ <image src="tic_tac_toe_screen_small.png" /> </a> </section> + <section title="Tic-Tac-Toe" lang="fr"> + <par>Nous utilisons des Tic-Tac-Toe comme un exemple plus simple d'un jeu. + Les joueurs jouent en attribuant P et Q à des postes en blanc et + la condition de gain est donné comme une formule. Vous pouvez cliquer + sur <i>Hint</i> pour obtenir une suggestion de Toss.</par> + <itemize> + <item><em>(1) Tic-Tac-Toe.</em> + Le jeu Tic-Tac-Toe modélisés en utilisant d'une structure.</item> + </itemize> + <a href="tic_tac_toe_screen.png"> + <image src="tic_tac_toe_screen_small.png" /> + </a> + </section> - <section title="Basic Board Games" lang="en"> <par>Here are more examples of board games which you can construct with the Toss GUI easily.</par> @@ -72,7 +83,6 @@ <a href="imgs/breakthrough_screen.png"> <image src="breakthrough_screen_small.png" /></a> </section> - <section title="Einfache Brettspiele" lang="de"> <par>Hier geben wir einige andere Beispiele von Brettspiele, die man leicht in Toss GUI erschaffen kann.</par> @@ -87,7 +97,6 @@ <a href="imgs/breakthrough_screen.png"> <image src="breakthrough_screen_small.png" /></a> </section> - <section title="Proste Gry Planszowe" lang="pl"> <par>Kilka dalszych przykładów gier planszowych które łatwo stworzyć w GUI Tossa.</par> @@ -102,6 +111,20 @@ <a href="imgs/breakthrough_screen.png"> <image src="breakthrough_screen_small.png" /></a> </section> + <section title="Jeux Simple" lang="fr"> + <par>Voici d'autres exemples de jeux que vous pouvez construire + facilement avec l'interface graphique Toss.</par> + <itemize> + <item><em>(2) Gomoku.</em> + C'est Gomoku (Connectez-5) joué sur un plateau de 8x8.</item> + <item><em>(3) Breakthrough.</em> + Standard Breakthrough jeu.</item> + </itemize> + <a href="imgs/gomoku_screen.png"> + <image src="gomoku_screen_small.png" /></a> + <a href="imgs/breakthrough_screen.png"> + <image src="breakthrough_screen_small.png" /></a> + </section> <section title="More Complex Games" lang="en"> @@ -111,20 +134,27 @@ games defined in Toss. You can them use as a starting point for your own definitions.</par> </section> - <section title="Kompliziertere Spiele" lang="de"> <par>Um kompliziertere Spiele, wie Schach, zu definieren, kann es bequemer sein, direkt die text Files (.toss) zu bearbeiten. Unten geben wir die .toss Files für einige der Standardspiele an. Man kann diese Files auch als Anfangspunkt für eigene Spiele nutzen.</par> </section> - <section title="Bardziej Złożone Gry" lang="pl"> <par>Gdy definiuje się w Tossie bardziej złożone gry, takie jak szachy, wygodniej edytować bezpośrednio pliki .toss niż używać tylko GUI. Poniżej podajemy pliki .toss dla kilku znanych gier, możesz ich też użyć jako podstawy do stworzenia własnej gry.</par> </section> + <section title="Jeux Plus Complexes" lang="fr"> + <par> + Pour créer des jeux plus complexes, comme les échecs, il peut être plus + pratique pour modifier directement le définition de jeu dans le fichier + textuels .toss, plutôt que d'utiliser seulement l'interface graphique. + Voici quelques jeux définies dans Toss. Vous pouvez les utiliser comme + le point de départ pour vos propres définitions. + </par> + </section> <section> <itemize> Modified: trunk/Toss/www/gui_interface.xml =================================================================== --- trunk/Toss/www/gui_interface.xml 2011-03-16 16:04:48 UTC (rev 1364) +++ trunk/Toss/www/gui_interface.xml 2011-03-17 18:58:07 UTC (rev 1365) @@ -5,8 +5,9 @@ <personal> <title lang="en">GUI Interface Guide</title> - <title lang="de">GUI Interface Guide</title> - <title lang="pl">GUI Interface Guide</title> + <title lang="de">GUI Interface Guide (auf Englisch)</title> + <title lang="pl">GUI Interface Guide (po angielsku)</title> + <title lang="fr">Guide de Interface Graphique (à anglais)</title> <history> <link id="create" href="/create.html">Create New Games</link> <link id="examples" href="/examples.html">Examples</link> Modified: trunk/Toss/www/ideas.xml =================================================================== --- trunk/Toss/www/ideas.xml 2011-03-16 16:04:48 UTC (rev 1364) +++ trunk/Toss/www/ideas.xml 2011-03-17 18:58:07 UTC (rev 1365) @@ -5,7 +5,9 @@ <personal> <title lang="en">GSoC Ideas</title> - <title lang="de">GSoC Ideen</title> + <title lang="de">GSoC Ideen (auf Englisch)</title> + <title lang="pl">Pomysły na GSoC (po angielsku)</title> + <title lang="fr">Idées GSoC (à anglais)</title> <history> <link id="ideas" href="/ideas.html">GSoC Ideas</link> </history> Modified: trunk/Toss/www/index.xml =================================================================== --- trunk/Toss/www/index.xml 2011-03-16 16:04:48 UTC (rev 1364) +++ trunk/Toss/www/index.xml 2011-03-17 18:58:07 UTC (rev 1365) @@ -38,11 +38,14 @@ </par> </section> - <section title="À propos de Toss" lang="fr"> - <par><em>Toss</em> jest programem do tworzenia, analizowania - i grania w gry. Dzięki ogólnemu algorytmowi możesz stworzyc grę - i od razu zagrać w nią z komputerem. Na przykład, jak grałoby - się w szachy bez środka planszy? Z Tossem łatwo to sprawdzić! + <section title="À Propos de Toss" lang="fr"> + <par><em>Toss</em> est un programme pour créer, analyser + et jouer des jeux. Merci à un algorithme général, + vous pouvez jouer chaque jeu vous créez contre l'ordinateur. + Par exemple, avez-vous déjà demandé comment votre jeu préféré + se sentiraient si vous supprimez le milieu de la planche? + Avec Toss, il est facile de expérience! Et après votre jeu est + prêt, vous pouvez jouer en ligne et de rivaliser avec vos amis! </par> </section> @@ -91,7 +94,18 @@ <par><br/><toss-video/></par> </section> + <section title="Créez de Noveaux Jeux" lang="fr"> + <par>Le <a href="http://vimeo.com/10110495">Toss Tutoriel</a> ci-dessous + montre toutes les étapes nécessaires pour définir un jeu simple en Toss, + et il explique plusieurs autres caractéristiques aussi. Avec Toss, + vous pouvez réaliser de vos idées de jeu! + Visitez le site <a href="create.html">Créer des Jeux</a> pour en savoir + comment on construit de nouveaux jeux avec Toss. + <br/></par> + <par><br/><toss-video/></par> + </section> + <section title="Toss Features" lang="en"> <par>Games in Toss are defined as mathematical structures and moves by structure rewriting rules. Payoffs are given by formulas of monadic @@ -174,7 +188,34 @@ </itemize> </section> + <section title="Toss Fonctions" lang="fr"> + <par> + Les jeux Toss sont définis par des structures mathématiques et + par des règles de réécriture de structures. Les gains sont données par + des formules de la logique monadique du second ordre étendu par + des valeurs réelles.</par> + <itemize> + <item><em>Les Structures</em> peut avoir un nombre arbitraire de relations + de arité arbitraire et d'autres fonctions à valeurs réelles.</item> + <item><em>Les Règles</em> sont appliquées par correspondance de structure + à gauche de règle et leur remplacement par la structure à droite.</item> + <item><em>La Dynamique Continue</em> peut être spécifié en utilisant EDO. + Cela permet par exemple de simuler les mouvements et les collisions. + </item> + <item><em>Les Contraintes</em> peuvent être mis sur les règles, + y compris les preconditions, invariants et postconditions.</item> + <item><em>La Logique</em> est utilisé pour les contraintes et les + paiements. Nous utilisons la logique monadique du second ordre + avec l'arithmétique réelle supplémentaires.</item> + <item><em>Le Solveur</em> dans Toss est optimisé: il élimine + des quantificateurs et décompose les formules + (avec <a href="http://minisat.se/">MiniSat</a>).</item> + <item><em>Des Conseils</em> sont donnés dans tous les jeux merci à + notre algorithme général basé sur UCT ou Maximax.</item> + </itemize> + </section> + <section title="Scientific Background of Toss" lang="en"> <par>To learn more about the mathematical background and the design of Toss, use the following links.</par> @@ -269,4 +310,37 @@ </itemize> </section> + + <section title="Contexte Scientifique de Toss" lang="fr"> + <par>Pour en savoir plus sur le contexte mathématique et + la conception de Toss, utiliser les liens suivants.</par> + <itemize> + <item><em>Description compacte</em> du modèle mathématique de Toss + et notre algorithme jouer UCT peuvent être trouvées dans le document + <a href="pub/playing_structure_rewriting_games.pdf">Playing + Structure Rewriting Games</a>. + </item> + + <item><em>Conception et spécification</em> de Toss sont décrits dans + <a href="reference/reference.pdf">reference.pdf</a>. + </item> + + <item><em>Complexité</em> d'un fragment syntaxique du Toss a été analysée + dans le papier <a href="pub/graph_games_short.pdf">Synthesis + for Structure Rewriting Systems</a>. + </item> + + <item><em>Présentation</em> sur les mathématiques du Toss a été donné + sur <em>IIT Kanpur</em> et est + <a href="http://www2.cse.iitk.ac.in/~fsttcs/2009/videos/star/LukaszKaiser.avi"> + en ligne</a>. + </item> + + <item><em>Courte présentation</em> concentre sur AI a été donné + à <em>AGI 2010</em> et est + <a href="http://www.vimeo.com/15326245">en ligne</a> aussi. + </item> + </itemize> + </section> + </personal> Modified: trunk/Toss/www/navigation.xml =================================================================== --- trunk/Toss/www/navigation.xml 2011-03-16 16:04:48 UTC (rev 1364) +++ trunk/Toss/www/navigation.xml 2011-03-17 18:58:07 UTC (rev 1365) @@ -74,22 +74,23 @@ <menu lang="fr"> <item href="/" id="Home">Accueil</item> <item href="/ideas.html" id="ideas">Idées GSoC</item> - <item href="http://tplay.org">Graj Online</item> + <item href="http://tplay.org">Jouez en Ligne</item> <item href="http://sourceforge.net/project/showfiles.php?group_id=115606" - >Télécharger Toss</item> - <menu title="Créerez des Jeux" href="/create.html" id="create"> - <item href="http://vimeo.com/10110495" id="tut">Tutorial Video</item> - <item href="/examples.html" id="examples">Examples</item> - <item href="/gui_interface.html" id="gui_interface">Interface GUI</item> + >Téléchargez Toss</item> + <menu title="Créez des Jeux" href="/create.html" id="create"> + <item href="http://vimeo.com/10110495" id="tut">Vidéo Tutoriel</item> + <item href="/examples.html" id="examples">Exemples</item> + <item href="/gui_interface.html" id="gui_interface"> + Interface Graphique</item> </menu> - <item href="/play.html" id="play">Regarder Toss Jouer</item> + <item href="/play.html" id="play">Regardez Toss Jouer</item> <menu title="Documentation" href="/docs.html" id="docs"> <item href="/reference/reference.pdf" id="refpdf">Référence (pdf)</item> <item href="/reference/" id="refhtml">Référence (html)</item> <item href="/code_doc/" id="code">Documentation du Code</item> </menu> - <item href="/Publications/" id="Publications">Papers et Entretiens</item> - <item href="/develop.html" id="develop">Développer Toss</item> + <item href="/Publications/" id="Publications">Papiers, Entretiens</item> + <item href="/develop.html" id="develop">Développez Toss</item> <item href="/contact.html" id="contact">Contact et Liens</item> </menu> Modified: trunk/Toss/www/play.xml =================================================================== --- trunk/Toss/www/play.xml 2011-03-16 16:04:48 UTC (rev 1364) +++ trunk/Toss/www/play.xml 2011-03-17 18:58:07 UTC (rev 1365) @@ -7,6 +7,7 @@ <title lang="en">Watch Toss Play</title> <title lang="de">Wie Toss Spielt</title> <title lang="pl">Jak Toss Gra</title> + <title lang="fr">Regardez Toss Jouer</title> <history> <link id="play" href="/play.html">Toss Play</link> </history> @@ -27,7 +28,6 @@ we already have for games in the Toss format. Below we show a few of the games played by Toss against Fluxplayer on the Dresden Server. </section> - <section title="Allgemeines Spielen (General Game Playing)" lang="de"> <a href="http://en.wikipedia.org/wiki/General_Game_Playing">General Game Playing</a>, kurz GGP, fördert von einem Computer dass er @@ -45,7 +45,6 @@ Die Spiele im Toss-Format kann man dagegen direkt Online ansehen und spielen. Darunter zeigen wir einige Spiele von Toss gegen Fluxplayer. </section> - <section title="Ogólne Programy do Gier (General Game Playing)" lang="pl"> <a href="http://en.wikipedia.org/wiki/General_Game_Playing">General Game Playing</a> (GGP) to nazwa problemu w którym program komputerowy @@ -63,8 +62,24 @@ problemów, a kilka gier przeciwko dobremu programowi GGP (Fluxplayer) z serwera z Dresna zostalo przedstawionych ponizej. </section> + <section title="Jouer Générale (General Game Playing)" lang="fr"> + <a href="http://en.wikipedia.org/wiki/General_Game_Playing">General + Game Playing</a>, GGP, est un nom pour la tâche de jouer un jeu + jusque-là inconnues. GGP est actuellement un domaine populaire de l'IA, + avec des gens à <a href="http://games.stanford.edu/">Stanford</a> et en + <a href="http://www.general-game-playing.de/">Allemagne</a> à travailler + dessus. Les logiciels qui acceptent les jeux au format GDL peuvent jouer + sur le <a href="http://euklid.inf.tu-dresden.de:8180/ggpserver/"> + Dresden GGP Serveur</a> et Toss récemment commencé la compétition il ainsi. + <br/> + Jeux en format GDL ne sont pas directement adaptée à la présentation + en ligne, mais le <a href="http://code.google.com/p/ggp-galaxy/">GGP + Galaxy Project</a> a récemment commencé à travailler sur la mise + en ligne – le chose facile pour les jeux au format Toss. + Ci-dessous nous montrent quelques des matches joués par Toss + contre Fluxplayer sur le serveur de Dresden. + </section> - <section title="Breakthrough"> <itemize> <item><ggp-game match_id="breakthrough.1297045579170" Modified: trunk/Toss/www/xsl/publications.xsl =================================================================== --- trunk/Toss/www/xsl/publications.xsl 2011-03-16 16:04:48 UTC (rev 1364) +++ trunk/Toss/www/xsl/publications.xsl 2011-03-17 18:58:07 UTC (rev 1365) @@ -27,7 +27,7 @@ <h1 property="dc:title">Prace i Referaty</h1> </xsl:if> <xsl:if test="$lang='fr'"> - <h1 property="dc:title">Papers et Entretiens</h1> + <h1 property="dc:title">Papiers et Entretiens</h1> </xsl:if> <xsl:if test="document('../people.xml')/people/person[@id=$author]"> <xsl:variable name="fullname" select="normalize-space(concat(document('../people.xml')/people/person[@id=$author]/first,' ',document('../people.xml')/people/person[@id=$author]/last))"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-16 16:04:54
|
Revision: 1364 http://toss.svn.sourceforge.net/toss/?rev=1364&view=rev Author: lukaszkaiser Date: 2011-03-16 16:04:48 +0000 (Wed, 16 Mar 2011) Log Message: ----------- Some more www and WebClient corrections. Modified Paths: -------------- trunk/Toss/WebClient/Login.js trunk/Toss/www/.cvsignore trunk/Toss/www/Publications/.cvsignore trunk/Toss/www/Publications/Makefile trunk/Toss/www/default.mak trunk/Toss/www/index.xml trunk/Toss/www/navigation.xml trunk/Toss/www/styles/common.css trunk/Toss/www/xsl/books.xsl trunk/Toss/www/xsl/include/common.xsl trunk/Toss/www/xsl/include/layout.xsl trunk/Toss/www/xsl/main.xsl trunk/Toss/www/xsl/publications.xsl Property Changed: ---------------- trunk/Toss/www/ trunk/Toss/www/Publications/ Modified: trunk/Toss/WebClient/Login.js =================================================================== --- trunk/Toss/WebClient/Login.js 2011-03-16 00:05:04 UTC (rev 1363) +++ trunk/Toss/WebClient/Login.js 2011-03-16 16:04:48 UTC (rev 1364) @@ -47,7 +47,7 @@ // Onload handler function startup (game) { - if (navigator.userAgent.indexOf('MSIE') !=-1) { + if (navigator.userAgent.indexOf('MSIE') !=-1 && navigator.userAgent.indexOf('MSIE 9') ==-1) { document.getElementById("nosvg").style.display = "block"; } else { var udata = srv("USERPLAYS", "user"); Property changes on: trunk/Toss/www ___________________________________________________________________ Modified: svn:ignore - # We are still using .cvsignore files as we find them easier to manage # than svn properties. Therefore if you change .cvsignore do the following. # svn propset svn:ignore -F .cvsignore . *.html *.html.de *.html.en *.html.pl *.texml *.xml.de *.xml.en *.xml.pl reference.xml code_doc *.ps *.dvi *.aux *.out *.log *.bbl *.blg *.idx *.thm *.snm *.nav *.toc *.flc *~ + # We are still using .cvsignore files as we find them easier to manage # than svn properties. Therefore if you change .cvsignore do the following. # svn propset svn:ignore -F .cvsignore . *.html *.html.de *.html.en *.html.fr *.html.pl *.texml *.xml.de *.xml.en *.xml.fr *.xml.pl reference.xml code_doc *.ps *.dvi *.aux *.out *.log *.bbl *.blg *.idx *.thm *.snm *.nav *.toc *.flc *~ Modified: trunk/Toss/www/.cvsignore =================================================================== --- trunk/Toss/www/.cvsignore 2011-03-16 00:05:04 UTC (rev 1363) +++ trunk/Toss/www/.cvsignore 2011-03-16 16:04:48 UTC (rev 1364) @@ -5,10 +5,12 @@ *.html *.html.de *.html.en +*.html.fr *.html.pl *.texml *.xml.de *.xml.en +*.xml.fr *.xml.pl reference.xml code_doc Property changes on: trunk/Toss/www/Publications ___________________________________________________________________ Modified: svn:ignore - # We are still using .cvsignore files as we find them easier to manage # than svn properties. Therefore if you change .cvsignore do the following. # svn propset svn:ignore -F .cvsignore . *.xml.de *.xml.en *.xml.pl *.html *.html.de *.html.en *.html.pl all.texml all.xml *~ + # We are still using .cvsignore files as we find them easier to manage # than svn properties. Therefore if you change .cvsignore do the following. # svn propset svn:ignore -F .cvsignore . *.xml.de *.xml.en *.xml.fr *.xml.pl *.html *.html.de *.html.en *.html.fr *.html.pl all.texml all.xml *~ Modified: trunk/Toss/www/Publications/.cvsignore =================================================================== --- trunk/Toss/www/Publications/.cvsignore 2011-03-16 00:05:04 UTC (rev 1363) +++ trunk/Toss/www/Publications/.cvsignore 2011-03-16 16:04:48 UTC (rev 1364) @@ -4,10 +4,12 @@ *.xml.de *.xml.en +*.xml.fr *.xml.pl *.html *.html.de *.html.en +*.html.fr *.html.pl all.texml Modified: trunk/Toss/www/Publications/Makefile =================================================================== --- trunk/Toss/www/Publications/Makefile 2011-03-16 00:05:04 UTC (rev 1363) +++ trunk/Toss/www/Publications/Makefile 2011-03-16 16:04:48 UTC (rev 1364) @@ -1,6 +1,6 @@ TOPDIR = .. BINDIR = $(TOPDIR)/bin -LANGS = de en pl +LANGS = de en fr pl BIB_FILES = $(wildcard ./*.bib) BIBTEXML_TEX_FILES = $(patsubst %.bib,%.texml,$(BIB_FILES)) Modified: trunk/Toss/www/default.mak =================================================================== --- trunk/Toss/www/default.mak 2011-03-16 00:05:04 UTC (rev 1363) +++ trunk/Toss/www/default.mak 2011-03-16 16:04:48 UTC (rev 1364) @@ -1,5 +1,5 @@ BINDIR = $(TOPDIR)/bin -LANGS = de en pl +LANGS = de en fr pl BIB_FILES = $(wildcard ./*.bib) BIBTEXML_TEX_FILES = $(patsubst %.bib,%.texml,$(BIB_FILES)) @@ -83,6 +83,14 @@ chmod 664 $@ ;\ fi +%.html.fr : LANG=fr +%.html.fr : %.xml.fr $(AUXILIARY_FILES) $(XSL_FILES) $(BIBTEXML_FILES) + lang=$(LANG) ; if [ -n "$$lang" ] ; then \ + xsltproc $(XSLTPROC_PARAM) --stringparam "lang" "$(LANG)" --stringparam "uri" "$<" $< \ + | $(BINDIR)/hrefprocess "$(TOPDIR)" "$(LANG)" > $@ ;\ + chmod 664 $@ ;\ + fi + %.html : %.html.en @echo Modified: trunk/Toss/www/index.xml =================================================================== --- trunk/Toss/www/index.xml 2011-03-16 00:05:04 UTC (rev 1363) +++ trunk/Toss/www/index.xml 2011-03-16 16:04:48 UTC (rev 1364) @@ -38,7 +38,15 @@ </par> </section> + <section title="À propos de Toss" lang="fr"> + <par><em>Toss</em> jest programem do tworzenia, analizowania + i grania w gry. Dzięki ogólnemu algorytmowi możesz stworzyc grę + i od razu zagrać w nią z komputerem. Na przykład, jak grałoby + się w szachy bez środka planszy? Z Tossem łatwo to sprawdzić! + </par> + </section> + <games-section> <game-div> <game-link game="Breakthrough"/> Modified: trunk/Toss/www/navigation.xml =================================================================== --- trunk/Toss/www/navigation.xml 2011-03-16 00:05:04 UTC (rev 1363) +++ trunk/Toss/www/navigation.xml 2011-03-16 16:04:48 UTC (rev 1364) @@ -70,4 +70,27 @@ <item href="/contact.html" id="contact">Kontakt i Linki</item> </menu> + +<menu lang="fr"> + <item href="/" id="Home">Accueil</item> + <item href="/ideas.html" id="ideas">Idées GSoC</item> + <item href="http://tplay.org">Graj Online</item> + <item href="http://sourceforge.net/project/showfiles.php?group_id=115606" + >Télécharger Toss</item> + <menu title="Créerez des Jeux" href="/create.html" id="create"> + <item href="http://vimeo.com/10110495" id="tut">Tutorial Video</item> + <item href="/examples.html" id="examples">Examples</item> + <item href="/gui_interface.html" id="gui_interface">Interface GUI</item> + </menu> + <item href="/play.html" id="play">Regarder Toss Jouer</item> + <menu title="Documentation" href="/docs.html" id="docs"> + <item href="/reference/reference.pdf" id="refpdf">Référence (pdf)</item> + <item href="/reference/" id="refhtml">Référence (html)</item> + <item href="/code_doc/" id="code">Documentation du Code</item> + </menu> + <item href="/Publications/" id="Publications">Papers et Entretiens</item> + <item href="/develop.html" id="develop">Développer Toss</item> + <item href="/contact.html" id="contact">Contact et Liens</item> +</menu> + </navigation> Modified: trunk/Toss/www/styles/common.css =================================================================== --- trunk/Toss/www/styles/common.css 2011-03-16 00:05:04 UTC (rev 1363) +++ trunk/Toss/www/styles/common.css 2011-03-16 16:04:48 UTC (rev 1364) @@ -6,8 +6,8 @@ } body { - font-family: "DejaVu Sans", Verdana, sans-serif; - line-height: 140%; + font-family: Ubuntu, "DejaVu Sans", Verdana, sans-serif; + line-height: 130%; } a, a:link, a:active, a:visited { Modified: trunk/Toss/www/xsl/books.xsl =================================================================== --- trunk/Toss/www/xsl/books.xsl 2011-03-16 00:05:04 UTC (rev 1363) +++ trunk/Toss/www/xsl/books.xsl 2011-03-16 16:04:48 UTC (rev 1364) @@ -32,6 +32,9 @@ <xsl:if test="$lang='pl'"> <h1 property="dc:title">Ksiazki</h1> </xsl:if> + <xsl:if test="$lang='fr'"> + <h1 property="dc:title">Livres</h1> + </xsl:if> <!-- <xsl:if test="$lang='de'"> <p><em>Der Inhalt dieser Seite ist nur auf Englisch verfügbar.</em></p> Modified: trunk/Toss/www/xsl/include/common.xsl =================================================================== --- trunk/Toss/www/xsl/include/common.xsl 2011-03-16 00:05:04 UTC (rev 1363) +++ trunk/Toss/www/xsl/include/common.xsl 2011-03-16 16:04:48 UTC (rev 1364) @@ -78,6 +78,11 @@ <xsl:apply-templates /> <p><a href="http://tplay.org">Więcej gier</a></p> </xsl:when> + <xsl:when test="$lang='fr'"> + <h3><a href="http://tplay.org">Jouez en Ligne contre Toss</a></h3> + <xsl:apply-templates /> + <p><a href="http://tplay.org">Plus de Jeux</a></p> + </xsl:when> <xsl:otherwise> <h3><a href="http://tplay.org">Play Online Against Toss</a></h3> <xsl:apply-templates /> @@ -180,7 +185,7 @@ <a href="http://tplay.org/index_{@game}.html" title="Spiel {@game}" class="game-link" id="game-link-{@game}"> <img class="game-img" src="{$topdir}/img/{@game}.png" - alt="{@game}Brett" id="game-img-{@game}" /> + alt="{@game}-Brett" id="game-img-{@game}" /> </a> </xsl:when> <xsl:when test="$lang='pl'"> @@ -190,11 +195,18 @@ alt="Plansza {@game}" id="game-img-{@game}" /> </a> </xsl:when> + <xsl:when test="$lang='fr'"> + <a href="http://tplay.org/index_{@game}.html" + title="Graj w {@game}" class="game-link" id="game-link-{@game}"> + <img class="game-img" src="{$topdir}/img/{@game}.png" + alt="Bord de {@game}" id="game-img-{@game}" /> + </a> + </xsl:when> <xsl:otherwise> <a href="http://tplay.org/index_{@game}.html" - title="Play {@game}" class="game-link" id="game-link-{@game}"> + title="Jouez au {@game}" class="game-link" id="game-link-{@game}"> <img class="game-img" src="{$topdir}/img/{@game}.png" - alt="{@game} Board Image" id="game-img-{@game}" /> + alt="{@game} Board" id="game-img-{@game}" /> </a> </xsl:otherwise> </xsl:choose> Modified: trunk/Toss/www/xsl/include/layout.xsl =================================================================== --- trunk/Toss/www/xsl/include/layout.xsl 2011-03-16 00:05:04 UTC (rev 1363) +++ trunk/Toss/www/xsl/include/layout.xsl 2011-03-16 16:04:48 UTC (rev 1364) @@ -58,6 +58,9 @@ <xsl:if test="$lang='pl'"> <title>Publikacje</title> </xsl:if> + <xsl:if test="$lang='fr'"> + <title>Publications</title> + </xsl:if> </xsl:when> <xsl:when test="$title='Publications' and $author!='all'"> <xsl:variable name="fullname" select="normalize-space(concat(document('../../people.xml')/people/person[@id=$author]/first,' ',document('../../people.xml')/people/person[@id=$author]/last))"/> @@ -70,6 +73,9 @@ <xsl:if test="$lang='pl'"> <title>Publikacje: <xsl:value-of select="$fullname"/></title> </xsl:if> + <xsl:if test="$lang='fr'"> + <title>Publications de <xsl:value-of select="$fullname"/></title> + </xsl:if> </xsl:when> <xsl:otherwise> <title><xsl:value-of select="$title"/></title> @@ -137,6 +143,9 @@ <a href="{concat(substring-before($uri,'.'),'.html.en')}">English</a> </li> <li> + <a href="{concat(substring-before($uri,'.'),'.html.fr')}">Français</a> + </li> + <li> <a href="{concat(substring-before($uri,'.'),'.html.pl')}">Polski</a> </li> </xsl:if> @@ -146,6 +155,9 @@ </li> <li class="selected"><span>English</span></li> <li> + <a href="{concat(substring-before($uri,'.'),'.html.fr')}">Français</a> + </li> + <li> <a href="{concat(substring-before($uri,'.'),'.html.pl')}">Polski</a> </li> </xsl:if> @@ -156,8 +168,23 @@ <li> <a href="{concat(substring-before($uri,'.'),'.html.en')}">English</a> </li> + <li> + <a href="{concat(substring-before($uri,'.'),'.html.fr')}">Français</a> + </li> <li class="selected"><span>Polski</span></li> </xsl:if> + <xsl:if test="$lang='fr'"> + <li> + <a href="{concat(substring-before($uri,'.'),'.html.de')}">Deutsch</a> + </li> + <li> + <a href="{concat(substring-before($uri,'.'),'.html.en')}">English</a> + </li> + <li class="selected"><span>Français</span></li> + <li> + <a href="{concat(substring-before($uri,'.'),'.html.pl')}">Polski</a> + </li> + </xsl:if> </ul> </div> </xsl:template> Modified: trunk/Toss/www/xsl/main.xsl =================================================================== --- trunk/Toss/www/xsl/main.xsl 2011-03-16 00:05:04 UTC (rev 1363) +++ trunk/Toss/www/xsl/main.xsl 2011-03-16 16:04:48 UTC (rev 1364) @@ -758,6 +758,9 @@ <xsl:if test="$lang='pl'"> <h3>Wybrane Referaty</h3> </xsl:if> + <xsl:if test="$lang='fr'"> + <h3>Entretiens Sélectionnés</h3> + </xsl:if> <xsl:apply-templates /> </xsl:template> @@ -771,6 +774,9 @@ <xsl:if test="$lang='pl'"> <h3>Badania</h3> </xsl:if> + <xsl:if test="$lang='fr'"> + <h3>Recherche</h3> + </xsl:if> <xsl:apply-templates /> </xsl:template> @@ -802,6 +808,9 @@ <xsl:if test="$lang='pl'"> <h3>Addres</h3> </xsl:if> + <xsl:if test="$lang='fr'"> + <h3>l'Adresse</h3> + </xsl:if> Toss Team<br/> Internet<br/> <xsl:if test="$lang='de'"> @@ -886,6 +895,9 @@ <xsl:if test="$lang='pl'"> <h3>Ostatnie Publikacje</h3> </xsl:if> + <xsl:if test="$lang='fr'"> + <h3>Publications Récentes</h3> + </xsl:if> <xsl:apply-templates select="document('../Publications/all.xml')/*" mode="author"> <xsl:with-param name="author" select="document('../people.xml')/people/person[@id=current()/@author]/last"/> <xsl:with-param name="author_firstname" select="document('../people.xml')/people/person[@id=current()/@author]/first"/> @@ -898,8 +910,11 @@ <p><a href="{$topdir}/Publications/{@author}.html.en">All publications</a></p> </xsl:if> <xsl:if test="$lang='pl'"> - <p><a href="{$topdir}/Publications/{@author}.html.en">Wszystkie publikacje</a></p> + <p><a href="{$topdir}/Publications/{@author}.html.pl">Wszystkie publikacje</a></p> </xsl:if> + <xsl:if test="$lang='fr'"> + <p><a href="{$topdir}/Publications/{@author}.html.fr">Toutes les Publications</a></p> + </xsl:if> </xsl:template> Modified: trunk/Toss/www/xsl/publications.xsl =================================================================== --- trunk/Toss/www/xsl/publications.xsl 2011-03-16 00:05:04 UTC (rev 1363) +++ trunk/Toss/www/xsl/publications.xsl 2011-03-16 16:04:48 UTC (rev 1364) @@ -26,6 +26,9 @@ <xsl:if test="$lang='pl'"> <h1 property="dc:title">Prace i Referaty</h1> </xsl:if> + <xsl:if test="$lang='fr'"> + <h1 property="dc:title">Papers et Entretiens</h1> + </xsl:if> <xsl:if test="document('../people.xml')/people/person[@id=$author]"> <xsl:variable name="fullname" select="normalize-space(concat(document('../people.xml')/people/person[@id=$author]/first,' ',document('../people.xml')/people/person[@id=$author]/last))"/> <h2><xsl:value-of select="$fullname"/></h2> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-16 00:05:10
|
Revision: 1363 http://toss.svn.sourceforge.net/toss/?rev=1363&view=rev Author: lukaszkaiser Date: 2011-03-16 00:05:04 +0000 (Wed, 16 Mar 2011) Log Message: ----------- WebClient, www and manual GGP corrections. Modified Paths: -------------- trunk/Toss/GGP/GDL.ml trunk/Toss/WebClient/Main.js trunk/Toss/www/Makefile trunk/Toss/www/ideas.xml Added Paths: ----------- trunk/Toss/www/img/favicon.ico Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-03-15 14:53:40 UTC (rev 1362) +++ trunk/Toss/GGP/GDL.ml 2011-03-16 00:05:04 UTC (rev 1363) @@ -3821,7 +3821,7 @@ match actions with | [Func ("MOVE", [Const x1; Const y1; Const x2; Const y2]); Const "NOOP"] when x1 = x2 -> - "WhiteStraight", + "WhiteMove", ["a1", Structure.board_coords_name (s2i x1, s2i y1); "a2", Structure.board_coords_name (s2i x2, s2i y2)] | [Func ("MOVE", [Const x1; Const y1; Const x2; Const y2]); @@ -3832,7 +3832,7 @@ | [Const "NOOP"; Func ("MOVE", [Const x1; Const y1; Const x2; Const y2])] when x1 = x2 -> - "BlackStraight", + "BlackMove", ["a2", Structure.board_coords_name (s2i x1, s2i y1); "a1", Structure.board_coords_name (s2i x2, s2i y2)] | [Const "NOOP"; @@ -3944,7 +3944,7 @@ let struc = (snd new_state).Arena.struc in match emb with | [(_,a); (_,b)] -> - let a, b = if rule = "BlackStraight" then a, b else b, a in + let a, b = if rule = "BlackMove" then a, b else b, a in let x1, y1 = Structure.board_elem_coords (Structure.elem_str struc a) and x2, y2 = @@ -3957,7 +3957,7 @@ match emb with | [(_,a); (_,b)] -> let a, b = - if rule = "BlackStraight" then a, b else b, a in + if rule = "BlackMove" then a, b else b, a in let x1, y1 = Structure.board_elem_coords (Structure.elem_str struc a) and x2, y2 = @@ -3967,7 +3967,7 @@ else Printf.sprintf "(CAPTURE %d %d %d %d)" x1 y1 x2 y2 | [(_,a); (_,b); (_, c)] -> - let a, b = if rule = "BlackStraightTwo" then a, c else c, a in + let a, b = if rule = "BlackMoveTwo" then a, c else c, a in let x1, y1 = Structure.board_elem_coords (Structure.elem_str struc a) and x2, y2 = Modified: trunk/Toss/WebClient/Main.js =================================================================== --- trunk/Toss/WebClient/Main.js 2011-03-15 14:53:40 UTC (rev 1362) +++ trunk/Toss/WebClient/Main.js 2011-03-16 00:05:04 UTC (rev 1363) @@ -227,6 +227,7 @@ // Apply current move. function make_move () { + if (ASYNC_REQ_PENDING != 0) return; if (CUR_MOVE == "") return; var m = PLAYS[CUR_PLAY_I][3]; if (PLAYS[CUR_PLAY_I][m] != UNAME && PLAYS[CUR_PLAY_I][m] != "computer") { Modified: trunk/Toss/www/Makefile =================================================================== --- trunk/Toss/www/Makefile 2011-03-15 14:53:40 UTC (rev 1362) +++ trunk/Toss/www/Makefile 2011-03-16 00:05:04 UTC (rev 1363) @@ -6,6 +6,5 @@ ln -fs ../Toss.docdir code_doc cp code_doc/index.html code_doc/index.html.en cp code_doc/index.html code_doc/index.html.de - cp code_doc/index.html code_doc/index.html.de cp code_doc/index.html code_doc/index.html.pl cp code_doc/index.html code_doc/index.html.fr Modified: trunk/Toss/www/ideas.xml =================================================================== --- trunk/Toss/www/ideas.xml 2011-03-15 14:53:40 UTC (rev 1362) +++ trunk/Toss/www/ideas.xml 2011-03-16 00:05:04 UTC (rev 1363) @@ -14,8 +14,10 @@ <par>Toss is applying to participate in <em>Google Summer of Code</em> in 2011. This page contains a few ideas for students who wish to work on Toss this summer. But, most importantly, we welcome new ideas from - students who wish to participate! We are very positive about suggestions - and we think that best proposals (and code) come from students who are + students who wish to participate! If you think of a complex strategic game + or a suite of simpler games, it may be a good idea to do them in Toss. + Make sure to contact us, we are very positive about suggestions and + we think that the best proposals (and code) come from students who are simply passionate about realizing their own ideas!<br/></par> </section> @@ -93,26 +95,27 @@ in current Toss code and GUI, these are not fully developed, tested, and not supported in the web interface. The good old <a href="http://en.wikipedia.org/wiki/Pac-Man">Pac-Man</a> is an ideal - test candidate for these features. + test candidate for these features, especially for concurrent moves. <br/><br/></par> <par><em>Deliverables.</em> By mid-term it will be possible to play Pac-Man in Toss in command line mode and in the GUI. By the end, it will be supported in the web - interface as well. + interface and automatic play will work as well. <br/><br/></par> <par><em>Modules (in planned construction order).</em> <enumerate> <item>Allow multiple players in one location in Toss (easy)</item> + <item>Implement missing concurrency features in Toss (medium)</item> <item>Test, debug and implement missing timing features (easy)</item> - <item>Relate Toss-internal time with real time (medium)</item> <item>Pac-Man in command line and GUI (easy after 1, 2)</item> <item>Make Toss web interface fully asynchronous (medium)</item> <item>Pac-Man in the web interface (easy after 5)</item> + <item>Adapt automatic playing algorithms to concurrency</item> </enumerate> <br/></par> <par><em>Needed Skills and Difficulty.</em> - This idea is straight-forward and does not contain any hard bits. - But it requires the student to know both OCaml and AJAX with JavaScript, + This idea is easy to medium depending on much one demands in point 7. + It requires the student to know both OCaml and AJAX with JavaScript, and to be able to use and debug them in parallel. <br/><br/></par> <par><em>Possible Mentors (in order of preference):</em> @@ -220,6 +223,8 @@ <enumerate> <item>Enrich Toss formulas with fixed-points (medium, needed)</item> <item>Generalize GGP translation using fixed-points (medium)</item> + <item>Generalize GDL translation to handle simultaneous moves and + arbitrary turn taking (depends on concurrency in Toss)</item> <item>Improve readability of translated games, test, debug</item> <item>Add some position detection or layouting to the translation</item> <item>Adapt web interface to be usable with translated games</item> Added: trunk/Toss/www/img/favicon.ico =================================================================== (Binary files differ) Property changes on: trunk/Toss/www/img/favicon.ico ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-15 14:53:49
|
Revision: 1362 http://toss.svn.sourceforge.net/toss/?rev=1362&view=rev Author: lukstafi Date: 2011-03-15 14:53:40 +0000 (Tue, 15 Mar 2011) Log Message: ----------- Folding over formulas and atoms. GameSimpl stage 2: pruning subsumed atoms; stage 4: removing unused relations. Modified Paths: -------------- trunk/Toss/Arena/Arena.ml trunk/Toss/Arena/Arena.mli trunk/Toss/Arena/ContinuousRule.ml trunk/Toss/Arena/ContinuousRule.mli trunk/Toss/Formula/FormulaOps.ml trunk/Toss/Formula/FormulaOps.mli trunk/Toss/GGP/GameSimpl.ml trunk/Toss/GGP/GameSimplTest.ml trunk/Toss/GGP/tests/breakthrough-simpl.toss trunk/Toss/GGP/tests/connect5-simpl.toss trunk/Toss/Solver/Solver.ml Modified: trunk/Toss/Arena/Arena.ml =================================================================== --- trunk/Toss/Arena/Arena.ml 2011-03-15 11:03:16 UTC (rev 1361) +++ trunk/Toss/Arena/Arena.ml 2011-03-15 14:53:40 UTC (rev 1362) @@ -392,6 +392,35 @@ drel, (args, f def)) game.defined_rels; } +let fold_over_formulas ~include_defined_rels f game acc = + let acc = + List.fold_right (fun (_, r) -> + ContinuousRule.fold_over_formulas f r + ) game.rules acc in + let acc = + Array.fold_right (fun loc -> + Array.fold_right (FormulaOps.fold_over_formulas_expr f) loc.payoffs + ) game.graph acc in + let acc = + if include_defined_rels then + List.fold_right (fun (_, (_, def)) -> f def) + game.defined_rels acc + else acc in + acc + +let map_to_structures f (game, state) = + {game with + rules = List.map (fun (rn, r) -> + rn, {r with ContinuousRule.discrete = + {r.ContinuousRule.discrete with + DiscreteRule.lhs_struc = + f r.ContinuousRule.discrete.DiscreteRule.lhs_struc; + DiscreteRule.rhs_struc = + f r.ContinuousRule.discrete.DiscreteRule.rhs_struc; + }}) game.rules}, + {state with + struc = f state.struc} + (* Compare two (game, state) pairs and explain the first difference met. Formulas and expressions are compared for syntactical equality. Players need to be given in the same order. Data is ignored. *) Modified: trunk/Toss/Arena/Arena.mli =================================================================== --- trunk/Toss/Arena/Arena.mli 2011-03-15 11:03:16 UTC (rev 1361) +++ trunk/Toss/Arena/Arena.mli 2011-03-15 14:53:40 UTC (rev 1362) @@ -109,7 +109,12 @@ ?extend_state:game * game_state -> definition list -> game * game_state val map_to_formulas : (Formula.formula -> Formula.formula) -> game -> game +val fold_over_formulas : include_defined_rels:bool -> + (Formula.formula -> 'a -> 'a) -> game -> 'a -> 'a +val map_to_structures : + (Structure.structure -> Structure.structure) -> game * game_state -> + game * game_state (** Compare two (game, state) pairs and explain the first difference met. Formulas and expressions are compared for syntactical Modified: trunk/Toss/Arena/ContinuousRule.ml =================================================================== --- trunk/Toss/Arena/ContinuousRule.ml 2011-03-15 11:03:16 UTC (rev 1361) +++ trunk/Toss/Arena/ContinuousRule.ml 2011-03-15 14:53:40 UTC (rev 1362) @@ -69,6 +69,16 @@ post = f r.post; } +let fold_over_formulas f r acc = + let acc = + f r.discrete.DiscreteRule.pre acc in + let acc = + f r.compiled.DiscreteRule.lhs_form acc in + let acc = f r.inv acc in + let acc = f r.post acc in + acc + + (* ---------------------- FINDING APPLICABLE MATCHES ------------------------ *) (* Find all matches of [r] in [struc] which satisfy [r]'s precondition. *) Modified: trunk/Toss/Arena/ContinuousRule.mli =================================================================== --- trunk/Toss/Arena/ContinuousRule.mli 2011-03-15 11:03:16 UTC (rev 1361) +++ trunk/Toss/Arena/ContinuousRule.mli 2011-03-15 14:53:40 UTC (rev 1362) @@ -55,6 +55,8 @@ val lhs : rule -> Structure.structure val rhs : rule -> Structure.structure val map_to_formulas : (Formula.formula -> Formula.formula) -> rule -> rule +val fold_over_formulas : + (Formula.formula -> 'a -> 'a) -> rule -> 'a -> 'a (** {2 Finding applicable matches} *) Modified: trunk/Toss/Formula/FormulaOps.ml =================================================================== --- trunk/Toss/Formula/FormulaOps.ml 2011-03-15 11:03:16 UTC (rev 1361) +++ trunk/Toss/Formula/FormulaOps.ml 2011-03-15 14:53:40 UTC (rev 1362) @@ -158,7 +158,17 @@ | Sum (vs, phi, r) -> Sum (vs, f phi, map_to_formulas_expr f r) +let rec fold_over_formulas_expr f r acc = + match r with + | RVar _ | Const _ | Fun _ -> acc + | Times (r1, r2) + | Plus (r1, r2) -> + fold_over_formulas_expr f r1 (fold_over_formulas_expr f r2 acc) + | Char (phi) -> f phi acc + | Sum (vs, phi, r) -> + fold_over_formulas_expr f r (f phi acc) + (* Map [f] to all atoms in the given formula. *) let map_to_atoms_full f g phi = map_to_literals (function Not (x) -> Not (f x) | x -> f x) g phi @@ -172,6 +182,25 @@ let map_to_atoms_expr f r = map_to_literals_expr (function Not (x) -> Not (f x) | x -> f x) (fun x -> x) r + +let rec fold_over_literals f phi acc = + match phi with + Rel _ | Eq _ | In _ as x -> f x acc + | Not (Rel _) | Not (Eq _) | Not (In _) as x -> f x acc + | Not phi -> fold_over_literals f phi acc + | Or flist + | And flist -> List.fold_right (fold_over_literals f) flist acc + | Ex (vs, phi) + | All (vs, phi) -> fold_over_literals f phi acc + | RealExpr (r, _) -> fold_over_literals_expr f r acc + +and fold_over_literals_expr f = + fold_over_formulas_expr (fold_over_literals f) + +let fold_over_atoms f phi = + fold_over_literals + (function Not x -> f x | x -> f x) phi + (* Map [f] to all variables occurring in the formula. Preserves order of subformulas. *) let rec map_to_all_vars (f : var -> var) = function Modified: trunk/Toss/Formula/FormulaOps.mli =================================================================== --- trunk/Toss/Formula/FormulaOps.mli 2011-03-15 11:03:16 UTC (rev 1361) +++ trunk/Toss/Formula/FormulaOps.mli 2011-03-15 14:53:40 UTC (rev 1362) @@ -30,6 +30,9 @@ [Sum] guards). *) val map_to_formulas_expr : (formula -> formula) -> real_expr -> real_expr +val fold_over_formulas_expr : + (formula -> 'a -> 'a) -> real_expr -> 'a -> 'a + (** Map [f] to all atoms in the given formula. *) val map_to_atoms_full : (formula -> formula) -> (real_expr -> real_expr) -> formula -> formula @@ -38,6 +41,11 @@ val map_to_atoms : (formula -> formula) -> formula -> formula val map_to_atoms_expr : (formula -> formula) -> real_expr -> real_expr +val fold_over_literals : + (formula -> 'a -> 'a) -> formula -> 'a -> 'a +val fold_over_atoms : + (formula -> 'a -> 'a) -> formula -> 'a -> 'a + (** Map @param f to all variables occurring in the formula. Preserves order of subformulas. @param phi The formula to substitute in. *) val map_to_all_vars : (var -> var) -> formula -> formula Modified: trunk/Toss/GGP/GameSimpl.ml =================================================================== --- trunk/Toss/GGP/GameSimpl.ml 2011-03-15 11:03:16 UTC (rev 1361) +++ trunk/Toss/GGP/GameSimpl.ml 2011-03-15 14:53:40 UTC (rev 1362) @@ -45,6 +45,8 @@ over the same variables, with one of introduced predicates. For several possibilities of replacement pick one arbitrarily (currently, in the order of occurrence in the formula). + + (4) Remove from the structure relations that are no longer used. *) open Formula @@ -118,7 +120,7 @@ String.concat ", " (Aux.Strings.elements v)) subset_table "") ); (* }}} *) - let subsumed rel1 rel2 = + let included_in rel1 rel2 = Aux.Strings.mem rel2 (Aux.StrMap.find rel1 subset_table) in let compl_table = List.fold_left (fun table (rel,arity) -> @@ -152,7 +154,7 @@ not (List.mem rel2 fluents || List.mem_assoc rel2 game.Arena.defined_rels) && (complement rel1 rel2 || - (subsumed rel1 rel2 && subsumed rel2 rel1)) + (included_in rel1 rel2 && included_in rel2 rel1)) ) signat in rel1, (rel2, complement rel1 rel2) with Not_found -> rel1, (rel1, false) @@ -314,7 +316,39 @@ }}) game.Arena.rules} in (* 2 *) - (*let game = - Arena.map_to_formulas (FormulaOps.)*) + let implies phi1 phi2 = + match phi1, phi2 with + | _ when phi1 = phi2 -> true + | Rel (rel1, args1), Rel (rel2, args2) when args1 = args2 -> + not (List.mem rel1 fluents) && + not (List.mem rel2 fluents) && + included_in rel1 rel2 + | _ -> false in + let game = + Arena.map_to_formulas (FormulaOps.remove_redundant ~implies) game in - game, state + (* 4 *) + let add_rel rel acc = + match rel with + | Rel (rel,_) -> Aux.Strings.add rel acc + | _ -> acc in + let used_rels = + Arena.fold_over_formulas ~include_defined_rels:false + (FormulaOps.fold_over_atoms add_rel) + game Aux.Strings.empty in + let clear_rel rel = + let rel = + if DiscreteRule.special_rel_of rel = None then rel + else DiscreteRule.orig_rel_of rel in + let res = + not (List.mem_assoc rel game.Arena.defined_rels) && + not (Aux.Strings.mem rel used_rels) in + (* {{{ log entry *) + if !debug_level > 2 && res then ( + Printf.printf "GameSimpl: removing relation %s\n%!" rel + ); + (* }}} *) + res in + Arena.map_to_structures + (fun struc -> Structure.clear_rels struc clear_rel) + (game, state) Modified: trunk/Toss/GGP/GameSimplTest.ml =================================================================== --- trunk/Toss/GGP/GameSimplTest.ml 2011-03-15 11:03:16 UTC (rev 1361) +++ trunk/Toss/GGP/GameSimplTest.ml 2011-03-15 14:53:40 UTC (rev 1362) @@ -69,3 +69,14 @@ output_string resf res_str; close_out resf; Printf.printf "\nRESULT:\n%s\n%!" res_str + +let a () = + let connect5 = state_of_file "./GGP/tests/connect5-raw.toss" in + Printf.printf "\nINPUT:\n%s\n%!" (Arena.state_str connect5); + GameSimpl.debug_level := 4; + let res = GameSimpl.simplify connect5 in + let resf = open_out "./GGP/tests/connect5-simpl.toss" in + let res_str = Arena.state_str res in + output_string resf res_str; + close_out resf; + Printf.printf "\nRESULT:\n%s\n%!" res_str Modified: trunk/Toss/GGP/tests/breakthrough-simpl.toss =================================================================== --- trunk/Toss/GGP/tests/breakthrough-simpl.toss 2011-03-15 11:03:16 UTC (rev 1361) +++ trunk/Toss/GGP/tests/breakthrough-simpl.toss 2011-03-15 14:53:40 UTC (rev 1362) @@ -27,25 +27,17 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and - not - not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and - not - ex cellholds_x376_1__blank_ - (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x376_1__blank_) and - cellholds_x2_y2_black(cellholds_x376_1__blank_)) and + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and not - not - ex cellholds_x377_y369__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - cellholds_x2_y2_white(cellholds_x377_y369__blank_))) + ex cellholds_x376_1__blank_ + (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and + cellholds_x2_y2_black(cellholds_x376_1__blank_)) and + ex cellholds_x377_y369__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and + cellholds_x2_y2_white(cellholds_x377_y369__blank_))) RULE move_x1_y1_x2_y2_00: [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | _opt_cellholds_x2_y2_black { @@ -74,25 +66,17 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and - not - not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and - not - ex cellholds_x376_1__blank_ - (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x376_1__blank_) and - cellholds_x2_y2_black(cellholds_x376_1__blank_)) and + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and not - not - ex cellholds_x377_y369__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - cellholds_x2_y2_white(cellholds_x377_y369__blank_))) + ex cellholds_x376_1__blank_ + (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and + cellholds_x2_y2_black(cellholds_x376_1__blank_)) and + ex cellholds_x377_y369__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and + cellholds_x2_y2_white(cellholds_x377_y369__blank_))) RULE move_x1_y1_x2_y2_1: [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | _opt_cellholds_x2_y2_black (control__blank_); @@ -121,25 +105,17 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and - not - not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and - not - ex cellholds_x376_1__blank_ - (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x376_1__blank_) and - cellholds_x2_y2_black(cellholds_x376_1__blank_)) and + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and not - not - ex cellholds_x377_y369__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - cellholds_x2_y2_white(cellholds_x377_y369__blank_))) + ex cellholds_x376_1__blank_ + (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and + cellholds_x2_y2_black(cellholds_x376_1__blank_)) and + ex cellholds_x377_y369__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and + cellholds_x2_y2_white(cellholds_x377_y369__blank_))) RULE move_x1_y1_x2_y2_10: [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | _opt_cellholds_x2_y2_black (control__blank_); @@ -168,25 +144,17 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and - not - not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and - not - ex cellholds_x376_1__blank_ - (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x376_1__blank_) and - cellholds_x2_y2_black(cellholds_x376_1__blank_)) and + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and not - not - ex cellholds_x377_y369__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - cellholds_x2_y2_white(cellholds_x377_y369__blank_))) + ex cellholds_x376_1__blank_ + (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and + cellholds_x2_y2_black(cellholds_x376_1__blank_)) and + ex cellholds_x377_y369__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and + cellholds_x2_y2_white(cellholds_x377_y369__blank_))) RULE move_x_y1_x_y2_0: [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | EQ___cellholds_x2_y2_MV1_x2 @@ -214,25 +182,17 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and - not - not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and - not - ex cellholds_x376_1__blank_ - (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x376_1__blank_) and - cellholds_x2_y2_black(cellholds_x376_1__blank_)) and + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and not - not - ex cellholds_x377_y369__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - cellholds_x2_y2_white(cellholds_x377_y369__blank_))) + ex cellholds_x376_1__blank_ + (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and + cellholds_x2_y2_black(cellholds_x376_1__blank_)) and + ex cellholds_x377_y369__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and + cellholds_x2_y2_white(cellholds_x377_y369__blank_))) RULE move_x_y1_x_y2_1: [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | EQ___cellholds_x2_y2_MV1_x2 @@ -260,25 +220,17 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and - not - not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and - not - ex cellholds_x376_1__blank_ - (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x376_1__blank_) and - cellholds_x2_y2_black(cellholds_x376_1__blank_)) and + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and not - not - ex cellholds_x377_y369__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - cellholds_x2_y2_white(cellholds_x377_y369__blank_))) + ex cellholds_x376_1__blank_ + (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and + cellholds_x2_y2_black(cellholds_x376_1__blank_)) and + ex cellholds_x377_y369__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and + cellholds_x2_y2_white(cellholds_x377_y369__blank_))) LOC 0 { PLAYER white PAYOFF { @@ -287,12 +239,10 @@ :( ex cellholds_x26_8__blank_ (cellholds_x2_8_MV1(cellholds_x26_8__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x26_8__blank_) and cellholds_x2_y2_white(cellholds_x26_8__blank_)) or not ex cellholds_x27_y26__blank_ (index__cellholds_x2_y2_MV1_y2(cellholds_x27_y26__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x27_y26__blank_) and cellholds_x2_y2_black(cellholds_x27_y26__blank_)) ); black: @@ -300,12 +250,10 @@ :( ex cellholds_x30_1__blank_ (cellholds_x2_1_MV1(cellholds_x30_1__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x30_1__blank_) and cellholds_x2_y2_black(cellholds_x30_1__blank_)) or not ex cellholds_x31_y28__blank_ (index__cellholds_x2_y2_MV1_y2(cellholds_x31_y28__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x31_y28__blank_) and cellholds_x2_y2_white(cellholds_x31_y28__blank_)) ) } @@ -320,12 +268,10 @@ :( ex cellholds_x26_8__blank_ (cellholds_x2_8_MV1(cellholds_x26_8__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x26_8__blank_) and cellholds_x2_y2_white(cellholds_x26_8__blank_)) or not ex cellholds_x27_y26__blank_ (index__cellholds_x2_y2_MV1_y2(cellholds_x27_y26__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x27_y26__blank_) and cellholds_x2_y2_black(cellholds_x27_y26__blank_)) ); black: @@ -333,12 +279,10 @@ :( ex cellholds_x30_1__blank_ (cellholds_x2_1_MV1(cellholds_x30_1__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x30_1__blank_) and cellholds_x2_y2_black(cellholds_x30_1__blank_)) or not ex cellholds_x31_y28__blank_ (index__cellholds_x2_y2_MV1_y2(cellholds_x31_y28__blank_) and - index__cellholds_x2_y2_MV1_y2(cellholds_x31_y28__blank_) and cellholds_x2_y2_white(cellholds_x31_y28__blank_)) ) } @@ -882,595 +826,11 @@ (cellholds_1_1_MV1, cellholds_1_2_MV1); (cellholds_1_1_MV1, cellholds_1_1_MV1) }; - EQ___cellholds_x2_y2_MV1_y2 { - (cellholds_8_8_MV1, cellholds_8_8_MV1); - (cellholds_8_8_MV1, cellholds_7_8_MV1); - (cellholds_8_8_MV1, cellholds_6_8_MV1); - (cellholds_8_8_MV1, cellholds_5_8_MV1); - (cellholds_8_8_MV1, cellholds_4_8_MV1); - (cellholds_8_8_MV1, cellholds_3_8_MV1); - (cellholds_8_8_MV1, cellholds_2_8_MV1); - (cellholds_8_8_MV1, cellholds_1_8_MV1); - (cellholds_8_7_MV1, cellholds_8_7_MV1); - (cellholds_8_7_MV1, cellholds_7_7_MV1); - (cellholds_8_7_MV1, cellholds_6_7_MV1); - (cellholds_8_7_MV1, cellholds_5_7_MV1); - (cellholds_8_7_MV1, cellholds_4_7_MV1); - (cellholds_8_7_MV1, cellholds_3_7_MV1); - (cellholds_8_7_MV1, cellholds_2_7_MV1); - (cellholds_8_7_MV1, cellholds_1_7_MV1); - (cellholds_8_6_MV1, cellholds_8_6_MV1); - (cellholds_8_6_MV1, cellholds_7_6_MV1); - (cellholds_8_6_MV1, cellholds_6_6_MV1); - (cellholds_8_6_MV1, cellholds_5_6_MV1); - (cellholds_8_6_MV1, cellholds_4_6_MV1); - (cellholds_8_6_MV1, cellholds_3_6_MV1); - (cellholds_8_6_MV1, cellholds_2_6_MV1); - (cellholds_8_6_MV1, cellholds_1_6_MV1); - (cellholds_8_5_MV1, cellholds_8_5_MV1); - (cellholds_8_5_MV1, cellholds_7_5_MV1); - (cellholds_8_5_MV1, cellholds_6_5_MV1); - (cellholds_8_5_MV1, cellholds_5_5_MV1); - (cellholds_8_5_MV1, cellholds_4_5_MV1); - (cellholds_8_5_MV1, cellholds_3_5_MV1); - (cellholds_8_5_MV1, cellholds_2_5_MV1); - (cellholds_8_5_MV1, cellholds_1_5_MV1); - (cellholds_8_4_MV1, cellholds_8_4_MV1); - (cellholds_8_4_MV1, cellholds_7_4_MV1); - (cellholds_8_4_MV1, cellholds_6_4_MV1); - (cellholds_8_4_MV1, cellholds_5_4_MV1); - (cellholds_8_4_MV1, cellholds_4_4_MV1); - (cellholds_8_4_MV1, cellholds_3_4_MV1); - (cellholds_8_4_MV1, cellholds_2_4_MV1); - (cellholds_8_4_MV1, cellholds_1_4_MV1); - (cellholds_8_3_MV1, cellholds_8_3_MV1); - (cellholds_8_3_MV1, cellholds_7_3_MV1); - (cellholds_8_3_MV1, cellholds_6_3_MV1); - (cellholds_8_3_MV1, cellholds_5_3_MV1); - (cellholds_8_3_MV1, cellholds_4_3_MV1); - (cellholds_8_3_MV1, cellholds_3_3_MV1); - (cellholds_8_3_MV1, cellholds_2_3_MV1); - (cellholds_8_3_MV1, cellholds_1_3_MV1); - (cellholds_8_2_MV1, cellholds_8_2_MV1); - (cellholds_8_2_MV1, cellholds_7_2_MV1); - (cellholds_8_2_MV1, cellholds_6_2_MV1); - (cellholds_8_2_MV1, cellholds_5_2_MV1); - (cellholds_8_2_MV1, cellholds_4_2_MV1); - (cellholds_8_2_MV1, cellholds_3_2_MV1); - (cellholds_8_2_MV1, cellholds_2_2_MV1); - (cellholds_8_2_MV1, cellholds_1_2_MV1); - (cellholds_8_1_MV1, cellholds_8_1_MV1); - (cellholds_8_1_MV1, cellholds_7_1_MV1); - (cellholds_8_1_MV1, cellholds_6_1_MV1); - (cellholds_8_1_MV1, cellholds_5_1_MV1); - (cellholds_8_1_MV1, cellholds_4_1_MV1); - (cellholds_8_1_MV1, cellholds_3_1_MV1); - (cellholds_8_1_MV1, cellholds_2_1_MV1); - (cellholds_8_1_MV1, cellholds_1_1_MV1); - (cellholds_7_8_MV1, cellholds_8_8_MV1); - (cellholds_7_8_MV1, cellholds_7_8_MV1); - (cellholds_7_8_MV1, cellholds_6_8_MV1); - (cellholds_7_8_MV1, cellholds_5_8_MV1); - (cellholds_7_8_MV1, cellholds_4_8_MV1); - (cellholds_7_8_MV1, cellholds_3_8_MV1); - (cellholds_7_8_MV1, cellholds_2_8_MV1); - (cellholds_7_8_MV1, cellholds_1_8_MV1); - (cellholds_7_7_MV1, cellholds_8_7_MV1); - (cellholds_7_7_MV1, cellholds_7_7_MV1); - (cellholds_7_7_MV1, cellholds_6_7_MV1); - (cellholds_7_7_MV1, cellholds_5_7_MV1); - (cellholds_7_7_MV1, cellholds_4_7_MV1); - (cellholds_7_7_MV1, cellholds_3_7_MV1); - (cellholds_7_7_MV1, cellholds_2_7_MV1); - (cellholds_7_7_MV1, cellholds_1_7_MV1); - (cellholds_7_6_MV1, cellholds_8_6_MV1); - (cellholds_7_6_MV1, cellholds_7_6_MV1); - (cellholds_7_6_MV1, cellholds_6_6_MV1); - (cellholds_7_6_MV1, cellholds_5_6_MV1); - (cellholds_7_6_MV1, cellholds_4_6_MV1); - (cellholds_7_6_MV1, cellholds_3_6_MV1); - (cellholds_7_6_MV1, cellholds_2_6_MV1); - (cellholds_7_6_MV1, cellholds_1_6_MV1); - (cellholds_7_5_MV1, cellholds_8_5_MV1); - (cellholds_7_5_MV1, cellholds_7_5_MV1); - (cellholds_7_5_MV1, cellholds_6_5_MV1); - (cellholds_7_5_MV1, cellholds_5_5_MV1); - (cellholds_7_5_MV1, cellholds_4_5_MV1); - (cellholds_7_5_MV1, cellholds_3_5_MV1); - (cellholds_7_5_MV1, cellholds_2_5_MV1); - (cellholds_7_5_MV1, cellholds_1_5_MV1); - (cellholds_7_4_MV1, cellholds_8_4_MV1); - (cellholds_7_4_MV1, cellholds_7_4_MV1); - (cellholds_7_4_MV1, cellholds_6_4_MV1); - (cellholds_7_4_MV1, cellholds_5_4_MV1); - (cellholds_7_4_MV1, cellholds_4_4_MV1); - (cellholds_7_4_MV1, cellholds_3_4_MV1); - (cellholds_7_4_MV1, cellholds_2_4_MV1); - (cellholds_7_4_MV1, cellholds_1_4_MV1); - (cellholds_7_3_MV1, cellholds_8_3_MV1); - (cellholds_7_3_MV1, cellholds_7_3_MV1); - (cellholds_7_3_MV1, cellholds_6_3_MV1); - (cellholds_7_3_MV1, cellholds_5_3_MV1); - (cellholds_7_3_MV1, cellholds_4_3_MV1); - (cellholds_7_3_MV1, cellholds_3_3_MV1); - (cellholds_7_3_MV1, cellholds_2_3_MV1); - (cellholds_7_3_MV1, cellholds_1_3_MV1); - (cellholds_7_2_MV1, cellholds_8_2_MV1); - (cellholds_7_2_MV1, cellholds_7_2_MV1); - (cellholds_7_2_MV1, cellholds_6_2_MV1); - (cellholds_7_2_MV1, cellholds_5_2_MV1); - (cellholds_7_2_MV1, cellholds_4_2_MV1); - (cellholds_7_2_MV1, cellholds_3_2_MV1); - (cellholds_7_2_MV1, cellholds_2_2_MV1); - (cellholds_7_2_MV1, cellholds_1_2_MV1); - (cellholds_7_1_MV1, cellholds_8_1_MV1); - (cellholds_7_1_MV1, cellholds_7_1_MV1); - (cellholds_7_1_MV1, cellholds_6_1_MV1); - (cellholds_7_1_MV1, cellholds_5_1_MV1); - (cellholds_7_1_MV1, cellholds_4_1_MV1); - (cellholds_7_1_MV1, cellholds_3_1_MV1); - (cellholds_7_1_MV1, cellholds_2_1_MV1); - (cellholds_7_1_MV1, cellholds_1_1_MV1); - (cellholds_6_8_MV1, cellholds_8_8_MV1); - (cellholds_6_8_MV1, cellholds_7_8_MV1); - (cellholds_6_8_MV1, cellholds_6_8_MV1); - (cellholds_6_8_MV1, cellholds_5_8_MV1); - (cellholds_6_8_MV1, cellholds_4_8_MV1); - (cellholds_6_8_MV1, cellholds_3_8_MV1); - (cellholds_6_8_MV1, cellholds_2_8_MV1); - (cellholds_6_8_MV1, cellholds_1_8_MV1); - (cellholds_6_7_MV1, cellholds_8_7_MV1); - (cellholds_6_7_MV1, cellholds_7_7_MV1); - (cellholds_6_7_MV1, cellholds_6_7_MV1); - (cellholds_6_7_MV1, cellholds_5_7_MV1); - (cellholds_6_7_MV1, cellholds_4_7_MV1); - (cellholds_6_7_MV1, cellholds_3_7_MV1); - (cellholds_6_7_MV1, cellholds_2_7_MV1); - (cellholds_6_7_MV1, cellholds_1_7_MV1); - (cellholds_6_6_MV1, cellholds_8_6_MV1); - (cellholds_6_6_MV1, cellholds_7_6_MV1); - (cellholds_6_6_MV1, cellholds_6_6_MV1); - (cellholds_6_6_MV1, cellholds_5_6_MV1); - (cellholds_6_6_MV1, cellholds_4_6_MV1); - (cellholds_6_6_MV1, cellholds_3_6_MV1); - (cellholds_6_6_MV1, cellholds_2_6_MV1); - (cellholds_6_6_MV1, cellholds_1_6_MV1); - (cellholds_6_5_MV1, cellholds_8_5_MV1); - (cellholds_6_5_MV1, cellholds_7_5_MV1); - (cellholds_6_5_MV1, cellholds_6_5_MV1); - (cellholds_6_5_MV1, cellholds_5_5_MV1); - (cellholds_6_5_MV1, cellholds_4_5_MV1); - (cellholds_6_5_MV1, cellholds_3_5_MV1); - (cellholds_6_5_MV1, cellholds_2_5_MV1); - (cellholds_6_5_MV1, cellholds_1_5_MV1); - (cellholds_6_4_MV1, cellholds_8_4_MV1); - (cellholds_6_4_MV1, cellholds_7_4_MV1); - (cellholds_6_4_MV1, cellholds_6_4_MV1); - (cellholds_6_4_MV1, cellholds_5_4_MV1); - (cellholds_6_4_MV1, cellholds_4_4_MV1); - (cellholds_6_4_MV1, cellholds_3_4_MV1); - (cellholds_6_4_MV1, cellholds_2_4_MV1); - (cellholds_6_4_MV1, cellholds_1_4_MV1); - (cellholds_6_3_MV1, cellholds_8_3_MV1); - (cellholds_6_3_MV1, cellholds_7_3_MV1); - (cellholds_6_3_MV1, cellholds_6_3_MV1); - (cellholds_6_3_MV1, cellholds_5_3_MV1); - (cellholds_6_3_MV1, cellholds_4_3_MV1); - (cellholds_6_3_MV1, cellholds_3_3_MV1); - (cellholds_6_3_MV1, cellholds_2_3_MV1); - (cellholds_6_3_MV1, cellholds_1_3_MV1); - (cellholds_6_2_MV1, cellholds_8_2_MV1); - (cellholds_6_2_MV1, cellholds_7_2_MV1); - (cellholds_6_2_MV1, cellholds_6_2_MV1); - (cellholds_6_2_MV1, cellholds_5_2_MV1); - (cellholds_6_2_MV1, cellholds_4_2_MV1); - (cellholds_6_2_MV1, cellholds_3_2_MV1); - (cellholds_6_2_MV1, cellholds_2_2_MV1); - (cellholds_6_2_MV1, cellholds_1_2_MV1); - (cellholds_6_1_MV1, cellholds_8_1_MV1); - (cellholds_6_1_MV1, cellholds_7_1_MV1); - (cellholds_6_1_MV1, cellholds_6_1_MV1); - (cellholds_6_1_MV1, cellholds_5_1_MV1); - (cellholds_6_1_MV1, cellholds_4_1_MV1); - (cellholds_6_1_MV1, cellholds_3_1_MV1); - (cellholds_6_1_MV1, cellholds_2_1_MV1); - (cellholds_6_1_MV1, cellholds_1_1_MV1); - (cellholds_5_8_MV1, cellholds_8_8_MV1); - (cellholds_5_8_MV1, cellholds_7_8_MV1); - (cellholds_5_8_MV1, cellholds_6_8_MV1); - (cellholds_5_8_MV1, cellholds_5_8_MV1); - (cellholds_5_8_MV1, cellholds_4_8_MV1); - (cellholds_5_8_MV1, cellholds_3_8_MV1); - (cellholds_5_8_MV1, cellholds_2_8_MV1); - (cellholds_5_8_MV1, cellholds_1_8_MV1); - (cellholds_5_7_MV1, cellholds_8_7_MV1); - (cellholds_5_7_MV1, cellholds_7_7_MV1); - (cellholds_5_7_MV1, cellholds_6_7_MV1); - (cellholds_5_7_MV1, cellholds_5_7_MV1); - (cellholds_5_7_MV1, cellholds_4_7_MV1); - (cellholds_5_7_MV1, cellholds_3_7_MV1); - (cellholds_5_7_MV1, cellholds_2_7_MV1); - (cellholds_5_7_MV1, cellholds_1_7_MV1); - (cellholds_5_6_MV1, cellholds_8_6_MV1); - (cellholds_5_6_MV1, cellholds_7_6_MV1); - (cellholds_5_6_MV1, cellholds_6_6_MV1); - (cellholds_5_6_MV1, cellholds_5_6_MV1); - (cellholds_5_6_MV1, cellholds_4_6_MV1); - (cellholds_5_6_MV1, cellholds_3_6_MV1); - (cellholds_5_6_MV1, cellholds_2_6_MV1); - (cellholds_5_6_MV1, cellholds_1_6_MV1); - (cellholds_5_5_MV1, cellholds_8_5_MV1); - (cellholds_5_5_MV1, cellholds_7_5_MV1); - (cellholds_5_5_MV1, cellholds_6_5_MV1); - (cellholds_5_5_MV1, cellholds_5_5_MV1); - (cellholds_5_5_MV1, cellholds_4_5_MV1); - (cellholds_5_5_MV1, cellholds_3_5_MV1); - (cellholds_5_5_MV1, cellholds_2_5_MV1); - (cellholds_5_5_MV1, cellholds_1_5_MV1); - (cellholds_5_4_MV1, cellholds_8_4_MV1); - (cellholds_5_4_MV1, cellholds_7_4_MV1); - (cellholds_5_4_MV1, cellholds_6_4_MV1); - (cellholds_5_4_MV1, cellholds_5_4_MV1); - (cellholds_5_4_MV1, cellholds_4_4_MV1); - (cellholds_5_4_MV1, cellholds_3_4_MV1); - (cellholds_5_4_MV1, cellholds_2_4_MV1); - (cellholds_5_4_MV1, cellholds_1_4_MV1); - (cellholds_5_3_MV1, cellholds_8_3_MV1); - (cellholds_5_3_MV1, cellholds_7_3_MV1); - (cellholds_5_3_MV1, cellholds_6_3_MV1); - (cellholds_5_3_MV1, cellholds_5_3_MV1); - (cellholds_5_3_MV1, cellholds_4_3_MV1); - (cellholds_5_3_MV1, cellholds_3_3_MV1); - (cellholds_5_3_MV1, cellholds_2_3_MV1); - (cellholds_5_3_MV1, cellholds_1_3_MV1); - (cellholds_5_2_MV1, cellholds_8_2_MV1); - (cellholds_5_2_MV1, cellholds_7_2_MV1); - (cellholds_5_2_MV1, cellholds_6_2_MV1); - (cellholds_5_2_MV1, cellholds_5_2_MV1); - (cellholds_5_2_MV1, cellholds_4_2_MV1); - (cellholds_5_2_MV1, cellholds_3_2_MV1); - (cellholds_5_2_MV1, cellholds_2_2_MV1); - (cellholds_5_2_MV1, cellholds_1_2_MV1); - (cellholds_5_1_MV1, cellholds_8_1_MV1); - (cellholds_5_1_MV1, cellholds_7_1_MV1); - (cellholds_5_1_MV1, cellholds_6_1_MV1); - (cellholds_5_1_MV1, cellholds_5_1_MV1); - (cellholds_5_1_MV1, cellholds_4_1_MV1); - (cellholds_5_1_MV1, cellholds_3_1_MV1); - (cellholds_5_1_MV1, cellholds_2_1_MV1); - (cellholds_5_1_MV1, cellholds_1_1_MV1); - (cellholds_4_8_MV1, cellholds_8_8_MV1); - (cellholds_4_8_MV1, cellholds_7_8_MV1); - (cellholds_4_8_MV1, cellholds_6_8_MV1); - (cellholds_4_8_MV1, cellholds_5_8_MV1); - (cellholds_4_8_MV1, cellholds_4_8_MV1); - (cellholds_4_8_MV1, cellholds_3_8_MV1); - (cellholds_4_8_MV1, cellholds_2_8_MV1); - (cellholds_4_8_MV1, cellholds_1_8_MV1); - (cellholds_4_7_MV1, cellholds_8_7_MV1); - (cellholds_4_7_MV1, cellholds_7_7_MV1); - (cellholds_4_7_MV1, cellholds_6_7_MV1); - (cellholds_4_7_MV1, cellholds_5_7_MV1); - (cellholds_4_7_MV1, cellholds_4_7_MV1); - (cellholds_4_7_MV1, cellholds_3_7_MV1); - (cellholds_4_7_MV1, cellholds_2_7_MV1); - (cellholds_4_7_MV1, cellholds_1_7_MV1); - (cellholds_4_6_MV1, cellholds_8_6_MV1); - (cellholds_4_6_MV1, cellholds_7_6_MV1); - (cellholds_4_6_MV1, cellholds_6_6_MV1); - (cellholds_4_6_MV1, cellholds_5_6_MV1); - (cellholds_4_6_MV1, cellholds_4_6_MV1); - (cellholds_4_6_MV1, cellholds_3_6_MV1); - (cellholds_4_6_MV1, cellholds_2_6_MV1); - (cellholds_4_6_MV1, cellholds_1_6_MV1); - (cellholds_4_5_MV1, cellholds_8_5_MV1); - (cellholds_4_5_MV1, cellholds_7_5_MV1); - (cellholds_4_5_MV1, cellholds_6_5_MV1); - (cellholds_4_5_MV1, cellholds_5_5_MV1); - (cellholds_4_5_MV1, cellholds_4_5_MV1); - (cellholds_4_5_MV1, cellholds_3_5_MV1); - (cellholds_4_5_MV1, cellholds_2_5_MV1); - (cellholds_4_5_MV1, cellholds_1_5_MV1); - (cellholds_4_4_MV1, cellholds_8_4_MV1); - (cellholds_4_4_MV1, cellholds_7_4_MV1); - (cellholds_4_4_MV1, cellholds_6_4_MV1); - (cellholds_4_4_MV1, cellholds_5_4_MV1); - (cellholds_4_4_MV1, cellholds_4_4_MV1); - (cellholds_4_4_MV1, cellholds_3_4_MV1); - (cellholds_4_4_MV1, cellholds_2_4_MV1); - (cellholds_4_4_MV1, cellholds_1_4_MV1); - (cellholds_4_3_MV1, cellholds_8_3_MV1); - (cellholds_4_3_MV1, cellholds_7_3_MV1); - (cellholds_4_3_MV1, cellholds_6_3_MV1); - (cellholds_4_3_MV1, cellholds_5_3_MV1); - (cellholds_4_3_MV1, cellholds_4_3_MV1); - (cellholds_4_3_MV1, cellholds_3_3_MV1); - (cellholds_4_3_MV1, cellholds_2_3_MV1); - (cellholds_4_3_MV1, cellholds_1_3_MV1); - (cellholds_4_2_MV1, cellholds_8_2_MV1); - (cellholds_4_2_MV1, cellholds_7_2_MV1); - (cellholds_4_2_MV1, cellholds_6_2_MV1); - (cellholds_4_2_MV1, cellholds_5_2_MV1); - (cellholds_4_2_MV1, cellholds_4_2_MV1); - (cellholds_4_2_MV1, cellholds_3_2_MV1); - (cellholds_4_2_MV1, cellholds_2_2_MV1); - (cellholds_4_2_MV1, cellholds_1_2_MV1); - (cellholds_4_1_MV1, cellholds_8_1_MV1); - (cellholds_4_1_MV1, cellholds_7_1_MV1); - (cellholds_4_1_MV1, cellholds_6_1_MV1); - (cellholds_4_1_MV1, cellholds_5_1_MV1); - (cellholds_4_1_MV1, cellholds_4_1_MV1); - (cellholds_4_1_MV1, cellholds_3_1_MV1); - (cellholds_4_1_MV1, cellholds_2_1_MV1); - (cellholds_4_1_MV1, cellholds_1_1_MV1); - (cellholds_3_8_MV1, cellholds_8_8_MV1); - (cellholds_3_8_MV1, cellholds_7_8_MV1); - (cellholds_3_8_MV1, cellholds_6_8_MV1); - (cellholds_3_8_MV1, cellholds_5_8_MV1); - (cellholds_3_8_MV1, cellholds_4_8_MV1); - (cellholds_3_8_MV1, cellholds_3_8_MV1); - (cellholds_3_8_MV1, cellholds_2_8_MV1); - (cellholds_3_8_MV1, cellholds_1_8_MV1); - (cellholds_3_7_MV1, cellholds_8_7_MV1); - (cellholds_3_7_MV1, cellholds_7_7_MV1); - (cellholds_3_7_MV1, cellholds_6_7_MV1); - (cellholds_3_7_MV1, cellholds_5_7_MV1); - (cellholds_3_7_MV1, cellholds_4_7_MV1); - (cellholds_3_7_MV1, cellholds_3_7_MV1); - (cellholds_3_7_MV1, cellholds_2_7_MV1); - (cellholds_3_7_MV1, cellholds_1_7_MV1); - (cellholds_3_6_MV1, cellholds_8_6_MV1); - (cellholds_3_6_MV1, cellholds_7_6_MV1); - (cellholds_3_6_MV1, cellholds_6_6_MV1); - (cellholds_3_6_MV1, cellholds_5_6_MV1); - (cellholds_3_6_MV1, cellholds_4_6_MV1); - (cellholds_3_6_MV1, cellholds_3_6_MV1); - (cellholds_3_6_MV1, cellholds_2_6_MV1); - (cellholds_3_6_MV1, cellholds_1_6_MV1); - (cellholds_3_5_MV1, cellholds_8_5_MV1); - (cellholds_3_5_MV1, cellholds_7_5_MV1); - (cellholds_3_5_MV1, cellholds_6_5_MV1); - (cellholds_3_5_MV1, cellholds_5_5_MV1); - (cellholds_3_5_MV1, cellholds_4_5_MV1); - (cellholds_3_5_MV1, cellholds_3_5_MV1); - (cellholds_3_5_MV1, cellholds_2_5_MV1); - (cellholds_3_5_MV1, cellholds_1_5_MV1); - (cellholds_3_4_MV1, cellholds_8_4_MV1); - (cellholds_3_4_MV1, cellholds_7_4_MV1); - (cellholds_3_4_MV1, cellholds_6_4_MV1); - (cellholds_3_4_MV1, cellholds_5_4_MV1); - (cellholds_3_4_MV1, cellholds_4_4_MV1); - (cellholds_3_4_MV1, cellholds_3_4_MV1); - (cellholds_3_4_MV1, cellholds_2_4_MV1); - (cellholds_3_4_MV1, cellholds_1_4_MV1); - (cellholds_3_3_MV1, cellholds_8_3_MV1); - (cellholds_3_3_MV1, cellholds_7_3_MV1); - (cellholds_3_3_MV1, cellholds_6_3_MV1); - (cellholds_3_3_MV1, cellholds_5_3_MV1); - (cellholds_3_3_MV1, cellholds_4_3_MV1); - (cellholds_3_3_MV1, cellholds_3_3_MV1); - (cellholds_3_3_MV1, cellholds_2_3_MV1); - (cellholds_3_3_MV1, cellholds_1_3_MV1); - (cellholds_3_2_MV1, cellholds_8_2_MV1); - (cellholds_3_2_MV1, cellholds_7_2_MV1); - (cellholds_3_2_MV1, cellholds_6_2_MV1); - (cellholds_3_2_MV1, cellholds_5_2_MV1); - (cellholds_3_2_MV1, cellholds_4_2_MV1); - (cellholds_3_2_MV1, cellholds_3_2_MV1); - (cellholds_3_2_MV1, cellholds_2_2_MV1); - (cellholds_3_2_MV1, cellholds_1_2_MV1); - (cellholds_3_1_MV1, cellholds_8_1_MV1); - (cellholds_3_1_MV1, cellholds_7_1_MV1); - (cellholds_3_1_MV1, cellholds_6_1_MV1); - (cellholds_3_1_MV1, cellholds_5_1_MV1); - (cellholds_3_1_MV1, cellholds_4_1_MV1); - (cellholds_3_1_MV1, cellholds_3_1_MV1); - (cellholds_3_1_MV1, cellholds_2_1_MV1); - (cellholds_3_1_MV1, cellholds_1_1_MV1); - (cellholds_2_8_MV1, cellholds_8_8_MV1); - (cellholds_2_8_MV1, cellholds_7_8_MV1); - (cellholds_2_8_MV1, cellholds_6_8_MV1); - (cellholds_2_8_MV1, cellholds_5_8_MV1); - (cellholds_2_8_MV1, cellholds_4_8_MV1); - (cellholds_2_8_MV1, cellholds_3_8_MV1); - (cellholds_2_8_MV1, cellholds_2_8_MV1); - (cellholds_2_8_MV1, cellholds_1_8_MV1); - (cellholds_2_7_MV1, cellholds_8_7_MV1); - (cellholds_2_7_MV1, cellholds_7_7_MV1); - (cellholds_2_7_MV1, cellholds_6_7_MV1); - (cellholds_2_7_MV1, cellholds_5_7_MV1); - (cellholds_2_7_MV1, cellholds_4_7_MV1); - (cellholds_2_7_MV1, cellholds_3_7_MV1); - (cellholds_2_7_MV1, cellholds_2_7_MV1); - (cellholds_2_7_MV1, cellholds_1_7_MV1); - (cellholds_2_6_MV1, cellholds_8_6_MV1); - (cellholds_2_6_MV1, cellholds_7_6_MV1); - (cellholds_2_6_MV1, cellholds_6_6_MV1); - (cellholds_2_6_MV1, cellholds_5_6_MV1); - (cellholds_2_6_MV1, cellholds_4_6_MV1); - (cellholds_2_6_MV1, cellholds_3_6_MV1); - (cellholds_2_6_MV1, cellholds_2_6_MV1); - (cellholds_2_6_MV1, cellholds_1_6_MV1); - (cellholds_2_5_MV1, cellholds_8_5_MV1); - (cellholds_2_5_MV1, cellholds_7_5_MV1); - (cellholds_2_5_MV1, cellholds_6_5_MV1); - (cellholds_2_5_MV1, cellholds_5_5_MV1); - (cellholds_2_5_MV1, cellholds_4_5_MV1); - (cellholds_2_5_MV1, cellholds_3_5_MV1); - (cellholds_2_5_MV1, cellholds_2_5_MV1); - (cellholds_2_5_MV1, cellholds_1_5_MV1); - (cellholds_2_4_MV1, cellholds_8_4_MV1); - (cellholds_2_4_MV1, cellholds_7_4_MV1); - (cellholds_2_4_MV1, cellholds_6_4_MV1); - (cellholds_2_4_MV1, cellholds_5_4_MV1); - (cellholds_2_4_MV1, cellholds_4_4_MV1); - (cellholds_2_4_MV1, cellholds_3_4_MV1); - (cellholds_2_4_MV1, cellholds_2_4_MV1); - (cellholds_2_4_MV1, cellholds_1_4_MV1); - (cellholds_2_3_MV1, cellholds_8_3_MV1); - (cellholds_2_3_MV1, cellholds_7_3_MV1); - (cellholds_2_3_MV1, cellholds_6_3_MV1); - (cellholds_2_3_MV1, cellholds_5_3_MV1); - (cellholds_2_3_MV1, cellholds_4_3_MV1); - (cellholds_2_3_MV1, cellholds_3_3_MV1); - (cellholds_2_3_MV1, cellholds_2_3_MV1); - (cellholds_2_3_MV1, cellholds_1_3_MV1); - (cellholds_2_2_MV1, cellholds_8_2_MV1); - (cellholds_2_2_MV1, cellholds_7_2_MV1); - (cellholds_2_2_MV1, cellholds_6_2_MV1); - (cellholds_2_2_MV1, cellholds_5_2_MV1); - (cellholds_2_2_MV1, cellholds_4_2_MV1); - (cellholds_2_2_MV1, cellholds_3_2_MV1); - (cellholds_2_2_MV1, cellholds_2_2_MV1); - (cellholds_2_2_MV1, cellholds_1_2_MV1); - (cellholds_2_1_MV1, cellholds_8_1_MV1); - (cellholds_2_1_MV1, cellholds_7_1_MV1); - (cellholds_2_1_MV1, cellholds_6_1_MV1); - (cellholds_2_1_MV1, cellholds_5_1_MV1); - (cellholds_2_1_MV1, cellholds_4_1_MV1); - (cellholds_2_1_MV1, cellholds_3_1_MV1); - (cellholds_2_1_MV1, cellholds_2_1_MV1); - (cellholds_2_1_MV1, cellholds_1_1_MV1); - (cellholds_1_8_MV1, cellholds_8_8_MV1); - (cellholds_1_8_MV1, cellholds_7_8_MV1); - (cellholds_1_8_MV1, cellholds_6_8_MV1); - (cellholds_1_8_MV1, cellholds_5_8_MV1); - (cellholds_1_8_MV1, cellholds_4_8_MV1); - (cellholds_1_8_MV1, cellholds_3_8_MV1); - (cellholds_1_8_MV1, cellholds_2_8_MV1); - (cellholds_1_8_MV1, cellholds_1_8_MV1); - (cellholds_1_7_MV1, cellholds_8_7_MV1); - (cellholds_1_7_MV1, cellholds_7_7_MV1); - (cellholds_1_7_MV1, cellholds_6_7_MV1); - (cellholds_1_7_MV1, cellholds_5_7_MV1); - (cellholds_1_7_MV1, cellholds_4_7_MV1); - (cellholds_1_7_MV1, cellholds_3_7_MV1); - (cellholds_1_7_MV1, cellholds_2_7_MV1); - (cellholds_1_7_MV1, cellholds_1_7_MV1); - (cellholds_1_6_MV1, cellholds_8_6_MV1); - (cellholds_1_6_MV1, cellholds_7_6_MV1); - (cellholds_1_6_MV1, cellholds_6_6_MV1); - (cellholds_1_6_MV1, cellholds_5_6_MV1); - (cellholds_1_6_MV1, cellholds_4_6_MV1); - (cellholds_1_6_MV1, cellholds_3_6_MV1); - (cellholds_1_6_MV1, cellholds_2_6_MV1); - (cellholds_1_6_MV1, cellholds_1_6_MV1); - (cellholds_1_5_MV1, cellholds_8_5_MV1); - (cellholds_1_5_MV1, cellholds_7_5_MV1); - (cellholds_1_5_MV1, cellholds_6_5_MV1); - (cellholds_1_5_MV1, cellholds_5_5_MV1); - (cellholds_1_5_MV1, cellholds_4_5_MV1); - (cellholds_1_5_MV1, cellholds_3_5_MV1); - (cellholds_1_5_MV1, cellholds_2_5_MV1); - (cellholds_1_5_MV1, cellholds_1_5_MV1); - (cellholds_1_4_MV1, cellholds_8_4_MV1); - (cellholds_1_4_MV1, cellholds_7_4_MV1); - (cellholds_1_4_MV1, cellholds_6_4_MV1); - (cellholds_1_4_MV1, cellholds_5_4_MV1); - (cellholds_1_4_MV1, cellholds_4_4_MV1); - (cellholds_1_4_MV1, cellholds_3_4_MV1); - (cellholds_1_4_MV1, cellholds_2_4_MV1); - (cellholds_1_4_MV1, cellholds_1_4_MV1); - (cellholds_1_3_MV1, cellholds_8_3_MV1); - (cellholds_1_3_MV1, cellholds_7_3_MV1); - (cellholds_1_3_MV1, cellholds_6_3_MV1); - (cellholds_1_3_MV1, cellholds_5_3_MV1); - (cellholds_1_3_MV1, cellholds_4_3_MV1); - (cellholds_1_3_MV1, cellholds_3_3_MV1); - (cellholds_1_3_MV1, cellholds_2_3_MV1); - (cellholds_1_3_MV1, cellholds_1_3_MV1); - (cellholds_1_2_MV1, cellholds_8_2_MV1); - (cellholds_1_2_MV1, cellholds_7_2_MV1); - (cellholds_1_2_MV1, cellholds_6_2_MV1); - (cellholds_1_2_MV1, cellholds_5_2_MV1); - (cellholds_1_2_MV1, cellholds_4_2_MV1); - (cellholds_1_2_MV1, cellholds_3_2_MV1); - (cellholds_1_2_MV1, cellholds_2_2_MV1); - (cellholds_1_2_MV1, cellholds_1_2_MV1); - (cellholds_1_1_MV1, cellholds_8_1_MV1); - (cellholds_1_1_MV1, cellholds_7_1_MV1); - (cellholds_1_1_MV1, cellholds_6_1_MV1); - (cellholds_1_1_MV1, cellholds_5_1_MV1); - (cellholds_1_1_MV1, cellholds_4_1_MV1); - (cellholds_1_1_MV1, cellholds_3_1_MV1); - (cellholds_1_1_MV1, cellholds_2_1_MV1); - (cellholds_1_1_MV1, cellholds_1_1_MV1) - }; - cellholds_1_y2_MV1 { - cellholds_1_8_MV1; cellholds_1_7_MV1; cellholds_1_6_MV1; - cellholds_1_5_MV1; cellholds_1_4_MV1; cellholds_1_3_MV1; - cellholds_1_2_MV1; cellholds_1_1_MV1 - }; - cellholds_2_y2_MV1 { - cellholds_2_8_MV1; cellholds_2_7_MV1; cellholds_2_6_MV1; - cellholds_2_5_MV1; cellholds_2_4_MV1; cellholds_2_3_MV1; - cellholds_2_2_MV1; cellholds_2_1_MV1 - }; - cellholds_3_y2_MV1 { - cellholds_3_8_MV1; cellholds_3_7_MV1; cellholds_3_6_MV1; - cellholds_3_5_MV1; cellholds_3_4_MV1; cellholds_3_3_MV1; - cellholds_3_2_MV1; cellholds_3_1_MV1 - }; - cellholds_4_y2_MV1 { - cellholds_4_8_MV1; cellholds_4_7_MV1; cellholds_4_6_MV1; - cellholds_4_5_MV1; cellholds_4_4_MV1; cellholds_4_3_MV1; - cellholds_4_2_MV1; cellholds_4_1_MV1 - }; - cellholds_5_y2_MV1 { - cellholds_5_8_MV1; cellholds_5_7_MV1; cellholds_5_6_MV1; - cellholds_5_5_MV1; cellholds_5_4_MV1; cellholds_5_3_MV1; - cellholds_5_2_MV1; cellholds_5_1_MV1 - }; - cellholds_6_y2_MV1 { - cellholds_6_8_MV1; cellholds_6_7_MV1; cellholds_6_6_MV1; - cellholds_6_5_MV1; cellholds_6_4_MV1; cellholds_6_3_MV1; - cellholds_6_2_MV1; cellholds_6_1_MV1 - }; - cellholds_7_y2_MV1 { - cellholds_7_8_MV1; cellholds_7_7_MV1; cellholds_7_6_MV1; - cellholds_7_5_MV1; cellholds_7_4_MV1; cellholds_7_3_MV1; - cellholds_7_2_MV1; cellholds_7_1_MV1 - }; - cellholds_8_y2_MV1 { - cellholds_8_8_MV1; cellholds_8_7_MV1; cellholds_8_6_MV1; - cellholds_8_5_MV1; cellholds_8_4_MV1; cellholds_8_3_MV1; - cellholds_8_2_MV1; cellholds_8_1_MV1 - }; cellholds_x2_1_MV1 { cellholds_8_1_MV1; cellholds_7_1_MV1; cellholds_6_1_MV1; cellholds_5_1_MV1; cellholds_4_1_MV1; cellholds_3_1_MV1; cellholds_2_1_MV1; cellholds_1_1_MV1 }; - cellholds_x2_2_MV1 { - cellholds_8_2_MV1; cellholds_7_2_MV1; cellholds_6_2_MV1; - cellholds_5_2_MV1; cellholds_4_2_MV1; cellholds_3_2_MV1; - cellholds_2_2_MV1; cellholds_1_2_MV1 - }; - cellholds_x2_3_MV1 { - cellholds_8_3_MV1; cellholds_7_3_MV1; cellholds_6_3_MV1; - cellholds_5_3_MV1; cellholds_4_3_MV1; cellholds_3_3_MV1; - cellholds_2_3_MV1; cellholds_1_3_MV1 - }; - cellholds_x2_4_MV1 { - cellholds_8_4_MV1; cellholds_7_4_MV1; cellholds_6_4_MV1; - cellholds_5_4_MV1; cellholds_4_4_MV1; cellholds_3_4_MV1; - cellholds_2_4_MV1; cellholds_1_4_MV1 - }; - cellholds_x2_5_MV1 { - cellholds_8_5_MV1; cellholds_7_5_MV1; cellholds_6_5_MV1; - cellholds_5_5_MV1; cellholds_4_5_MV1; cellholds_3_5_MV1; - cellholds_2_5_MV1; cellholds_1_5_MV1 - }; - cellholds_x2_6_MV1 { - cellholds_8_6_MV1; cellholds_7_6_MV1; cellholds_6_6_MV1; - cellholds_5_6_MV1; cellholds_4_6_MV1; cellholds_3_6_MV1; - cellholds_2_6_MV1; cellholds_1_6_MV1 - }; - cellholds_x2_7_MV1 { - cellholds_8_7_MV1; cellholds_7_7_MV1; cellholds_6_7_MV1; - cellholds_5_7_MV1; cellholds_4_7_MV1; cellholds_3_7_MV1; - cellholds_2_7_MV1; cellholds_1_7_MV1 - }; cellholds_x2_8_MV1 { cellholds_8_8_MV1; cellholds_7_8_MV1; cellholds_6_8_MV1; cellholds_5_8_MV1; cellholds_4_8_MV1; cellholds_3_8_MV1; @@ -1492,8 +852,7 @@ cellholds_2_2_MV1; cellholds_2_1_MV1; cellholds_1_2_MV1; cellholds_1_1_MV1 }; - control_MV1 (control_MV1); control_black:1 {}; - control_white (control_MV1); + control_black:1 {}; control_white (control_MV1); index__cellholds_x2_y2_MV1_y2 { cellholds_8_8_MV1; cellholds_8_7_MV1; cellholds_8_6_MV1; cellholds_8_5_MV1; cellholds_8_4_MV1; cellholds_8_3_MV1; @@ -1518,7 +877,6 @@ cellholds_1_4_MV1; cellholds_1_3_MV1; cellholds_1_2_MV1; cellholds_1_1_MV1 }; - role__cellholds_x2_y2_MV1_y2:1 {}; succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_x2 { (cellholds_7_8_MV1, cellholds_8_8_MV1); (cellholds_7_8_MV1, cellholds_8_7_MV1); @@ -1969,906 +1327,6 @@ (cellholds_1_1_MV1, cellholds_2_2_MV1); (cellholds_1_1_MV1, cellholds_2_1_MV1) }; - succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_y2 { - (cellholds_7_8_MV1, cellholds_8_8_MV1); - (cellholds_7_8_MV1, cellholds_7_8_MV1); - (cellholds_7_8_MV1, cellholds_6_8_MV1); - (cellholds_7_8_MV1, cellholds_5_8_MV1); - (cellholds_7_8_MV1, cellholds_4_8_MV1); - (cellholds_7_8_MV1, cellholds_3_8_MV1); - (cellholds_7_8_MV1, cellholds_2_8_MV1); - (cellholds_7_8_MV1, cellholds_1_8_MV1); - (cellholds_7_7_MV1, cellholds_8_8_MV1); - (cellholds_7_7_MV1, cellholds_7_8_MV1); - (cellholds_7_7_MV1, cellholds_6_8_MV1); - (cellholds_7_7_MV1, cellholds_5_8_MV1); - (cellholds_7_7_MV1, cellholds_4_8_MV1); - (cellholds_7_7_MV1, cellholds_3_8_MV1); - (cellholds_7_7_MV1, cellholds_2_8_MV1); - (cellholds_7_7_MV1, cellholds_1_8_MV1); - (cellholds_7_6_MV1, cellholds_8_8_MV1); - (cellholds_7_6_MV1, cellholds_7_8_MV1); - (cellholds_7_6_MV1, cellholds_6_8_MV1); - (cellholds_7_6_MV1, cellholds_5_8_MV1); - (cellholds_7_6_MV1, cellholds_4_8_MV1); - (cellholds_7_6_MV1, cellholds_3_8_MV1); - (cellholds_7_6_MV1, cellholds_2_8_MV1); - (cellholds_7_6_MV1, cellholds_1_8_MV1); - (cellholds_7_5_MV1, cellholds_8_8_MV1); - (cellholds_7_5_MV1, cellholds_7_8_MV1); - (cellholds_7_5_MV1, cellholds_6_8_MV1); - (cellholds_7_5_MV1, cellholds_5_8_MV1); - (cellholds_7_5_MV1, cellholds_4_8_MV1); - (cellholds_7_5_MV1, cellholds_3_8_MV1); - (cellholds_7_5_MV1, cellholds_2_8_MV1); - (cellholds_7_5_MV1, cellholds_1_8_MV1); - (cellholds_7_4_MV1, cellholds_8_8_MV1); - (cellholds_7_4_MV1, cellholds_7_8_MV1); - (cellholds_7_4_MV1, cellholds_6_8_MV1); - (cellholds_7_4_MV1, cellholds_5_8_MV1); - (cellholds_7_4_MV1, cellholds_4_8_MV1); - (cellholds_7_4_MV1, cellholds_3_8_MV1); - (cellholds_7_4_MV1, cellholds_2_8_MV1); - (cellholds_7_4_MV1, cellholds_1_8_MV1); - (cellholds_7_3_MV1, cellholds_8_8_MV1); - (cellholds_7_3_MV1, cellholds_7_8_MV1); - (cellholds_7_3_MV1, cellholds_6_8_MV1); - (cellholds_7_3_MV1, cellholds_5_8_MV1); - (cellholds_7_3_MV1, cellholds_4_8_MV1); - (cellholds_7_3_MV1, cellholds_3_8_MV1); - (cellholds_7_3_MV1, cellholds_2_8_MV1); - (cellholds_7_3_MV1, cellholds_1_8_MV1); - (cellholds_7_2_MV1, cellholds_8_8_MV1); - (cellholds_7_2_MV1, cellholds_7_8_MV1); - (cellholds_7_2_MV1, cellholds_6_8_MV1); - (cellholds_7_2_MV1, cellholds_5_8_MV1); - (cellholds_7_2_MV1, cellholds_4_8_MV1); - (cellholds_7_2_MV1, cellholds_3_8_MV1); - (cellholds_7_2_MV1, cellholds_2_8_MV1); - (cellholds_7_2_MV1, cellholds_1_8_MV1); - (cellholds_7_1_MV1, cellholds_8_8_MV1); - (cellholds_7_1_MV1, cellholds_7_8_MV1); - (cellholds_7_1_MV1, cellholds_6_8_MV1); - (cellholds_7_1_MV1, cellholds_5_8_MV1); - (cellholds_7_1_MV1, cellholds_4_8_MV1); - (cellholds_7_1_MV1, cellholds_3_8_MV1); - (cellholds_7_1_MV1, cellholds_2_8_MV1); - (cellholds_7_1_MV1, cellholds_1_8_MV1); - (cellholds_6_8_MV1, cellholds_8_7_MV1); - (cellholds_6_8_MV1, cellholds_7_7_MV1); - (cellholds_6_8_MV1, cellholds_6_7_MV1); - (cellholds_6_8_MV1, cellholds_5_7_MV1); - (cellholds_6_8_MV1, cellholds_4_7_MV1); - (cellholds_6_8_MV1, cellholds_3_7_MV1); - (cellholds_6_8_MV1, cellholds_2_7_MV1); - (cellholds_6_8_MV1, cellholds_1_7_MV1); - (cellholds_6_7_MV1, cellholds_8_7_MV1); - (cellholds_6_7_MV1, cellholds_7_7_MV1); - (cellholds_6_7_MV1, cellholds_6_7_MV1); - (cellholds_6_7_MV1, cellholds_5_7_MV1); - (cellholds_6_7_MV1, cellholds_4_7_MV1); - (cellholds_6_7_MV1, cellholds_3_7_MV1); - (cellholds_6_7_MV1, cellholds_2_7_MV1); - (cellholds_6_7_MV1, cellholds_1_7_MV1); - (cellholds_6_6_MV1, cellholds_8_7_MV1); - (cellholds_6_6_MV1, cellholds_7_7_MV1); - (cellholds_6_6_MV1, cellholds_6_7_MV1); - (cellholds_6_6_MV1, cellholds_5_7_MV1); - (cellholds_6_6_MV1, cellholds_4_7_MV1); - (cellholds_6_6_MV1, cellholds_3_7_MV1); - (cellholds_6_6_MV1, cellholds_2_7_MV1); - (cellholds_6_6_MV1, cellholds_1_7_MV1); - (cellholds_6_5_MV1, cellholds_8_7_MV1); - (cellholds_6_5_MV1, cellholds_7_7_MV1); - (cellholds_6_5_MV1, cellholds_6_7_MV1); - (cellholds_6_5_MV1, cellholds_5_7_MV1); - (cellholds_6_5_MV1, cellholds_4_7_MV1); - (cellholds_6_5_MV1, cellholds_3_7_MV1); - (cellholds_6_5_MV1, cellholds_2_7_MV1); - (cellholds_6_5_MV1, cellholds_1_7_MV1); - (cellholds_6_4_MV1, cellholds_8_7_MV1); - (cellholds_6_4_MV1, cellholds_7_7_MV1); - (cellholds_6_4_MV1, cellholds_6_7_MV1); - (cellholds_6_4_MV1, cellholds_5_7_MV1); - (cellholds_6_4_MV1, cellholds_4_7_MV1); - (cellholds_6_4_MV1, cellholds_3_7_MV1); - (cellholds_6_4_MV1, cellholds_2_7_MV1); - (cellholds_6_4_MV1, cellholds_1_7_MV1); - (cellholds_6_3_MV1, cellholds_8_7_MV1); - (cellholds_6_3_MV1, cellholds_7_7_MV1); - (cellholds_6_3_MV1, cellholds_6_7_MV1); - (cellholds_6_3_MV1, cellholds_5_7_MV1); - (cellholds_6_3_MV1, cellholds_4_7_MV1); - (cellholds_6_3_MV1, cellholds_3_7_MV1); - (cellholds_6_3_MV1, cellholds_2_7_MV1); - (cellholds_6_3_MV1, cellholds_1_7_MV1); - (cellholds_6_2_MV1, cellholds_8_7_MV1); - (cellholds_6_2_MV1, cellholds_7_7_MV1); - (cellholds_6_2_MV1, cellholds_6_7_MV1); - (cellholds_6_2_MV1, cellholds_5_7_MV1); - (cellholds_6_2_MV1, cellholds_4_7_MV1); - (cellholds_6_2_MV1, cellholds_3_7_MV1); - (cellholds_6_2_MV1, cellholds_2_7_MV1); - (cellholds_6_2_MV1, cellholds_1_7_MV1); - (cellholds_6_1_MV1, cellholds_8_7_MV1); - (cellholds_6_1_MV1, cellholds_7_7_MV1); - (cellholds_6_1_MV1, cellholds_6_7_MV1); - (cellholds_6_1_MV1, cellholds_5_7_MV1); - (cellholds_6_1_MV1, cellholds_4_7_MV1); - (cellholds_6_1_MV1, cellholds_3_7_MV1); - (cellholds_6_1_MV1, cellholds_2_7_MV1); - (cellholds_6_1_MV1, cellholds_1_7_MV1); - (cellholds_5_8_MV1, cellholds_8_6_MV1); - (cellholds_5_8_MV1, cellholds_7_6_MV1); - (cellholds_5_8_MV1, cellholds_6_6_MV1); - (cellholds_5_8_MV1, cellholds_5_6_MV1); - (cellholds_5_8_MV1, cellholds_4_6_MV1); - (cellholds_5_8_MV1, cellholds_3_6_MV1); - (cellholds_5_8_MV1, cellholds_2_6_MV1); - (cellholds_5_8_MV1, cellholds_1_6_MV1); - (cellholds_5_7_MV1, cellholds_8_6_MV1); - (cellholds_5_7_MV1, cellholds_7_6_MV1); - (cellholds_5_7_MV1, cellholds_6_6_MV1); - (cellholds_5_7_MV1, cellholds_5_6_MV1); - (cellholds_5_7_MV1, cellholds_4_6_MV1); - (cellholds_5_7_MV1, cellholds_3_6_MV1); - (cellholds_5_7_MV1, cellholds_2_6_MV1); - (cellholds_5_7_MV1, cellholds_1_6_MV1); - (cellholds_5_6_MV1, cellholds_8_6_MV1); - (cellholds_5_6_MV1, cellholds_7_6_MV1); - (cellholds_5_6_MV1, cellholds_6_6_MV1); - (cellholds_5_6_MV1, cellholds_5_6_MV1); - (cellholds_5_6_MV1, cellholds_4_6_MV1); - (cellholds_5_6_MV1, cellholds_3_6_MV1); - (cellholds_5_6_MV1, cellholds_2_6_MV1); - (cellholds_5_6_MV1, cellholds_1_6_MV1); - (cellholds_5_5_MV1, cellholds_8_6_MV1); - (cellholds_5_5_MV1, cellholds_7_6_MV1); - (cellholds_5_5_MV1, cellholds_6_6_MV1); - (cellholds_5_5_MV1, cellholds_5_6_MV1); - (cellholds_5_5_MV1, cellholds_4_6_MV1); - (cellholds_5_5_MV1, cellholds_3_6_MV1); - (cellholds_5_5_MV1, cellholds_2_6_MV1); - (cellholds_5_5_MV1, cellholds_1_6_MV1); - (cellholds_5_4_MV1, cellholds_8_6_MV1); - (cellholds_5_4_MV1, cellholds_7_6_MV1); - (cellholds_5_4_MV1, cellholds_6_6_MV1); - (cellholds_5_4_MV1, cellholds_5_6_MV1); - (cellholds_5_4_MV1, cellholds_4_6_MV1); - (cellholds_5_4_MV1, cellholds_3_6_MV1); - (cellholds_5_4_MV1, cellholds_2_6_MV1); - (cellholds_5_4_MV1, cellholds_1_6_MV1); - (cellholds_5_3_MV1, cellholds_8_6_MV1); - (cellholds_5_3_MV1, cellholds_7_6_MV1); - (cellholds_5_3_MV1, cellholds_6_6_MV1); - (cellholds_5_3_MV1, cellholds_5_6_MV1); - (cellholds_5_3_MV1, cellholds_4_6_MV1); - (cellholds_5_3_MV1, cellholds_3_6_MV1); - (cellholds_5_3_MV1, cellholds_2_6_MV1); - (cellholds_5_3_MV1, cellholds_1_6_MV1); - (cellholds_5_2_MV1, cellholds_8_6_MV1); - (cellholds_5_2_MV1, cellholds_7_6_MV1); - (cellholds_5_2_MV1, cellholds_6_6_MV1); - (cellholds_5_2_MV1, cellholds_5_6_MV1); - (cellholds_5_2_MV1, cellholds_4_6_MV1); - (cellholds_5_2_MV1, cellholds_3_6_MV1); - (cellholds_5_2_MV1, cellholds_2_6_MV1); - (cellholds_5_2_MV1, cellholds_1_6_MV1); - (cellholds_5_1_MV1, cellholds_8_6_MV1); - (cellholds_5_1_MV1, cellholds_7_6_MV1); - (cellholds_5_1_MV1, cellholds_6_6_MV1); - (cellholds_5_1_MV1, cellholds_5_6_MV1); - (cellholds_5_1_MV1, cellholds_4_6_MV1); - (cellholds_5_1_MV1, cellholds_3_6_MV1); - (cellholds_5_1_MV1, cellholds_2_6_MV1); - (cellholds_5_1_MV1, cellholds_1_6_MV1); - (cellholds_4_8_MV1, cellholds_8_5_MV1); - (cellholds_4_8_MV1, cellholds_7_5_MV1); - (cellholds_4_8_MV1, cellholds_6_5_MV1); - (cellholds_4_8_MV1, cellholds_5_5_MV1); - (cellholds_4_8_MV1, cellholds_4_5_MV1); - (cellholds_4_8_MV1, cellholds_3_5_MV1); - (cellholds_4_8_MV1, cellholds_2_5_MV1); - (cellholds_4_8_MV1, cellholds_1_5_MV1); - (cellholds_4_7_MV1, cellholds_8_5_MV1); - (cellholds_4_7_MV1, cellholds_7_5_MV1); - (cellholds_4_7_MV1, cellholds_6_5_MV1); - (cellholds_4_7_MV1, cellholds_5_5_MV1); - (cellholds_4_7_MV1, cellholds_4_5_MV1); - (cellholds_4_7_MV1, cellholds_3_5_MV1); - (cellhol... [truncated message content] |
From: <luk...@us...> - 2011-03-15 11:03:24
|
Revision: 1361 http://toss.svn.sourceforge.net/toss/?rev=1361&view=rev Author: lukstafi Date: 2011-03-15 11:03:16 +0000 (Tue, 15 Mar 2011) Log Message: ----------- GameSimpl: fixed optional relations bug in stage 1: replacing equivalent and complement relations. New simplification algorithm for FormulaOps.remove_redundant (will form the base of GameSimpl stage 2: removing subsumed atoms). Modified Paths: -------------- trunk/Toss/Formula/FormulaOps.ml trunk/Toss/Formula/FormulaOps.mli trunk/Toss/Formula/FormulaOpsTest.ml trunk/Toss/GGP/GDL.ml trunk/Toss/GGP/GDLTest.ml trunk/Toss/GGP/GameSimpl.ml trunk/Toss/GGP/GameSimplTest.ml trunk/Toss/GGP/tests/breakthrough-simpl.toss trunk/Toss/GGP/tests/connect5-simpl.toss Modified: trunk/Toss/Formula/FormulaOps.ml =================================================================== --- trunk/Toss/Formula/FormulaOps.ml 2011-03-15 00:46:12 UTC (rev 1360) +++ trunk/Toss/Formula/FormulaOps.ml 2011-03-15 11:03:16 UTC (rev 1361) @@ -119,6 +119,10 @@ (* ----------------- MAPPING TO ATOMS AND VAR SUBSTITUTION ------------------ *) +let is_atom = function + | Rel _ | Eq _ | In _ -> true + | _ -> false + (* Map [f] to all literals (i.e. atoms or not(atom)'s) in the given formula. Preserves order of subformulas. *) let rec map_to_literals f g = function @@ -661,7 +665,8 @@ if simp_p = p && simp_q = q then Times (p, q) else simplify_re ~do_pnf ~do_formula (Times (simp_p, simp_q)) -(* Flatten "and"s and "or"s in a formula -- i.e. associativity. *) +(* Flatten "and"s and "or"s in a formula -- + i.e. associativity. Remove double negation along the way. *) let rec flatten_formula phi = let rec flat_and = function | And conjs -> Aux.concat_map flat_and conjs @@ -682,6 +687,7 @@ | And _ -> And (flat_and phi) | All (vs, phi) -> All (vs, flatten_formula phi) | Ex (vs, phi) -> Ex (vs, flatten_formula phi) + | Not (Not phi) -> flatten_formula phi | Not phi -> Not (flatten_formula phi) | (Rel _ | Eq _ | In _ | RealExpr _) as atom -> atom @@ -709,38 +715,124 @@ free_conjs @ [Ex (vs, bound_phi)]) | phi -> [phi] -(* Remove literals from disjunctions in positive positions - (conjunctions in negative positions) that already occur conjoined - to the disjucntion. (Does not descend the real part currently.) *) -let remove_redundant phi = - let rec aux base neg = function +(* Simplify the formula by removing relational literals, depending on + what literals they are conjoined with up the tree, whether they are + in a disjunction and what literals they are disjoined with, keeping + track of the sign (variance) of a position. (Does not descend the + real part currently.) [implies] is applied to atoms only. Repeat + the removal till fixpoint since it can "unpack" literals e.g. from + conjunctions to disjunctions. *) +let remove_redundant ?(implies=(=)) phi = + let implied_by x y = implies y x in + let literal neg phis = + if neg then List.map (fun phi->Not phi) phis + else phis in + (* FIXME: check if all is fine under [neg=false] *) + let rec aux_conjs posbase negbase neg conjs = + let more_posbase, subtasks = List.partition is_atom conjs in + let more_negbase, subtasks = Aux.partition_map (function + | Not phi when is_atom phi -> Aux.Left phi | phi -> Aux.Right phi + ) subtasks in + let more_posbase, more_negbase = + if neg then more_negbase, more_posbase + else more_posbase, more_negbase in + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf "aux_conjs: neg=%b; \ + posbase=%s -- negbase=%s\n\ + more_posbase=%s -- more_negbase=%s\n%!" + neg + (String.concat "; " (List.map Formula.str posbase)) + (String.concat "; " (List.map Formula.str negbase)) + (String.concat "; " (List.map Formula.str more_posbase)) + (String.concat "; " (List.map Formula.str more_negbase)) + ); + (* }}} *) + (* remove redundant *) + let more_posbase = List.filter + (fun more -> not (List.exists (implied_by more) posbase)) + more_posbase in + let more_posbase = Aux.maximal implied_by more_posbase in + let more_negbase = List.filter + (fun less -> not (List.exists (implies less) negbase)) + more_negbase in + let more_negbase = Aux.maximal implies more_negbase in + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf "aux_conjs: result more_posbase=%s -- more_negbase=%s\n%!" + (String.concat "; " (List.map Formula.str more_posbase)) + (String.concat "; " (List.map Formula.str more_negbase)) + ); + (* }}} *) + literal neg more_posbase @ literal (not neg) more_negbase @ + List.map (aux (more_posbase @ posbase) (more_negbase @ negbase) neg) + subtasks + + and aux_disjs posbase negbase neg disjs = + let poslits, subtasks = List.partition is_atom disjs in + let neglits, subtasks = Aux.partition_map (function + | Not phi when is_atom phi -> Aux.Left phi | phi -> Aux.Right phi + ) subtasks in + let poslits, neglits = + if neg then neglits, poslits else poslits, neglits in + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf "aux_disjs: neg=%b; \ + posbase=%s -- negbase=%s\n\ + poslits=%s -- neglits=%s\n%!" + neg + (String.concat "; " (List.map Formula.str posbase)) + (String.concat "; " (List.map Formula.str negbase)) + (String.concat "; " (List.map Formula.str poslits)) + (String.concat "; " (List.map Formula.str neglits)) + ); + (* }}} *) + (* remove contradicted *) + let poslits = List.filter + (fun more -> not (List.exists (implies more) negbase)) + poslits in + let poslits = Aux.maximal implies poslits in + let neglits = List.filter + (fun less -> not (List.exists (implied_by less) posbase)) + neglits in + let neglits = Aux.maximal implied_by neglits in + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf "aux_disjs: result poslits=%s -- neglits=%s\n%!" + (String.concat "; " (List.map Formula.str poslits)) + (String.concat "; " (List.map Formula.str neglits)) + ); + (* }}} *) + literal neg poslits @ literal (not neg) neglits @ + List.map (aux posbase negbase neg) subtasks + + and aux posbase negbase neg = function | And conjs when not neg -> - let more_base, subtasks = List.partition (function - | Rel _ | Not (Rel _) -> true | _ -> false) conjs in - And (more_base @ List.map (aux (more_base @ base) neg) subtasks) + And (aux_conjs posbase negbase neg conjs) | Or conjs when neg -> - let more_base, subtasks = List.partition (function - | Rel _ | Not (Rel _) -> true | _ -> false) conjs in - Or (more_base @ List.map (aux (more_base @ base) neg) subtasks) + Or (aux_conjs posbase negbase neg conjs) + | And disjs (* when neg *) -> + And (aux_disjs posbase negbase neg disjs) | Or disjs (* when not neg *) -> - let literals, subtasks = List.partition (function - | Rel _ | Not (Rel _) -> true | _ -> false) disjs in - let disjs = - Aux.list_diff literals base @ List.map (aux base neg) subtasks in - (match disjs with [disj] -> disj | _ -> Or disjs) - | And disjs (* when neg *) -> - let literals, subtasks = List.partition (function - | Rel _ | Not (Rel _) -> true | _ -> false) disjs in - let disjs = - Aux.list_diff literals base @ List.map (aux base neg) subtasks in - (match disjs with [disj] -> disj | _ -> And disjs) - | Not phi -> Not (aux base (not neg) phi) - | Ex (vs, phi) -> Ex (vs, aux base neg phi) - | All (vs, phi) -> All (vs, aux base neg phi) + Or (aux_disjs posbase negbase neg disjs) + + | Not phi -> Not (aux posbase negbase (not neg) phi) + | Ex (vs, phi) -> Ex (vs, aux posbase negbase neg phi) + | All (vs, phi) -> All (vs, aux posbase negbase neg phi) | phi -> phi in - aux [] false (flatten_formula phi) + let rec fixpoint phi = + (* {{{ log entry *) + if !debug_level > 1 then ( + Printf.printf "remove_redundant: step %s\n%!" + (Formula.str phi) + ); + (* }}} *) + let res = aux [] [] false (flatten_formula phi) in + if res = phi then res else fixpoint res in + fixpoint phi + (* Compute size of a formula (currently w/o descending the real part). *) let rec size = function | Or js | And js -> List.fold_left (+) 1 (List.map size js) Modified: trunk/Toss/Formula/FormulaOps.mli =================================================================== --- trunk/Toss/Formula/FormulaOps.mli 2011-03-15 00:46:12 UTC (rev 1360) +++ trunk/Toss/Formula/FormulaOps.mli 2011-03-15 11:03:16 UTC (rev 1361) @@ -85,17 +85,23 @@ val pnf : formula -> formula -(** Flatten "and"s and "or"s in a formula -- i.e. associativity. *) +(** Flatten "and"s and "or"s in a formula -- + i.e. associativity. Remove double negation along the way. *) val flatten_formula : formula -> formula (** Formula as a list of conjuncts, with one level of distributing negation over disjunction and pushing quantifiers inside. *) val flatten_ands : formula -> formula list -(** Remove literals from disjunctions in positive positions - (conjunctions in negative positions) that already occur conjoined - to the disjucntion. (Does not descend the real part currently.) *) -val remove_redundant : formula -> formula +(** Simplify the formula by removing relational literals, depending on + what literals they are conjoined with up the tree, whether they are + in a disjunction and what literals they are disjoined with, keeping + track of the sign (variance) of a position. (Does not descend the + real part currently.) [implies] is applied to atoms only. Repeat + the removal till fixpoint since it can "unpack" literals e.g. from + conjunctions to disjunctions. *) +val remove_redundant : + ?implies:(formula -> formula -> bool) -> formula -> formula (** Compute size of a formula (currently w/o descending the real part). *) val size : formula -> int Modified: trunk/Toss/Formula/FormulaOpsTest.ml =================================================================== --- trunk/Toss/Formula/FormulaOpsTest.ml 2011-03-15 00:46:12 UTC (rev 1360) +++ trunk/Toss/Formula/FormulaOpsTest.ml 2011-03-15 11:03:16 UTC (rev 1361) @@ -329,6 +329,39 @@ formula_eq id phi2 (FormulaOps.make_fo_tc_disj k x y) phi1 in tc_eq 2 "x" "y" "R(x, y)" "x = y or R(x, y) or ex t(R(x,t) and R(t,y))"; ); + + "remove_redundant default" >:: + (fun () -> + let rr_eq phi1 phi2 = + formula_eq id phi2 FormulaOps.remove_redundant phi1 in + rr_eq "P(x) and P(x)" "P(x)"; + rr_eq "P(x) and (not P(x) or Q(x))" "P(x) and Q(x)"; + rr_eq "not P(x) and (O(x) or Q(x) or P(x))" + "not P(x) and (O(x) or Q(x))"; + rr_eq "not P(x) and (not O(x) or Q(x) or P(x)) and O(x)" + "O(x) and Q(x) and not P(x)"; + rr_eq "not (P(x) or (not P(x) and Q(x)))" "not (P(x) or Q(x))"; + ); + + "remove_redundant P->Q,R->S" >:: + (fun () -> + let implies phi1 phi2 = + match phi1, phi2 with + | Formula.Rel ("P",xs), Formula.Rel ("Q",ys) when xs=ys -> true + | Formula.Rel ("R",xs), Formula.Rel ("S",ys) when xs=ys -> true + | _ when phi1 = phi2 -> true + | _ -> false in + let rr_eq phi1 phi2 = + formula_eq id phi2 (FormulaOps.remove_redundant ~implies) phi1 in + rr_eq "P(x) and Q(x)" "P(x)"; + rr_eq "P(x) and (not Q(x) or R(x,y))" "P(x) and R(x,y)"; + rr_eq "Q(x) and (not P(x) or R(x,y))" + "Q(x) and (R(x, y) or not P(x))"; + rr_eq "not Q(x) and (P(x) or R(x,y))" "R(x,y) and not Q(x)"; + rr_eq "not (S(x,y) or (P(x) and not R(x,y)))" + "not (S(x, y) or P(x))"; + ); + ] ;; let a = Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-03-15 00:46:12 UTC (rev 1360) +++ trunk/Toss/GGP/GDL.ml 2011-03-15 11:03:16 UTC (rev 1361) @@ -3431,7 +3431,7 @@ } in (* {{{ log entry *) (* * - let file = open_out "./GGP/tests/breakthrough-raw.toss" in + let file = open_out "./GGP/tests/connect5-raw.toss" in output_string file (Arena.state_str result); close_out file; * *) @@ -3451,7 +3451,7 @@ ) loc_noop_legal in (* {{{ log entry *) (* * - let file = open_out "./GGP/tests/breakthrough-simpl.toss" in + let file = open_out "./GGP/tests/connect5-simpl.toss" in output_string file (Arena.state_str result); close_out file; * *) Modified: trunk/Toss/GGP/GDLTest.ml =================================================================== --- trunk/Toss/GGP/GDLTest.ml 2011-03-15 00:46:12 UTC (rev 1360) +++ trunk/Toss/GGP/GDLTest.ml 2011-03-15 11:03:16 UTC (rev 1361) @@ -146,5 +146,5 @@ let breakthrough = load_rules "./GGP/examples/breakthrough.gdl" in let connect5 = load_rules "./GGP/examples/connect5.gdl" in let tictactoe = load_rules "./GGP/examples/tictactoe.gdl" in - let gdl_def, toss_def = GDL.translate_game (Const "white") breakthrough in + let gdl_def, toss_def = GDL.translate_game (Const "x") connect5 in ignore gdl_def; ignore connect5; ignore breakthrough; ignore tictactoe Modified: trunk/Toss/GGP/GameSimpl.ml =================================================================== --- trunk/Toss/GGP/GameSimpl.ml 2011-03-15 00:46:12 UTC (rev 1360) +++ trunk/Toss/GGP/GameSimpl.ml 2011-03-15 11:03:16 UTC (rev 1361) @@ -23,10 +23,11 @@ that occur positively in the LHS and are complements of their original. Derive all the tuples of embedded relations that are required to be absent for a match (not present, even optionally, - in the LHS). Remove the non-optional tuples for relations that are - complements of their originals and add tuples of originals that - are complements of relations that are required to be - absent. Rename relations equivalent to their originals. + in the LHS). (1a1) Rename relations equivalent to their + originals. (1a2) Remove the non-optional tuples for relations that + are complements of their originals and (1a3) add tuples of + originals that are complements of relations that are required to + be absent. (2) Locate relations that subsume, or are subsumed by others (in terms of inclusion relations between their graphs). Simplify @@ -94,7 +95,7 @@ (String.concat ", " fluents) ); (* }}} *) - (* prepare for (3) and (1) *) + (* prepare for (1) and (2) *) let subset_table = List.fold_left (fun table (rel,arity) -> let rel_tups = @@ -109,6 +110,14 @@ ) Aux.Strings.empty signat in Aux.StrMap.add rel row table ) Aux.StrMap.empty signat in + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf "GameSimpl: subset table =\n%s\n%!" + (Aux.StrMap.fold (fun k v acc -> + acc^"\n"^k^" < "^ + String.concat ", " (Aux.Strings.elements v)) subset_table "") + ); + (* }}} *) let subsumed rel1 rel2 = Aux.Strings.mem rel2 (Aux.StrMap.find rel1 subset_table) in let compl_table = @@ -124,8 +133,8 @@ let ntups = tcard rel_tups and ntups2 = tcard rel2_tups in if ntups >= ntups2 && ntups + ntups2 = Aux.int_pow nelems arity && - Structure.Tuples.is_empty - (Structure.Tuples.inter rel_tups rel2_tups) + Structure.Tuples.is_empty + (Structure.Tuples.inter rel_tups rel2_tups) then Aux.Strings.add rel2 row else row ) Aux.Strings.empty signat in @@ -137,19 +146,30 @@ let equivalent = List.map (fun (rel1, arity) -> try - let rel2, _ = - List.find (fun (rel2, arity2) -> - rel1 <> rel2 && arity = arity2 && - (complement rel1 rel2 || - (subsumed rel1 rel2 && subsumed rel2 rel1)) - ) signat in - rel1, (rel2, complement rel1 rel2) + let rel2, _ = + List.find (fun (rel2, arity2) -> + arity = arity2 && + not (List.mem rel2 fluents || + List.mem_assoc rel2 game.Arena.defined_rels) && + (complement rel1 rel2 || + (subsumed rel1 rel2 && subsumed rel2 rel1)) + ) signat in + rel1, (rel2, complement rel1 rel2) with Not_found -> rel1, (rel1, false) ) signat in let removable rel = + let spec = DiscreteRule.special_rel_of rel in + let rel = + match spec with + | None -> rel + | Some spec -> DiscreteRule.orig_rel_of rel in not (List.mem rel fluents) && not (List.mem_assoc rel game.Arena.defined_rels) && - not (List.exists (fun (_,(rel2,_)) -> rel2=rel) equivalent) in + not (List.exists (fun (_,(rel2,_)) -> rel2=rel) equivalent) && + not (List.mem (fst (List.assoc rel equivalent)) fluents || + List.mem_assoc (fst (List.assoc rel equivalent)) + game.Arena.defined_rels) + in (* {{{ log entry *) if !debug_level > 0 then ( Printf.printf "GameSimpl: equivalent structures --\n%s\n%!" @@ -217,6 +237,7 @@ let ltups = Structure.Tuples.elements in let lhs_neg_tups = r.ContinuousRule.compiled.DiscreteRule.lhs_neg_tups in + (* 1a1: renaming removable relations to their originals *) let lhs_struc = Structure.StringMap.fold (fun rel tups lhs_struc -> let spec = DiscreteRule.special_rel_of rel in @@ -227,14 +248,17 @@ if not (removable rel) then lhs_struc else let orig, neg = List.assoc rel equivalent in - if not neg then - let orig = - match spec with - | None -> orig - | Some spec -> "_"^spec^"_"^orig in + let orig = + match spec with + | None -> orig + | Some spec -> "_"^spec^"_"^orig in + if not neg (* 1a1 *) + || (neg && spec = Some "opt") (* not-1a2 *) + then Structure.add_rels lhs_struc orig (ltups tups) else if List.mem_assoc rel lhs_neg_tups - then + && spec <> Some "opt" + then (* 1a3 *) Structure.add_rels lhs_struc orig (List.assoc rel lhs_neg_tups) else lhs_struc @@ -289,4 +313,8 @@ emb_rels = emb_rels; }}) game.Arena.rules} in + (* 2 *) + (*let game = + Arena.map_to_formulas (FormulaOps.)*) + game, state Modified: trunk/Toss/GGP/GameSimplTest.ml =================================================================== --- trunk/Toss/GGP/GameSimplTest.ml 2011-03-15 00:46:12 UTC (rev 1360) +++ trunk/Toss/GGP/GameSimplTest.ml 2011-03-15 11:03:16 UTC (rev 1361) @@ -58,3 +58,14 @@ with | Some tests -> ignore (run_test_tt ~verbose:true tests) | None -> () + +let a () = + let breakthrough = state_of_file "./GGP/tests/breakthrough-raw.toss" in + Printf.printf "\nINPUT:\n%s\n%!" (Arena.state_str breakthrough); + GameSimpl.debug_level := 4; + let res = GameSimpl.simplify breakthrough in + let resf = open_out "./GGP/tests/breakthrough-simpl.toss" in + let res_str = Arena.state_str res in + output_string resf res_str; + close_out resf; + Printf.printf "\nRESULT:\n%s\n%!" res_str Modified: trunk/Toss/GGP/tests/breakthrough-simpl.toss =================================================================== --- trunk/Toss/GGP/tests/breakthrough-simpl.toss 2011-03-15 00:46:12 UTC (rev 1360) +++ trunk/Toss/GGP/tests/breakthrough-simpl.toss 2011-03-15 11:03:16 UTC (rev 1361) @@ -1,10 +1,13 @@ PLAYERS white, black RULE move_x1_y1_x2_y2_0: [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | + _opt_cellholds_x2_y2_black { + cellholds_x1_y1__blank_; cellholds_x2_y2__blank_; control__blank_}; + _opt_cellholds_x2_y2_white (control__blank_); + _opt_control_black {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; + _opt_control_white {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; cellholds_x2_y2_white (cellholds_x1_y1__blank_); control_white (control__blank_); - index__cellholds_x2_y2_MV1_x2 { - cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; index__cellholds_x2_y2_MV1_y2 { cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_x2 @@ -24,31 +27,34 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x374_8__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and - not not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and + not + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and + not + ex cellholds_x376_1__blank_ + (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x376_1__blank_) and + cellholds_x2_y2_black(cellholds_x376_1__blank_)) and not - ex cellholds_x376_1__blank_ - (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x376_1__blank_) and - cellholds_x2_y2_black(cellholds_x376_1__blank_)) and - not not ex cellholds_x377_y369__blank_ (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and cellholds_x2_y2_white(cellholds_x377_y369__blank_))) RULE move_x1_y1_x2_y2_00: [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | + _opt_cellholds_x2_y2_black { + cellholds_x1_y1__blank_; cellholds_x2_y2__blank_; control__blank_}; + _opt_cellholds_x2_y2_white (control__blank_); + _opt_control_black {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; + _opt_control_white {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; cellholds_x2_y2_white (cellholds_x1_y1__blank_); control_white (control__blank_); - index__cellholds_x2_y2_MV1_x2 { - cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; index__cellholds_x2_y2_MV1_y2 { cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_x2 @@ -68,42 +74,45 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x374_8__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and - not not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and + not + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and + not + ex cellholds_x376_1__blank_ + (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x376_1__blank_) and + cellholds_x2_y2_black(cellholds_x376_1__blank_)) and not - ex cellholds_x376_1__blank_ - (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x376_1__blank_) and - cellholds_x2_y2_black(cellholds_x376_1__blank_)) and - not not ex cellholds_x377_y369__blank_ (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and cellholds_x2_y2_white(cellholds_x377_y369__blank_))) -RULE move_x_y1_x_y2_0: - [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | - EQ___cellholds_x2_y2_MV1_x2 - (cellholds_x_y1__blank_, cellholds_x_y2__blank_); - cellholds_x2_y2_white (cellholds_x_y1__blank_); - control_white (control__blank_); - index__cellholds_x2_y2_MV1_x2 { - cellholds_x_y1__blank_; cellholds_x_y2__blank_}; +RULE move_x1_y1_x2_y2_1: + [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | + _opt_cellholds_x2_y2_black (control__blank_); + _opt_cellholds_x2_y2_white { + cellholds_x1_y1__blank_; cellholds_x2_y2__blank_; control__blank_}; + _opt_control_black {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; + _opt_control_white {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; + cellholds_x2_y2_black (cellholds_x1_y1__blank_); + control_black (control__blank_); index__cellholds_x2_y2_MV1_y2 { - cellholds_x_y1__blank_; cellholds_x_y2__blank_}; + cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; + succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_x2 + (cellholds_x2_y2__blank_, cellholds_x1_y1__blank_); succ__cellholds_x2_y2_MV1_y2__cellholds_x2_y2_MV1_y2 - (cellholds_x_y1__blank_, cellholds_x_y2__blank_) + (cellholds_x2_y2__blank_, cellholds_x1_y1__blank_) | ] -> - [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | - cellholds_x2_y2_white (cellholds_x_y2__blank_); - control_black (control__blank_) + [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | + cellholds_x2_y2_black (cellholds_x2_y2__blank_); + control_white (control__blank_) | ] emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, @@ -112,35 +121,38 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x374_8__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and - not not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and + not + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and + not + ex cellholds_x376_1__blank_ + (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x376_1__blank_) and + cellholds_x2_y2_black(cellholds_x376_1__blank_)) and not - ex cellholds_x376_1__blank_ - (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x376_1__blank_) and - cellholds_x2_y2_black(cellholds_x376_1__blank_)) and - not not ex cellholds_x377_y369__blank_ (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and cellholds_x2_y2_white(cellholds_x377_y369__blank_))) -RULE move_x1_y1_x2_y2_1: +RULE move_x1_y1_x2_y2_10: [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | + _opt_cellholds_x2_y2_black (control__blank_); + _opt_cellholds_x2_y2_white { + cellholds_x1_y1__blank_; cellholds_x2_y2__blank_; control__blank_}; + _opt_control_black {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; + _opt_control_white {cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; cellholds_x2_y2_black (cellholds_x1_y1__blank_); control_black (control__blank_); - index__cellholds_x2_y2_MV1_x2 { - cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; index__cellholds_x2_y2_MV1_y2 { cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_x2 - (cellholds_x2_y2__blank_, cellholds_x1_y1__blank_); + (cellholds_x1_y1__blank_, cellholds_x2_y2__blank_); succ__cellholds_x2_y2_MV1_y2__cellholds_x2_y2_MV1_y2 (cellholds_x2_y2__blank_, cellholds_x1_y1__blank_) | @@ -156,42 +168,44 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x374_8__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and - not not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and + not + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and + not + ex cellholds_x376_1__blank_ + (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x376_1__blank_) and + cellholds_x2_y2_black(cellholds_x376_1__blank_)) and not - ex cellholds_x376_1__blank_ - (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x376_1__blank_) and - cellholds_x2_y2_black(cellholds_x376_1__blank_)) and - not not ex cellholds_x377_y369__blank_ (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and cellholds_x2_y2_white(cellholds_x377_y369__blank_))) -RULE move_x1_y1_x2_y2_10: - [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | - cellholds_x2_y2_black (cellholds_x1_y1__blank_); - control_black (control__blank_); - index__cellholds_x2_y2_MV1_x2 { - cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; +RULE move_x_y1_x_y2_0: + [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | + EQ___cellholds_x2_y2_MV1_x2 + (cellholds_x_y1__blank_, cellholds_x_y2__blank_); + _opt_cellholds_x2_y2_black {cellholds_x_y1__blank_; control__blank_}; + _opt_cellholds_x2_y2_white (control__blank_); + _opt_control_black {cellholds_x_y1__blank_; cellholds_x_y2__blank_}; + _opt_control_white {cellholds_x_y1__blank_; cellholds_x_y2__blank_}; + cellholds_x2_y2_white (cellholds_x_y1__blank_); + control_white (control__blank_); index__cellholds_x2_y2_MV1_y2 { - cellholds_x1_y1__blank_; cellholds_x2_y2__blank_}; - succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_x2 - (cellholds_x1_y1__blank_, cellholds_x2_y2__blank_); + cellholds_x_y1__blank_; cellholds_x_y2__blank_}; succ__cellholds_x2_y2_MV1_y2__cellholds_x2_y2_MV1_y2 - (cellholds_x2_y2__blank_, cellholds_x1_y1__blank_) + (cellholds_x_y1__blank_, cellholds_x_y2__blank_) | ] -> - [cellholds_x1_y1__blank_, cellholds_x2_y2__blank_, control__blank_ | - cellholds_x2_y2_black (cellholds_x2_y2__blank_); - control_white (control__blank_) + [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | + cellholds_x2_y2_white (cellholds_x_y2__blank_); + control_black (control__blank_) | ] emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, @@ -200,33 +214,35 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x374_8__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and - not not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and + not + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and + not + ex cellholds_x376_1__blank_ + (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x376_1__blank_) and + cellholds_x2_y2_black(cellholds_x376_1__blank_)) and not - ex cellholds_x376_1__blank_ - (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x376_1__blank_) and - cellholds_x2_y2_black(cellholds_x376_1__blank_)) and - not not ex cellholds_x377_y369__blank_ (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and cellholds_x2_y2_white(cellholds_x377_y369__blank_))) RULE move_x_y1_x_y2_1: [cellholds_x_y1__blank_, cellholds_x_y2__blank_, control__blank_ | EQ___cellholds_x2_y2_MV1_x2 (cellholds_x_y1__blank_, cellholds_x_y2__blank_); + _opt_cellholds_x2_y2_black (control__blank_); + _opt_cellholds_x2_y2_white {cellholds_x_y1__blank_; control__blank_}; + _opt_control_black {cellholds_x_y1__blank_; cellholds_x_y2__blank_}; + _opt_control_white {cellholds_x_y1__blank_; cellholds_x_y2__blank_}; cellholds_x2_y2_black (cellholds_x_y1__blank_); control_black (control__blank_); - index__cellholds_x2_y2_MV1_x2 { - cellholds_x_y1__blank_; cellholds_x_y2__blank_}; index__cellholds_x2_y2_MV1_y2 { cellholds_x_y1__blank_; cellholds_x_y2__blank_}; succ__cellholds_x2_y2_MV1_y2__cellholds_x2_y2_MV1_y2 @@ -244,24 +260,24 @@ (not ex cellholds_x374_8__blank_ (cellholds_x2_8_MV1(cellholds_x374_8__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x374_8__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x374_8__blank_) and cellholds_x2_y2_white(cellholds_x374_8__blank_)) and - not not - ex cellholds_x375_y368__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x375_y368__blank_) and - cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and + not + ex cellholds_x375_y368__blank_ + (index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x375_y368__blank_) and + cellholds_x2_y2_black(cellholds_x375_y368__blank_)) and + not + ex cellholds_x376_1__blank_ + (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x376_1__blank_) and + cellholds_x2_y2_black(cellholds_x376_1__blank_)) and not - ex cellholds_x376_1__blank_ - (cellholds_x2_1_MV1(cellholds_x376_1__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x376_1__blank_) and - cellholds_x2_y2_black(cellholds_x376_1__blank_)) and - not not ex cellholds_x377_y369__blank_ (index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x377_y369__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x377_y369__blank_) and cellholds_x2_y2_white(cellholds_x377_y369__blank_))) LOC 0 { PLAYER white @@ -271,12 +287,12 @@ :( ex cellholds_x26_8__blank_ (cellholds_x2_8_MV1(cellholds_x26_8__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x26_8__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x26_8__blank_) and cellholds_x2_y2_white(cellholds_x26_8__blank_)) or not ex cellholds_x27_y26__blank_ (index__cellholds_x2_y2_MV1_y2(cellholds_x27_y26__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x27_y26__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x27_y26__blank_) and cellholds_x2_y2_black(cellholds_x27_y26__blank_)) ); black: @@ -284,12 +300,12 @@ :( ex cellholds_x30_1__blank_ (cellholds_x2_1_MV1(cellholds_x30_1__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x30_1__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x30_1__blank_) and cellholds_x2_y2_black(cellholds_x30_1__blank_)) or not ex cellholds_x31_y28__blank_ (index__cellholds_x2_y2_MV1_y2(cellholds_x31_y28__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x31_y28__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x31_y28__blank_) and cellholds_x2_y2_white(cellholds_x31_y28__blank_)) ) } @@ -304,12 +320,12 @@ :( ex cellholds_x26_8__blank_ (cellholds_x2_8_MV1(cellholds_x26_8__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x26_8__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x26_8__blank_) and cellholds_x2_y2_white(cellholds_x26_8__blank_)) or not ex cellholds_x27_y26__blank_ (index__cellholds_x2_y2_MV1_y2(cellholds_x27_y26__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x27_y26__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x27_y26__blank_) and cellholds_x2_y2_black(cellholds_x27_y26__blank_)) ); black: @@ -317,12 +333,12 @@ :( ex cellholds_x30_1__blank_ (cellholds_x2_1_MV1(cellholds_x30_1__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x30_1__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x30_1__blank_) and cellholds_x2_y2_black(cellholds_x30_1__blank_)) or not ex cellholds_x31_y28__blank_ (index__cellholds_x2_y2_MV1_y2(cellholds_x31_y28__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x31_y28__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x31_y28__blank_) and cellholds_x2_y2_white(cellholds_x31_y28__blank_)) ) } @@ -1478,30 +1494,6 @@ }; control_MV1 (control_MV1); control_black:1 {}; control_white (control_MV1); - index__cellholds_x2_y2_MV1_x2 { - cellholds_8_8_MV1; cellholds_8_7_MV1; cellholds_8_6_MV1; - cellholds_8_5_MV1; cellholds_8_4_MV1; cellholds_8_3_MV1; - cellholds_8_2_MV1; cellholds_8_1_MV1; cellholds_7_8_MV1; - cellholds_7_7_MV1; cellholds_7_6_MV1; cellholds_7_5_MV1; - cellholds_7_4_MV1; cellholds_7_3_MV1; cellholds_7_2_MV1; - cellholds_7_1_MV1; cellholds_6_8_MV1; cellholds_6_7_MV1; - cellholds_6_6_MV1; cellholds_6_5_MV1; cellholds_6_4_MV1; - cellholds_6_3_MV1; cellholds_6_2_MV1; cellholds_6_1_MV1; - cellholds_5_8_MV1; cellholds_5_7_MV1; cellholds_5_6_MV1; - cellholds_5_5_MV1; cellholds_5_4_MV1; cellholds_5_3_MV1; - cellholds_5_2_MV1; cellholds_5_1_MV1; cellholds_4_8_MV1; - cellholds_4_7_MV1; cellholds_4_6_MV1; cellholds_4_5_MV1; - cellholds_4_4_MV1; cellholds_4_3_MV1; cellholds_4_2_MV1; - cellholds_4_1_MV1; cellholds_3_8_MV1; cellholds_3_7_MV1; - cellholds_3_6_MV1; cellholds_3_5_MV1; cellholds_3_4_MV1; - cellholds_3_3_MV1; cellholds_3_2_MV1; cellholds_3_1_MV1; - cellholds_2_8_MV1; cellholds_2_7_MV1; cellholds_2_6_MV1; - cellholds_2_5_MV1; cellholds_2_4_MV1; cellholds_2_3_MV1; - cellholds_2_2_MV1; cellholds_2_1_MV1; cellholds_1_8_MV1; - cellholds_1_7_MV1; cellholds_1_6_MV1; cellholds_1_5_MV1; - cellholds_1_4_MV1; cellholds_1_3_MV1; cellholds_1_2_MV1; - cellholds_1_1_MV1 - }; index__cellholds_x2_y2_MV1_y2 { cellholds_8_8_MV1; cellholds_8_7_MV1; cellholds_8_6_MV1; cellholds_8_5_MV1; cellholds_8_4_MV1; cellholds_8_3_MV1; @@ -1526,7 +1518,7 @@ cellholds_1_4_MV1; cellholds_1_3_MV1; cellholds_1_2_MV1; cellholds_1_1_MV1 }; - role__cellholds_x2_y2_MV1_x2:1 {}; role__cellholds_x2_y2_MV1_y2:1 {}; + role__cellholds_x2_y2_MV1_y2:1 {}; succ__cellholds_x2_y2_MV1_x2__cellholds_x2_y2_MV1_x2 { (cellholds_7_8_MV1, cellholds_8_8_MV1); (cellholds_7_8_MV1, cellholds_8_7_MV1); Modified: trunk/Toss/GGP/tests/connect5-simpl.toss =================================================================== --- trunk/Toss/GGP/tests/connect5-simpl.toss 2011-03-15 00:46:12 UTC (rev 1360) +++ trunk/Toss/GGP/tests/connect5-simpl.toss 2011-03-15 11:03:16 UTC (rev 1361) @@ -1,6 +1,11 @@ PLAYERS x, o RULE mark_x149_y149_0: [cell_x149_y149__blank_, control__blank_ | + _opt_cell_x_y_b (control__blank_); + _opt_cell_x_y_o {cell_x149_y149__blank_; control__blank_}; + _opt_cell_x_y_x {cell_x149_y149__blank_; control__blank_}; + _opt_control_o (cell_x149_y149__blank_); + _opt_control_x (cell_x149_y149__blank_); cell_x_y_b (cell_x149_y149__blank_); control_MV1 (control__blank_); control_x (control__blank_) | @@ -181,6 +186,11 @@ not not ex cell_x182_y182__blank_ cell_x_y_b(cell_x182_y182__blank_)) RULE mark_x159_y159_1: [cell_x159_y159__blank_, control__blank_ | + _opt_cell_x_y_b (control__blank_); + _opt_cell_x_y_o {cell_x159_y159__blank_; control__blank_}; + _opt_cell_x_y_x {cell_x159_y159__blank_; control__blank_}; + _opt_control_o (cell_x159_y159__blank_); + _opt_control_x (cell_x159_y159__blank_); cell_x_y_b (cell_x159_y159__blank_); control_MV1 (control__blank_); control_o (control__blank_) | @@ -1662,21 +1672,6 @@ }; cell_x_y_o:1 {}; cell_x_y_x:1 {}; control_MV1 (control_MV1); control_o:1 {}; control_x (control_MV1); - coordinate__cell_x_y_MV1_x { - cell_h_h_MV1; cell_h_g_MV1; cell_h_f_MV1; cell_h_e_MV1; cell_h_d_MV1; - cell_h_c_MV1; cell_h_b_MV1; cell_h_a_MV1; cell_g_h_MV1; cell_g_g_MV1; - cell_g_f_MV1; cell_g_e_MV1; cell_g_d_MV1; cell_g_c_MV1; cell_g_b_MV1; - cell_g_a_MV1; cell_f_h_MV1; cell_f_g_MV1; cell_f_f_MV1; cell_f_e_MV1; - cell_f_d_MV1; cell_f_c_MV1; cell_f_b_MV1; cell_f_a_MV1; cell_e_h_MV1; - cell_e_g_MV1; cell_e_f_MV1; cell_e_e_MV1; cell_e_d_MV1; cell_e_c_MV1; - cell_e_b_MV1; cell_e_a_MV1; cell_d_h_MV1; cell_d_g_MV1; cell_d_f_MV1; - cell_d_e_MV1; cell_d_d_MV1; cell_d_c_MV1; cell_d_b_MV1; cell_d_a_MV1; - cell_c_h_MV1; cell_c_g_MV1; cell_c_f_MV1; cell_c_e_MV1; cell_c_d_MV1; - cell_c_c_MV1; cell_c_b_MV1; cell_c_a_MV1; cell_b_h_MV1; cell_b_g_MV1; - cell_b_f_MV1; cell_b_e_MV1; cell_b_d_MV1; cell_b_c_MV1; cell_b_b_MV1; - cell_b_a_MV1; cell_a_h_MV1; cell_a_g_MV1; cell_a_f_MV1; cell_a_e_MV1; - cell_a_d_MV1; cell_a_c_MV1; cell_a_b_MV1; cell_a_a_MV1 - }; coordinate__cell_x_y_MV1_y { cell_h_h_MV1; cell_h_g_MV1; cell_h_f_MV1; cell_h_e_MV1; cell_h_d_MV1; cell_h_c_MV1; cell_h_b_MV1; cell_h_a_MV1; cell_g_h_MV1; cell_g_g_MV1; @@ -2596,6 +2591,6 @@ (cell_a_a_MV1, cell_d_b_MV1); (cell_a_a_MV1, cell_c_b_MV1); (cell_a_a_MV1, cell_b_b_MV1); (cell_a_a_MV1, cell_a_b_MV1) }; - role__cell_x_y_MV1_x:1 {}; role__cell_x_y_MV1_y:1 {} + role__cell_x_y_MV1_y:1 {} | ] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-15 00:46:20
|
Revision: 1360 http://toss.svn.sourceforge.net/toss/?rev=1360&view=rev Author: lukaszkaiser Date: 2011-03-15 00:46:12 +0000 (Tue, 15 Mar 2011) Log Message: ----------- WebClient debug, reference update, www translation fixes. Modified Paths: -------------- trunk/Toss/WebClient/Login.js trunk/Toss/WebClient/index.html trunk/Toss/www/Makefile trunk/Toss/www/contact.xml trunk/Toss/www/develop.xml trunk/Toss/www/reference/Makefile trunk/Toss/www/reference/reference.bib trunk/Toss/www/reference/reference.tex Modified: trunk/Toss/WebClient/Login.js =================================================================== --- trunk/Toss/WebClient/Login.js 2011-03-14 11:11:08 UTC (rev 1359) +++ trunk/Toss/WebClient/Login.js 2011-03-15 00:46:12 UTC (rev 1360) @@ -46,13 +46,16 @@ } // Onload handler -function startup () { +function startup (game) { if (navigator.userAgent.indexOf('MSIE') !=-1) { document.getElementById("nosvg").style.display = "block"; } else { var udata = srv("USERPLAYS", "user"); if (udata != "") { setup_user (udata.split("$")) }; } + if (game != "") { + new_play_guest (game); + } } // Html of the list item for adding new opponents. Modified: trunk/Toss/WebClient/index.html =================================================================== --- trunk/Toss/WebClient/index.html 2011-03-14 11:11:08 UTC (rev 1359) +++ trunk/Toss/WebClient/index.html 2011-03-15 00:46:12 UTC (rev 1360) @@ -16,7 +16,7 @@ <script type="text/javascript" src="Login.js"> </script> </head> -<body onload="startup()"> +<body onload="startup('')"> <div id="main"> Modified: trunk/Toss/www/Makefile =================================================================== --- trunk/Toss/www/Makefile 2011-03-14 11:11:08 UTC (rev 1359) +++ trunk/Toss/www/Makefile 2011-03-15 00:46:12 UTC (rev 1360) @@ -6,3 +6,6 @@ ln -fs ../Toss.docdir code_doc cp code_doc/index.html code_doc/index.html.en cp code_doc/index.html code_doc/index.html.de + cp code_doc/index.html code_doc/index.html.de + cp code_doc/index.html code_doc/index.html.pl + cp code_doc/index.html code_doc/index.html.fr Modified: trunk/Toss/www/contact.xml =================================================================== --- trunk/Toss/www/contact.xml 2011-03-14 11:11:08 UTC (rev 1359) +++ trunk/Toss/www/contact.xml 2011-03-15 00:46:12 UTC (rev 1360) @@ -24,7 +24,7 @@ <section title="Email" lang="de"> <par>Toss ist ein Open-Source Projekt, wird auf <a href="http://sourceforge.net">SourceForge</a> - gehosted und eine BSD Licence disribuiert.<br/></par> + gehosted und unter der BSD Lizenz disribuiert.<br/></par> <par>Man kann uns unter folgener Addresse erreichen: <mailto address="tos...@li..."/> </par> @@ -32,9 +32,9 @@ <section title="Email" lang="pl"> <par>Toss jest projektem open source z hostem na <a href="http://sourceforge.net">SourceForge</a> - i pod licencja BSD.<br/></par> + i pod licencją BSD.<br/></par> <par>Najłatwiej się z nami skontaktować pisząc na - <mailto address="tos...@li..."/> + <mailto address="tos...@li..."/>. </par> </section> @@ -46,9 +46,9 @@ Toss Subversion Repository</a></item> </itemize> </section> - <section title="Links von Toss" lang="de"> + <section title="Links zu Toss" lang="de"> <itemize> - <item><a href="http://sourceforge.net/projects/toss/">Toss Project at + <item><a href="http://sourceforge.net/projects/toss/">Toss Projekt auf SourceForge.net</a></item> <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/"> Toss Subversion Repository</a></item> @@ -56,7 +56,7 @@ </section> <section title="Linki Tossa" lang="pl"> <itemize> - <item><a href="http://sourceforge.net/projects/toss/">Toss Project at + <item><a href="http://sourceforge.net/projects/toss/">Projekt Toss na SourceForge.net</a></item> <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/"> Toss Subversion Repository</a></item> @@ -64,7 +64,7 @@ </section> - <section title="Game Playing Links"> + <section title="Game Playing Links" lang="en"> <itemize> <item><a href="http://www.apronus.com/chess/wbeditor.php">Apronus Chess Board Editor</a> is our favorite site for simple chess boards. @@ -91,10 +91,65 @@ Turn</a> allows you to play various board games online.</item> </itemize> </section> + <section title="Links zu Spielprogrammen" lang="de"> + <itemize> + <item><a href="http://www.apronus.com/chess/wbeditor.php">Apronus Chess + Board Editor</a> ist unser beliebter einfacher Schachbretteditor. + </item> + <item><a href="http://www.dozingcatsoftware.com/Gridlock/">Gridlock</a> + ist eine Sammlung von Open-Source Spielen. Es spielt nett, erlaubt + es aber nicht das Spiel zu editieren. + </item> - <section title="Modelling Links"> + <item><a href="http://www.zillions-of-games.com/">Zillions of Games</a> + ist eine Sprache für Spieldefinitionen, ein Simulator und eine grosse + Bibliothek von Spielen. Leider ist es nicht Open-Source. + </item> + + <item><a href="http://www.kurnik.pl/">Kurnik</a> ist eine polnische + Spielseite mit verschiedenen Spielen.</item> + + <item><a href="http://abstractstrategy.com/main.html">Abstract + Strategy Games</a> erlaubt es, strategische Spiele zu lernen + und zu spielen. + </item> + + <item><a href="http://www.yourturnmyturn.com/">Your Turn My + Turn</a> erlaubt es, Brettspiele online zu spielen.</item> + </itemize> + </section> + <section title="Linki do Programów do Gier" lang="pl"> <itemize> + <item><a href="http://www.apronus.com/chess/wbeditor.php">Apronus Chess + Board Editor</a> to nasz ulubiony prosty edytor pozycji szachowych. + </item> + + <item><a href="http://www.dozingcatsoftware.com/Gridlock/">Gridlock</a> + to zbiór gier planszowych open-source. Miło z nim grać, ale nie + pozwala edytować gry ani stanu planszy. + </item> + + <item><a href="http://www.zillions-of-games.com/">Zillions of Games</a> + to język do definicji gier wraz z symulatorem i pokaźną biblioteką + przeróżnych gier. Niestety, nie jest to program open-source. + </item> + + <item><a href="http://www.kurnik.pl/">Kurnik</a> to polska strona + na której można grać w różne gry planszowe i karciane.</item> + + <item><a href="http://abstractstrategy.com/main.html">Abstract + Strategy Games</a> pozwala uczyć się i grać w gry strategiczne. + </item> + + <item>Na <a href="http://www.yourturnmyturn.com/">Your Turn My + Turn</a> możesz zagrać w różne gry planszowe.</item> + </itemize> + </section> + + + <section title="Modelling Links" lang="en"> + <itemize> <item><a href="http://edu.kde.org/step/">Step</a> is an open-source physics simulator, a part of the KDE Education Project. It can be used for simulation of systems with continuous @@ -110,15 +165,47 @@ embedded systems. This advanced project allows to use various models of computation that govern the interactions between components. </item> + </itemize> + </section> + <section title="Links zu Simulation- und Modellierungprogrammen" lang="de"> + <itemize> + <item><a href="http://edu.kde.org/step/">Step</a> + ist ein Open-Source Physiksimulator, teil der KDE Education Project. + Man kann damit Systeme mit kontiuerlicher Dynamik simulieren. + </item> - <item><a href="http://www.microsoft.com/esp/about_esp/overview.htm" - >Microsoft ESP</a> is a visual simulation platform - that applies game-based technology to some more complex problems. + <item><a href="http://www.iseesystems.com/softwares/Education/StellaSoftware.aspx">STELLA</a> ist ein kommerzieller Simulationsprogramm und erlaubt + sowohl diskrete als auch kontinuerliche Dynamik. </item> + + <item><a href="http://ptolemy.eecs.berkeley.edu/">Ptolemy</a> Projekt + erforscht Modelierung, Simulation und das Design von Nebenläufigen im + Echtzeit laufenden eingebeteten Systeme. Es erlaubt verschiedene + Modelle von Berechnungen gleichzeitig zu verknüpfen und zu nutzen. + </item> </itemize> </section> + <section title="Linki do Programów do Modelowania" lang="pl"> + <itemize> + <item><a href="http://edu.kde.org/step/">Step</a> to open-sourcowy + symulator fizyki, część KDE Education Project. Pozwala na + symulację systemów z ciągłą dynamiką. + </item> - <section title="Team"> + <item><a href="http://www.iseesystems.com/softwares/Education/StellaSoftware.aspx">STELLA</a> to komercyjny symulator pozwalający definiować zarówno + ciągłą jak i dyskretną dynamikę. + </item> + + <item><a href="http://ptolemy.eecs.berkeley.edu/">Ptolemy</a> to projekt + w którym badane jest modelowanie, symulacja i design równoległych + systemów czasu rzeczywistego. Ten zaawansowany projekt pozwala łączyć + różne modele obliczeń i używać ich w tym samym projekcie. + </item> + </itemize> + </section> + + + <section title="Team" lang="en"> <par>Toss originates from our work in the <a href="http://www.algosyn.rwth-aachen.de/">AlgoSyn</a> research group. Many people contributed, here we name just a few. Current leaders:</par> @@ -143,4 +230,56 @@ </itemize> </section> + <section title="Team" lang="de"> + <par>Toss hat angefangen während der Arbeit im + <a href="http://www.algosyn.rwth-aachen.de/">AlgoSyn</a> + Graduiertenkolleg. Viele haben dazu beigetragen, hier benennen wir + nur einige Mitwirkende. Zur Zeit programmieren am meisten:</par> + <itemize> + <item>Łukasz Kaiser (<mailto address="luk...@gm..."/>)</item> + <item>Tobias Ganzow</item> + <item>Łukasz Stafiniak</item> + <item>Michał Wójcik</item> + </itemize> + + <par>Freunde die uns sehr geholfen haben.</par> + <itemize> + <item>Dietmar Berwanger</item> + <item>Matko Botincan</item> + <item>Diana Fischer</item> + </itemize> + <par>Einige andere Mitarbeiter haben an der ältesten Version von + Toss (ca. 2004) gearbeitet.</par> + <itemize> + <item>Alexander Kharitonov</item> + <item>Peter Cholewinski</item> + </itemize> + </section> + + <section title="Team" lang="pl"> + <par>Toss wywodzi się z prac i dyskusji w gronie + <a href="http://www.algosyn.rwth-aachen.de/">AlgoSyn</a>. + Wiele osób pracowało nad Tossem w różnych okresach, tutaj + wymieniamy tylko niektóre z nich. Obecnie najwięcej pracują:</par> + <itemize> + <item>Łukasz Kaiser (<mailto address="luk...@gm..."/>)</item> + <item>Tobias Ganzow</item> + <item>Łukasz Stafiniak</item> + <item>Michał Wójcik</item> + </itemize> + + <par>Przyjaciele, którzy bardzo nam pomogli.</par> + <itemize> + <item>Dietmar Berwanger</item> + <item>Matko Botincan</item> + <item>Diana Fischer</item> + </itemize> + <par>Inna grupa osób pracowała nad najstarszą wersją Tossa + (około 2004).</par> + <itemize> + <item>Alexander Kharitonov</item> + <item>Peter Cholewinski</item> + </itemize> + </section> + </personal> Modified: trunk/Toss/www/develop.xml =================================================================== --- trunk/Toss/www/develop.xml 2011-03-14 11:11:08 UTC (rev 1359) +++ trunk/Toss/www/develop.xml 2011-03-15 00:46:12 UTC (rev 1360) @@ -39,63 +39,63 @@ </section> <section title="Vorbereitung" lang="de"> <itemize> - <item>Except for the interfaces, most of Toss is programmed in - <a href="http://caml.inria.fr/">Objective Caml</a>. You will need - a good understanding of OCaml and a full OCaml installation - to work on the Toss Engine. + <item>Ausser der Interfaces ist Toss fast vollständig in + <a href="http://caml.inria.fr/">Objective Caml</a> geschrieben. + Um an Toss zu arbeiten braucht man ein gutes Verständnis von + OCaml und eine vollständige OCaml Installation. </item> - <item>Toss <em>build system</em> is based on <em>ocamlbuild</em> - and uses <em>Makefiles</em> for compilation of the C parts. - You will need a system which supports these to build Toss. + <item>Das <em>Build System</em> von Toss basiert auf <em>ocamlbuild</em> + und nutzt <em>Makefiles</em> um die C Teile zu kompilieren. + Man muss diese Tools installiert haben um Toss zu bauen. </item> - <item>If you want to develop Toss on Ubuntu, here is a command with - a list of packages to install.<br/> + <item>Wenn man Toss unter Ubuntu kompilieren möchte, braucht man + Pakette, die mit folgender Zeile installiert werden können.<br/> sudo apt-get install g++ python-qt4 python-dev pyqt4-dev-tools ocaml-findlib menhir libounit-ocaml-dev libapache2-mod-python sqlite3 python-pysqlite2 </item> - <item>This command will checkout the + <item>Folgendes nutzt man, um die <a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/">Toss - SVN Repository</a> to the <em>Toss</em> directory.<br/> + SVN Repository</a> zum <em>Toss</em> Verzeichnis auszuchecken.<br/> svn co https://toss.svn.sourceforge.net/svnroot/toss/trunk/Toss Toss </item> - <item>In the Toss directory run <em>make</em> and check that - it succeeds.</item> + <item>Im Toss Verzeichnis führe <em>make</em> aus und überprüfe, + dass es erfolgreich funktioniert hat.</item> </itemize> </section> <section title="Przygotowanie" lang="pl"> <itemize> - <item>Except for the interfaces, most of Toss is programmed in - <a href="http://caml.inria.fr/">Objective Caml</a>. You will need - a good understanding of OCaml and a full OCaml installation - to work on the Toss Engine. + <item>Poza interfejsami większość Tossa jest napisana w + <a href="http://caml.inria.fr/">Objective Camlu</a>. Aby pracować + nad Enginem Tossa niezbędna jest dobra znajomosc OCamla oraz + jego pełna instalacja. </item> - <item>Toss <em>build system</em> is based on <em>ocamlbuild</em> - and uses <em>Makefiles</em> for compilation of the C parts. - You will need a system which supports these to build Toss. + <item><em>Build system</em> Tossa bazuje na <em>ocamlbuild</em>, + ale <em>Makefile</em> są używane do kompilacji niektórych części, + np. kodu C. Trzeba zainstalowac te programy żeby skompilować Tossa. </item> - <item>If you want to develop Toss on Ubuntu, here is a command with - a list of packages to install.<br/> + <item>Pod Ubuntu, poniższe polecenie zainstaluje pakiety niezbędne + do kompilacji Tossa.<br/> sudo apt-get install g++ python-qt4 python-dev pyqt4-dev-tools ocaml-findlib menhir libounit-ocaml-dev libapache2-mod-python sqlite3 python-pysqlite2 </item> - <item>This command will checkout the - <a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/">Toss - SVN Repository</a> to the <em>Toss</em> directory.<br/> + <item>Poniższe polecenie ściągnie + <a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/"> + Repozytorium SVN Tossa</a> do katalogu <em>Toss</em>.<br/> svn co https://toss.svn.sourceforge.net/svnroot/toss/trunk/Toss Toss </item> - <item>In the Toss directory run <em>make</em> and check that - it succeeds.</item> + <item>W katalogu Toss uruchom <em>make</em> i sprawdź czy dobrze + zadziałało.</item> </itemize> </section> - <section title="Understanding Toss"> + <section title="Understanding Toss" lang="en"> <itemize> <item><a href="create.html">Create</a> at least one simple game to get started.</item> - <item>Get acquainted with <a href="docs.html">Toss documentation</a>. + <item>Get acquainted with the <a href="docs.html">Toss documentation</a>. </item> <item>Do not forget to read the <a href="reference/reference.pdf"> reference.pdf</a> document.</item> @@ -105,8 +105,37 @@ about Toss to get an idea where the ideas come from.</item> </itemize> </section> + <section title="Toss Verstehen" lang="de"> + <itemize> + <item><a href="create.html">Erzeuge</a> wenigstens ein einfaches Spiel + mit Toss um die Grundlagen zu verstehen.</item> + <item>Lese die <a href="docs.html">Dokumentation</a> von Toss. + </item> + <item>Vergesse nicht die <a href="reference/reference.pdf"> + Reference.pdf</a> durchzublättern.</item> + <item>Wenn man Toss programmiert, ist die + <a href="code_doc/">Quellcode Dokumentation</a> oft nützlich.</item> + <item>Durch die <a href="Publications/">Papers und Talks</a> kann man + verstehen, woher die Ideen hinter Toss kommen.</item> + </itemize> + </section> + <section title="Zrozumieć Tossa" lang="pl"> + <itemize> + <item><a href="create.html">Stwórz</a> przynajmniej jedną prostą + grę w Tossie na początek.</item> + <item>Zapoznaj się z <a href="docs.html">dokumentacją Tossa</a>. + </item> + <item>Przejrzyj też <a href="reference/reference.pdf"> + reference.pdf</a>.</item> + <item>Podczas programowania poręczna jest + <a href="code_doc/">dokumentacja kodu</a>.</item> + <item>Oglądając <a href="Publications/">prace i referaty</a> + można dowiedzieć się, skąd czerpaliśmy pomysły w Tossie.</item> + </itemize> + </section> - <section title="Working with the Toss Team"> + + <section title="Working with the Toss Team" lang="en"> <par>If you have an idea for Toss, a request, want to become a developer or just want to talk, contact us! Most engaged Toss developers do respond to Toss questions on their private emails every @@ -122,5 +151,39 @@ <mailto address="mic...@gm..."/></item> </itemize> </section> + <section title="Mit Toss Team Zusammenarbeiten" lang="de"> + <par>Wenn du eine Idee für Toss hast, ein Vorschlag, eine Anfrage, + wenn du Toss programmieren möchtest oder einfach mit uns reden, + schreibe uns! Die angagiertesten Toss Developer beantworten + täglich Fragen über Toss auch auf privaten Emails (unten), aber es ist + am besten an <em>toss-devel</em> zu schreiben.</par> + <itemize> + <item>Toss Mailingliste: + <mailto address="tos...@li..."/></item> + <item>Łukasz Kaiser: + <mailto address="luk...@gm..."/></item> + <item>Łukasz Stafiniak: + <mailto address="luk...@gm..."/></item> + <item>Michał Wójcik: + <mailto address="mic...@gm..."/></item> + </itemize> + </section> + <section title="Praca z Nami" lang="pl"> + <par>Jeśli masz pomysł na zmiany w Tossie, prośbę o poprawienie buga, + chcesz zostać developerem Tossa albo po prostu z nami porozmawiac, + napisz! Najbardziej zaangażowani programiści Tossa odpowiadają + codziennie na maile nawet na swoich prywatnych adresach (poniżej), + ale najlepiej napisać na listę <em>toss-devel</em>.</par> + <itemize> + <item>Lista mailingowa Tossa: + <mailto address="tos...@li..."/></item> + <item>Łukasz Kaiser: + <mailto address="luk...@gm..."/></item> + <item>Łukasz Stafiniak: + <mailto address="luk...@gm..."/></item> + <item>Michał Wójcik: + <mailto address="mic...@gm..."/></item> + </itemize> + </section> </personal> Modified: trunk/Toss/www/reference/Makefile =================================================================== --- trunk/Toss/www/reference/Makefile 2011-03-14 11:11:08 UTC (rev 1359) +++ trunk/Toss/www/reference/Makefile 2011-03-15 00:46:12 UTC (rev 1360) @@ -16,6 +16,8 @@ cp reference.html index.html cp reference.html index.html.en cp reference.html index.html.de + cp reference.html index.html.pl + cp reference.html index.html.fr .PHONY: Modified: trunk/Toss/www/reference/reference.bib =================================================================== --- trunk/Toss/www/reference/reference.bib 2011-03-14 11:11:08 UTC (rev 1359) +++ trunk/Toss/www/reference/reference.bib 2011-03-15 00:46:12 UTC (rev 1360) @@ -1,3 +1,12 @@ +@inproceedings{GK10, + author = {T.~Ganzow and {\L}.~Kaiser}, + title = {New Algorithm for Weak Monadic Second-Order Logic on Inductive Structures}, + booktitle = {Proc.~of CSL'10}, + publisher = {Springer}, + series = {LNCS}, + year = {2010}, +} + @article{SUB96, author = {Marcos Salganicoff and Lyle H. Ungar and Ruzena Bajcsy}, title = {Active Learning for Vision-Based Robot Grasping}, Modified: trunk/Toss/www/reference/reference.tex =================================================================== --- trunk/Toss/www/reference/reference.tex 2011-03-14 11:11:08 UTC (rev 1359) +++ trunk/Toss/www/reference/reference.tex 2011-03-15 00:46:12 UTC (rev 1360) @@ -27,6 +27,29 @@ \@abbrev{sf}{\mathsf}{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz} \makeatother +\usepackage[ruled]{algorithm2e} +% tweak algorithm environment... +\makeatletter +%% at the end of algocf or figure environment +\renewcommand{\@algocf@finish}{% + \@algoinsideskip% + \egroup%end of vtop which contain all the text + \hfill\egroup%end of hbox wich contains [margin][vtop] + \ifthenelse{\boolean{algocf@slide}}{\DecMargin{\skipalgocfslide}}{}% + % + \egroup%end of main vbox + \end{lrbox}% + \algocf@makethealgo% print the algo +% \@algoskip% + \vskip-0.5em% + % restore dimension and macros + \setlength{\hsize}{\algowidth}% + \lineskip\normallineskip\setlength{\skiptotal}{\@defaultskiptotal}% + \let\;=\@mathsemicolon% +}% +\makeatother + + % Simple item labels \renewcommand{\labelitemi}{--} \renewcommand{\labelitemii}{--} @@ -49,7 +72,36 @@ \newcommand{\ol}[1]{\overline{#1}} \renewcommand{\phi}{\varphi} +% Formula forms and properties, boolean junctors +\newcommand{\Lor}{\bigvee} +\newcommand{\Land}{\bigwedge} +\newcommand{\BC}{\calB^+} +\newcommand{\CNF}{\ensuremath{\text{CNF}}\xspace} +\newcommand{\procCNF}{\ensuremath{\mathtt{CNF}}\xspace} +\newcommand{\DNF}{\ensuremath{\text{DNF}}\xspace} +\newcommand{\procDNF}{\ensuremath{\mathtt{DNF}}\xspace} +\newcommand{\TNF}{\ensuremath{\mathtt{TNF}}\xspace} +\DeclareMathOperator{\qr}{qr} +\DeclareMathOperator{\free}{free} +\newcommand{\fv}{\ensuremath{\mathtt{FreeVar}}\xspace} +\newcommand{\rank}{\ensuremath{\mathtt{rank}}\xspace} +\newcommand{\hitrank}{\ensuremath{\mathtt{hit}\text{-}\mathtt{rank}}\xspace} +% Theorem environments +\theoremstyle{plain} +\newtheorem{theorem}{Theorem} +\newtheorem{proposition}[theorem]{Proposition} +\newtheorem{corollary}[theorem]{Corollary} +\newtheorem{lemma}[theorem]{Lemma} + +\theoremstyle{definition} +\newtheorem{example}[theorem]{Example} +\newtheorem{claim}[theorem]{Claim} +\newtheorem{definition}[theorem]{Definition} + +% Rotated symbols +\newcommand\rotleadsto{\rotatebox{-90}{$\leadsto$}} + % Start \newcommand\thetitle{Toss Design and Specification} \title{\thetitle} @@ -60,7 +112,7 @@ \maketitle -\setcounter{tocdepth}{1} +\setcounter{tocdepth}{2} \tableofcontents \clearpage @@ -488,7 +540,7 @@ \chapter{Algorithms} -\section{Game Playing Algorithm} +\section{UCT Game Playing Algorithm} When playing a game, players need to decide what their next move is. To represent the preferences of each player, or rather her expectations @@ -684,8 +736,360 @@ The play in this iteration continues from one of those children, as depicted by the snaked line in Figure~\ref{fig-ttt-eval-uct}. -\section{Solver} +\section{Type Normal Form} +To derive evaluation heuristics from payoff terms, we first have to introduce +a normal form of formulas which we exploit later in the construction. This +normal form is in a sense a converse to the prenex normal form (PNF), because +the quantifiers are pushed as deep inside the formula as possible. A very +similar normal form has been used recently in a different +context \cite{GK10}. For a set of formulas $\Phi$ let us denote by +$\BC(\Phi)$ all positive Boolean combinations of formulas from $\Phi$, +\ie define $\BC(\Phi) \ = \ + \Phi \mid \BC(\Phi) \lor \BC(\Phi) \mid \BC(\Phi) \land \BC(\Phi)$. + +\begin{definition} +A formula is in TNF if and only if it is a positive Boolean combination +of formulas of the following form +\begin{align*} + \tau &= R_i(\ol{x}) \mid \neg R_i(\ol{x}) \mid x = y \mid x \neq y \mid + \exists x \BC(\tau) \mid \forall x \BC(\tau) +\end{align*} +satisfying the following crucial constraint: in +$\exists x \, \BC(\{\tau_i\})$ and $\forall x \, \BC(\{\tau_i\})$ +the free variables of \emph{each} $\tau_i$ +appearing in the Boolean combination \emph{must contain} $x$. +\end{definition} + +We claim that for each formula $\phi$ there exists an equivalent +formula $\psi$ in TNF, and the procedure \texttt{TNF}$(\phi)$ computes +$\psi$ given $\phi$ in negation normal form. Note that it uses sub-procedures +$\procDNF$ and $\procCNF$ which, given a Boolean combination of formulas, +convert it to disjunctive or respectively conjunctive normal form. + +As an example, consider $\phi=\exists x \big( P(x) \land (Q(y)\lor R(x)) \big)$; +This formula is not in TNF as $Q(y)$ appears under $\exists x$, and +\texttt{TNF}$(\phi) = \big( Q(y) \land \exists x P(x) \big) \lor + \exists x \big( P(x) \land R(x) \big)$. + +%\newcommand{\algoskip}{\vspace{0.5em}} +%\SetAlgoSkip{algoskip} +\begin{procedure}[h] +\caption{TNF($\phi$)} +\label{alg-tnf} +\lCase{$\phi$ is a literal}{\Return $\phi$}\; +\lCase{$\phi = \phi_1 \lor \phi_2$} + {\Return $\TNF(\phi_1) \lor \TNF(\phi_2)$}\; +\lCase{$\phi = \phi_1 \land \phi_2$} + {\Return $\TNF(\phi_1) \land \TNF(\phi_2)$}\; +\uCase{$\phi = \exists x \psi$} + {Let $\procDNF(\TNF(\psi)) = \Lor_i(\Land_j \psi^i_j)$\\ + and $F_i = \{j \mid x \in \free(\psi^i_j)\}$;\\ + \Return $\Lor_i\Big(\Land_{j \not\in F_i} \psi^i_j \land + \exists x (\Land_{j \in F_i} \psi^i_j)\Big)$\;} +\uCase{$\phi = \forall x \psi$} + {Let $\procCNF(\TNF(\psi)) = \Land_i(\Lor_j \psi^i_j)$\\ + and $F_i = \{j \mid x \in \free(\psi^i_j)\}$;\\ + \Return $\Land_i\Big(\Lor_{j \not\in F_i} \psi^i_j \lor + \forall x (\Lor_{j \in F_i} \psi^i_j)\Big)$\;} +\end{procedure} + + +\begin{theorem} \label{thm-tnf} +$\TNF(\phi)$ is equivalent to $\phi$ and in TNF. +\end{theorem} + +%\begin{proof} +% WARNING !!! REPLACE J by F !!! +%We proceed inductively on the structure of $\phi$. For literals all the claims +%are trivial since $\TNF$ is an identity. For Boolean combinations of formulas, +%the procedure $\TNF$ only calls itself recursively, +%thus all claims of the theorem follow inductively as well. +% +%Consider the case when $\phi = \exists x \psi$ and +%$\procDNF(\TNF(\psi)) = \Lor_i(\Land_j \psi^i_j)$. +%We convert $\TNF(\psi)$ to disjunctive normal form in this case +%since the existential quantifier is distributive over disjunction, +%and thus $\TNF(\phi) \equiv \Lor_i(\exists x \Land_j(\psi^i_j))$. +%Since quantifiers are also distributive over formulas which +%do not contain the quantified variable, we get that the result, +%$\Lor_i\Big(\Land_{j \in J_i} \psi^i_j \land +% \exists x (\Land_{j \not\in J_i} \psi^i_j)\Big)$, is equivalent +%to $\exists x \TNF(\psi)$, and thus by inductive hypothesis also to $\phi$. +%Since each formula $\psi^i_j$ is, by inductive hypothesis, in the form $\tau$, +%to show that the result is in TNF we only need to check that +%$\exists x (\Land_{j \in J_i} \psi^i_j)$ is in the form $\tau$. +%Syntactically this is trivial, and the constraint on variables in the TNF +%is indeed satisfied by the choice of $J_i$. The set of atoms does not increase +%by inductive hypothesis, and no new free variables appear by the choice of +%$J_i$ Furthermore, neither the quantifier rank nor the rank over +%any restricted variable increases. +%The case of universal quantification is analogous, +%modulo conversions between disjunctive and conjunctive normal forms +%(we assume that \procCNF and \procDNF do not create new atoms). +%\qed +%\end{proof} + +The proof of the above theorem is a simple argument by induction on +the structure of the formula, so we omit it here. Instead, let us give an +example which explains why it is useful to compute TNF for the goal formulas. + +\begin{example} +As already defined above, the payoff in Tic-tac-toe is given by +$\exists x,y,z (P(x) \land P(y) \land P(z) \land L(x, y, z))$. To simplify this +example, let us consider the payoff given only by row and column triples, \ie +\begin{align*} +\phi = \exists x,y,z \big( & P(x) \land P(y) \land P(z) \land \\ + & \big( (R(x,y) \land R(y, z)) \lor (C(x, y) \land C(y, z)) \big) \big). +\end{align*} +This formula is not in TNF and the DNF of the quantified part has the form +$\phi_1 \lor \phi_2$, where +\[ \phi_1 = P(x) \land P(y) \land P(z) \land R(x, y) \land R(y, z), \] +\[ \phi_2 = P(x) \land P(y) \land P(z) \land C(x, y) \land C(y, z). \] +The procedure \texttt{TNF} must now choose the variable to first split on +(this is discussed in the next section) and pushes the quantifiers inside, +resulting in $\TNF(\phi) = \psi_1 \lor \psi_2$ with +\[ \psi_1 = \exists x \big( P(x) \land \exists y \big( P(y) \land R(x, y) + \land \exists z (P(z) \land R(y, z)) \big) \big), \] +\[ \psi_2 = \exists x \big( P(x) \land \exists y \big( P(y) \land C(x, y) + \land \exists z (P(z) \land C(y, z)) \big) \big). \] +In spirit, the TNF formula is thus more ``step-by-step'' than the goal +formula we started with, and we exploit this to generate heuristics +for evaluating positions below. +\end{example} + + +\section{Heuristics from Existential Formulas} + +In this section, we present one method to generate a heuristic from +an existential goal formula. As a first important step, we divide all +relations appearing in the signature in our game into two sorts, +\emph{fluents} and \emph{stable relations}. A relation is called \emph{stable} +if it is not changed by any of the structure rewriting rules which appear +as possible moves, all other relations are \emph{fluent}. We detect +stable relations by a simple syntactic analysis of structure rewriting rules, +\ie we check which relations from the left-hand side remain unchanged +on the right-hand side of the rule. It is a big advantage of our formalism +in comparison to GDL that stable relations (such as row and column relations +used to represent the board) can so easily be separated from the fluents. + +After detecting the fluents, our first step in generating the heuristic +is to compute the TNF of the goal formula. As mentioned in the example +above, there is certain freedom in the \texttt{TNF} procedure as to +which quantified variable is to be resolved first. We use fluents to decide +this --- a variable which appears in a fluent will be resolved before +all other variables which do not appear in any fluent literal +(we choose arbitrarily in the remaining cases). + +After the TNF has been computed, we change each sequence of existential +quantifiers over conjunctions into a sum, counting how many +steps towards satisfying the whole conjunction have been made. Let us +fix a factor $\alpha < 1$ which we will discuss later. Our algorithm then +changes a formula in the following way. +\[ \exists x_1 \big( \vartheta_1(x_1) \land + \exists x_2 \big( \vartheta_1(x_2, x_1) \land \cdots \land + \exists x_n \big( \vartheta_n(x_n, \ol{x_i}) \big) \cdots \big) \big) +\] + +\vskip -2em + +\[ \rotleadsto \] +\[ \sum_{x_1 \mid \vartheta_1(x_1)} \!\! \big( \alpha^{n-1} + \!\!\! + \sum_{x_2 \mid \vartheta_2(x_2, x_1)} \!\! ( \alpha^{n-2} + \, \cdots ( \alpha \, + + \!\!\! \sum_{x_n \mid \vartheta_n(x_n, \ol{x_i})} \!\!\! 1 ) \cdots ) \big) \] + +The sub-formulas $\vartheta_i(x_i, \ol{x})$ are in this case conjunctions +of literals or formulas which contain universal quantifiers. The factor +$\alpha$ defines how much more making each next step is valued over +the previous one. %we call $\frac 1 \alpha$ the \emph{advancement factor}. +When a formula contains disjunctions, we use the above schema recursively +and sum the terms generated for each disjunct. + +To compute a heuristic for evaluating positions from a payoff term, +which is a real-valued expression in the logic defined above, we simply +substitute all characteristic functions, \ie expressions of the form +$\chi[\phi]$, by the sum generated for $\phi$ as described above. + +\begin{example} +Consider the TNF of the simplified goal formula for Tic-tac-toe presented +in the previous example and let $\alpha = \frac 1 4$. +Since the TNF of the goal formula for one player has +the form $\psi_1 \lor \psi_2$, we generate the following sums: +\[ s_1 = \sum_{x \mid P(x)} \big( {\frac 1 8} + \sum_{y \mid P(y) \land R(x, y)} ( + {\frac 1 4} + \sum_{z \mid P(z) \land R(y, z)} 1) \big), \] +\[ s_2 = \sum_{x \mid P(x)} \big( {\frac 1 8} + \sum_{y \mid P(y) \land C(x, y)} ( + {\frac 1 4} + \sum_{z \mid P(z) \land C(y, z)} 1) \big). \] +Since the payoff is defined by $\chi[\phi] - \chi[\phi']$, where $\phi'$ is +the goal formula for the other player, \ie with $Q$ in place of $P$, +the total generated heuristic has the form +\[ s_1 + s_2 - s'_1 - s'_2, \] +where $s_1'$ and $s_2'$ are as $s_1$ and $s_2$ but with $P$ replaced by $Q$. +\end{example} + + +\section{Finding Existential Descriptions} + +The method described above is effective if the TNF of the goal formulas +has a rich structure of existential quantifiers. But this is not always +the case, \eg in Breakthrough the goal formula for white has the form +$\exists x \, (W(x) \land \neg \exists y \, C(x, y))$, because +$\neg \exists y \, C(x, y)$ describes the last row which the player is +supposed to reach. The general question which presents itself in this +case is how, given an arbitrary relation $R(\ol{x})$ (as the last row above), +can one construct an existential formula describing this relation. +In this section, we present one method which turned out to yield useful +formulas at least for common board games. + +First of all, let us remark that the construction we present will be +done only for relations defined by formulas which do not contain fluents. +Thus, we can assume that the relation does not change during the game and +we use the starting structure in the construction of the existential formula. + +Our construction keeps a set $C$ of conjunctions of stable literals. +We say that a subset $\{ \phi_1, \ldots, \phi_n \} \subseteq C$ \emph{describes} +a relation $Q(\ol{x})$ in $\frakA$ if and only if $Q$ is equivalent +in $\frakA$ to the existentially quantified disjunction of $\phi_i$'s, \ie if +\[ \frakA \models Q(\ol{x}) \iff + \frakA \models \Lor_i\big( \exists \ol{y_i}\ \phi_i \big), \] +where $\ol{y_i}$ are all free variables of $\phi_i$ except for $\ol{x}$. + + +Our procedure extends the conjunctions from $C$ with new literals until +a subset which describes $Q$ is found. These extensions can in principle +be done in any order, but to obtain compact descriptions in reasonable +time we perform them in a greedy fashion. The conjunctions are +ordered by their hit-rank, defined as +\[ \hitrank_{\frakA, Q(\ol{x})}(\phi) = + \frac{|\{ \ol{x} \in Q \mid \frakA \models \exists \ol{y} \phi(\ol{x}) \}|} + {|\{ \ol{x} \mid \frakA \models \exists \ol{y} \phi(\ol{x}) \}|}, \] +where again $\ol{y} = \fv(\phi) \setminus \ol{x}$. Intuitively, the hit-rank is +the ratio of the tuples from $Q$ which satisfy (existentially quantified) $\phi$ +to the number of all such tuples. Thus, the hit-rank is $1$ if $\phi$ describes +$Q$ and we set the hit-rank to $0$ if $\phi$ is not satisfiable in $\frakA$. +We define the $\rank_{\frakA, Q}(\phi, R(\ol{y}))$ as the maximum of +the $\hitrank_{\frakA, Q}(\phi \land R(\ol{y}))$ and +the $\hitrank_{\frakA, Q}(\phi \land \neg R(\ol{y}))$. +The complete procedure is summarized below. + +%\renewcommand{\algoskip}{}%{\vspace{-1em}} +%\SetAlgoSkip{algoskip} +\begin{procedure}[h] +\caption{ExistentialDescription($\frakA$, $Q$)} +\label{alg-exd} +$C \longleftarrow \{ \top \}$\\ +\While{ no subset of $C$ describes $Q(\ol{x})$ in $\frakA$ }{ + \For{a stable relation $R(\ol{y})$, conjunction $\phi \in C$\\ + $\ \quad$ with maximal $\rank_{\frakA, Q}(\phi, R(\ol{y}))$}{ + %\lIf{($\fv(\phi) \cup \ol{x}) \cap \ol{y} = \emptyset$}{\Return}\\ + $\quad C \longleftarrow (C \setminus \{ \phi \}) \cup + \{ \phi \land R(\ol{y}), \ \phi \land \neg R (\ol{y}) \}$ + } +} +\end{procedure} + +Since it is not always possible to find an existential description +of a relation, let us remark that we stop the procedure if no description with +a fixed number of literals is found. We also use a tree-like data structure +for $C$ to check the existence of a describing subset efficiently. + +\begin{example} +As mentioned before, the last row on the board is defined by +the relation $Q(x) = \neg \exists y \, C(x, y)$. Assume that we search +for an existential description of this relation on a board with only +the binary row and column relations ($R$ and $C$) being stable, as +in Figure~\ref{fig-tic-tac-toe}. Since adding a row literal will +not change the hit-rank, our construction will be adding column literals +one after another and will finally arrive, on an $3 \times 3$ board, +at the following existential description: +$\exists y_1, y_2 ( C(y_1, y_2) \land C(y_2, x) )$. +Using such formula, the heuristic constructed in the previous section +can count the number of steps needed to reach the last row for each +pawn, which is a important \eg in Breakthrough. +\end{example} + + +\section{Alternative Heuristics with Rule Conditions} + +The algorithm presented above is only one method to derive heuristics, and it +uses only the payoff terms. In this section we present an alternative method, +which is simpler and uses also the rewriting rules and their constraints. +This simpler technique yields good heuristics only for games in which moves +are monotone and relatively free, \eg for Connect5. %(also known as Gomoku). +%We view this alternative heuristics as an example of other possibilities +%to exploit, which we discuss more thouroughly in the last section. + +Existential formulas are again the preferred input for the procedure, but this +time we put them in prenex normal form at the start. As before, all universally +quantified formulas are either treated as atomic relations or expanded, +as discussed above. The Boolean combination under the existential +quantifiers is then put in DNF and, in each conjunction in the DNF, +we separate fluents from stable relations. After such preprocessing, +the formula has the following form: +\[ \exists \ol{x} \, \big( + (\vartheta_1(\ol{x}) \land \psi_1(\ol{x})) \, \lor \, \cdots \, \lor \, + (\vartheta_n(\ol{x}) \land \psi_n(\ol{x})) \big), \] +where each $\vartheta_i(\ol{x})$ is a conjunction of fluents and +each $\psi_i(\ol{x})$ is a conjunction of stable literals. + +To construct the heuristic, we will retain the stable sub-formulas +$\psi_i(\ol{x})$ but change the fluent ones $\vartheta_i(\ol{x})$ from +conjunctions to sums. +Formally, if $\vartheta_i(\ol{x}) = F_1(\ol{x}) \land \cdots \land F_k(\ol{x})$ +then we define $s_i(\ol{x}) = \chi[F_1(\ol{x})] + \cdots + \chi[F_k(\ol{x})]$, +and let $\delta_i(\ol{x}) = F_1(\ol{x}) \lor \cdots \lor F_k(\ol{x})$ be +a formula checking if the sum $s_i(\ol{x}) > 0$. The guard for our heuristic +is defined as \[ \gamma(\ol{x}) = + \big( \psi_1(\ol{x}) \, \lor \, \cdots\, \lor \, \psi_n(\ol{x}) \big) \ \land + \ \big( \delta_1(\ol{x}) \, \lor \, \cdots \, \lor \, \delta_n(\ol{x}) \big) +\] and the heuristic with parameter $n$ by +\[ \sum_{\ol{x} \mid \gamma(\ol{x}) \land \mathtt{move}(\ol{x})} \big( + s_1(\ol{x}) + \cdots + s_n(\ol{x}) \big)^n. \] + +The additional formula $\mathtt{move}(\ol{x})$ is used to guarantee, +that at each element matched to one of the variables $\ol{x}$ it is +still possible to make a move. This is done by converting the rewrite +rule into a formula with free variables corresponding to the elements +of the left-hand side structure, removing all the fluents $F_i$ from +above if these appear negated, and quantifying existentially if a new +variable (not in $\ol{x}$) is created in the process. The following +example shows how the procedure is applied for Tic-tac-toe. + +\begin{example} +For Tic-tac-toe simplified as before (no diagonals), +the goal formula in PNF and DNF reads: +\begin{align*} + \exists x,y,z \ \big( & \, + (P(x) \, \land \, P(y) \, \land \, P(z) \, \land \, + R(x, y) \, \land \, R(y, z)) \\ + \lor & \, (P(x) \, \land \, P(y) \, \land \, P(z) \, \land \, + C(x, y) \, \land \, C(y, z)) \big). +\end{align*} +The resulting guard is thus, after simplification, +\begin{align*} +\gamma(x,y,z) = \big( & \, + (R(x, y) \, \land \, R(y, z))\, \lor\, (C(x, y) \, \land \, C(y, z)) \big)\\ + \land & \, \big( P(x) \, \lor \, P(y) \, \lor \, P(z) \big). +\end{align*} +Since the structure rewriting rule for the move has only one element, +say $u$, on its left-hand side, and $\tau_{\mr{e}} = \{P, Q\}$ for this rule, +the formula for the left-hand side reads $l(u) = \neg P(u) \land \neg Q(u)$. +Because $P$ appears as a fluent in $\gamma$ we remove all occurrences of +$\neg P$ from $l$ and are then left with $\mathtt{move}(u) = \neg Q(u)$. +Since we require that a move is possible from all variables, the derived +heuristic for one player with power $4$ has the form +\[ h \ \ = \!\!\!\! \!\!\!\! \!\! + \sum_{x, y, z \ \mid \ \gamma(x, y, z) \, \land \, \neg Q(x) + \, \land \, \neg Q(y) \, \land \, \neg Q(z)} \!\!\!\!\!\! + \!\!\!\!\!\! \!\!\!\!\!\! \!\!\!\!\!\! \!\!\!\!\!\! \!\!\!\!\!\! + (\chi[P(x)] + \chi[P(y)] + \chi[P(z)])^4. \] +Since the payoff expression is $\chi[\phi] - \chi[\phi']$, where $\phi'$ +is the goal formula for the other player, we use $h - h'$ as the final +heuristic to evaluate positions. +\end{example} + + +\section{Solver Techniques} + We used a SAT solver (MiniSAT) to operate on symbolic representations of MSO variables. We decided in favor of CNF representation instead of the more standard BDD approach as it seems to scale in a more consistent way. @@ -695,32 +1099,82 @@ (cylindrical algebraic decomposition) but works very consistently for many cases. +The main formula optimization is just performing the TNF, later we +only push predicates to the front. + + \chapter{Design} \section{Organization of Code} -Toss consists of a \emph{Client} module handling visualization and -a completely separate \emph{TossServer}. The communication is based -on socket requests, see the \texttt{Arena.mli} file for complete -specification of available server requests and response format. +Toss consists of the main \emph{TossServer} which is built from several +main modules explained in the sections below and corresponding to +directories in the code tree. The main modules contain OCaml modules +themselves. Toss additionally includes a few clients which provide +the user interface to Toss. At present there is a python GUI client +in \emph{Client} and a browser-based client in \emph{WebClient}. +Communication between the Server and the clients relies on +socket requests, see the \texttt{Arena.mli} file for complete +specification of available server requests and the response format. -\subsection{Server} -Toss server code is split in two parts, \emph{Solver} and \emph{Games} code. -The solver performs all functions related to structures, logic and constraint -solving, while the game code stores rules and games and implements the game -playing algorithm. The code is written in OCaml. +\section{Formula} +This most basic directory implements formulas as described above and various +operations on formulas which are necessary for other modules. It also +contains a parser for formulas and the lexing file used for all parsers. +The MiniSAT solver is included in this directory as it is used for formula +simplification. -\subsection{Client} -In general, it is possible to implement many Toss clients and there should -be no problem for them to interact with the same server. At present, we have -just one client which is written in python using the Qt4 library. +\section{Solver} +This directory contains the module which represents relational structures, +and the full Solver, including the elimination-based solver for the theory +of reals and the SAT-based solving algorithm for monadic second-order logic. +\section{Arena} + +This directory contains modules which implement the game definition, +including discrete and continuous structure rewriting, game file parser +and client-server communication parser and request type. + + +\section{Play} + +This directory contains modules responsible for automatic play, including +the heuristic generation module, the abstract game tree module and its +instantiations to Maximax and UCT. + + +\section{GGP} + +This directory contains the code which translates GDL files into Toss +format together with various needed simplifications. Multiple tests +and a Java GGP Server are also included there to facilitate testing +of the Toss-GGP code. + + +\section{Server} + +In this directory we simply keep the implementation of TossServer +together with several high-level tests to check that it works ok. + + +\section{Client} + +This stand-alone Toss client is written in python using the Qt4 library. + + +\section{WebClient} + +The browser-based client does not currently interface TossServer directly, +but uses a python request Handler.py as an intermediate step. This handler +also manages a database of users and games. + + %% Bibliography \bibliographystyle{plain} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-14 11:11:18
|
Revision: 1359 http://toss.svn.sourceforge.net/toss/?rev=1359&view=rev Author: lukstafi Date: 2011-03-14 11:11:08 +0000 (Mon, 14 Mar 2011) Log Message: ----------- Removed printing of empty relations in rule LHS and RHS structures as these are required to share signature with the model. Comparison of games modulo numbering of elements in structures, flattening of formulas, etc., display the first difference met. Modified Paths: -------------- trunk/Toss/Arena/Arena.ml trunk/Toss/Arena/Arena.mli trunk/Toss/Arena/ContinuousRule.ml trunk/Toss/Arena/ContinuousRule.mli trunk/Toss/Arena/ContinuousRuleTest.ml trunk/Toss/Arena/DiscreteRule.ml trunk/Toss/Arena/DiscreteRule.mli trunk/Toss/Arena/DiscreteRuleTest.ml trunk/Toss/GGP/GDL.ml trunk/Toss/GGP/GDLTest.ml trunk/Toss/GGP/GameSimplTest.ml trunk/Toss/Solver/Solver.ml trunk/Toss/Solver/Structure.ml trunk/Toss/Solver/Structure.mli trunk/Toss/Solver/StructureTest.ml trunk/Toss/caml_extensions/pa_backtrace.ml trunk/Toss/examples/rewriting_example.toss Modified: trunk/Toss/Arena/Arena.ml =================================================================== --- trunk/Toss/Arena/Arena.ml 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/Arena/Arena.ml 2011-03-14 11:11:08 UTC (rev 1359) @@ -347,7 +347,8 @@ Array.iter (fun loc -> Format.fprintf ppf "@[<1>LOC %d@ {@,@[<1>@,%a@]@,}@]@ " loc.id (fprint_loc_body struc player_names) loc) graph; - Format.fprintf ppf "@[<1>MODEL@ %a@]@ " Structure.fprint struc; + Format.fprintf ppf "@[<1>MODEL@ %a@]@ " + (Structure.fprint ~show_empty:true) struc; if cur_loc <> 0 then Format.fprintf ppf "@[<1>STATE LOC@ %d@]@ " cur_loc; if time <> 0. then @@ -391,6 +392,58 @@ drel, (args, f def)) game.defined_rels; } +(* Compare two (game, state) pairs and explain the first difference + met. Formulas and expressions are compared for syntactical + equality. Players need to be given in the same order. Data is ignored. *) +exception Diff_result of string + +let compare_diff ?(cmp_funs=(=)) (g1,s1) (g2,s2) = + try + let eq, msg = + Structure.compare_diff ~cmp_funs s1.struc s2.struc in + if not eq then raise (Diff_result ("Game state models differ: "^msg)); + if not (cmp_funs s1.time s2.time) then raise + (Diff_result ( + Printf.sprintf "Game state times %F and %F differ" s1.time s2.time)); + if s1.cur_loc <> s2.cur_loc then raise + (Diff_result ( + Printf.sprintf "Game state locations %d and %d differ" + s1.cur_loc s2.cur_loc)); + let rules = + try List.combine (List.sort Pervasives.compare g1.rules) + (List.sort Pervasives.compare g2.rules) + with Invalid_argument _ -> raise ( + Diff_result "Games have different number of rules") in + List.iter (fun ((rn1,r1),(rn2,r2))-> + if rn1 < rn2 then + raise (Diff_result ("Second game lacks rule "^rn1)); + if rn2 < rn1 then + raise (Diff_result ("First game lacks rule "^rn2)); + let eq, msg = + ContinuousRule.compare_diff ~cmp_funs r1 r2 in + if not eq then raise (Diff_result ( + "Games differ at rule "^rn1^": "^ msg)) + ) rules; + let cmp_pn (_,i) (_,j) = i-j in + let pnames1 = List.sort cmp_pn g1.player_names in + let pnames2 = List.sort cmp_pn g2.player_names in + if pnames1 <> pnames2 then + raise (Diff_result "Game players are given in different order."); + let norm_loc loc = + {loc with + moves = List.sort Pervasives.compare loc.moves; + payoffs = Array.map ( + FormulaOps.map_to_formulas_expr FormulaOps.flatten_formula) + loc.payoffs} in + if Array.map norm_loc g1.graph <> Array.map norm_loc g2.graph + then raise (Diff_result "Games have different graphs"); + if List.sort Pervasives.compare g1.defined_rels <> + List.sort Pervasives.compare g2.defined_rels + then raise (Diff_result "Games have different defined relations"); + true, "equal" + with Diff_result expl -> false, expl + + (* ------------------ REQUESTS TO THE ARENA USED IN OPERATION --------------- *) (* Location of a structure: either arena or left or right-hand side of a rule *) Modified: trunk/Toss/Arena/Arena.mli =================================================================== --- trunk/Toss/Arena/Arena.mli 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/Arena/Arena.mli 2011-03-14 11:11:08 UTC (rev 1359) @@ -111,6 +111,15 @@ val map_to_formulas : (Formula.formula -> Formula.formula) -> game -> game +(** Compare two (game, state) pairs and explain the first difference + met. Formulas and expressions are compared for syntactical + equality. Players need to be given in the same order. Data is + ignored. *) +val compare_diff : + ?cmp_funs:(float -> float -> bool) -> + game * game_state -> game * game_state -> bool * string + + (** {2 Requests to the Arena used in Operation} *) (** Location of a structure: either arena or left or right-hand side of a rule *) Modified: trunk/Toss/Arena/ContinuousRule.ml =================================================================== --- trunk/Toss/Arena/ContinuousRule.ml 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/Arena/ContinuousRule.ml 2011-03-14 11:11:08 UTC (rev 1359) @@ -239,3 +239,25 @@ ignore (Format.flush_str_formatter ()); fprint Format.str_formatter r; Format.flush_str_formatter () + + +(* Compare two rules and explain the first difference + met. Formulas and expressions are compared for structural equality. *) +exception Diff_result of string + +let compare_diff ?(cmp_funs=(=)) r1 r2 = + try + let eq, msg = + DiscreteRule.compare_diff ~cmp_funs r1.discrete r2.discrete in + if not eq then raise (Diff_result msg); + if List.sort Pervasives.compare r1.dynamics <> + List.sort Pervasives.compare r2.dynamics + then raise (Diff_result "Rule dynamics differ"); + if List.sort Pervasives.compare r1.update <> + List.sort Pervasives.compare r2.update + then raise (Diff_result "Rule update functions differ"); + if r1.inv <> r2.inv then raise (Diff_result "Rule invariants differ"); + if r1.post <> r2.post then + raise (Diff_result "Rule postconditions differ"); + true, "equal" + with Diff_result expl -> false, expl Modified: trunk/Toss/Arena/ContinuousRule.mli =================================================================== --- trunk/Toss/Arena/ContinuousRule.mli 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/Arena/ContinuousRule.mli 2011-03-14 11:11:08 UTC (rev 1359) @@ -88,3 +88,9 @@ (int * int) list -> rule -> float -> (string * float) list -> (Structure.structure * float * ((string * string) * Term.term list) list) option + +(** Compare two rules and explain the first difference + met. Formulas and expressions are compared for structural equality. *) +val compare_diff : + ?cmp_funs:(float -> float -> bool) -> + rule -> rule -> bool * string Modified: trunk/Toss/Arena/ContinuousRuleTest.ml =================================================================== --- trunk/Toss/Arena/ContinuousRuleTest.ml 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/Arena/ContinuousRuleTest.ml 2011-03-14 11:11:08 UTC (rev 1359) @@ -128,6 +128,42 @@ ); + "compare_diff" >:: + (fun () -> + let discr = + "[a, b | R (a, b) | ] -> [c, d | R (c, d) | ] emb R with [c <- a, d <- b] " in + let s = discr ^ " pre true inv true post true" in + let signat = ["R", 2] in + let r1 = rule_of_str s signat [] "rule1" in + let r2 = rule_of_str s signat [] "rule2" in + assert_equal ~printer:(fun (_,x)->x) ~msg:"1. no continuous" + (true,"equal") + (ContinuousRule.compare_diff r1 r2); + + let upd_eq = " f(c) = 2. * f(a);\n f(d) = f(b)\n" in + let s = discr ^ "\nupdate\n" ^ upd_eq ^ " pre true inv true post true" in + let r1 = rule_of_str s signat [] "rule2" in + let upd_eq = " f(c) = 3. * f(a);\n f(d) = f(b)\n" in + let s = discr ^ "\nupdate\n" ^ upd_eq ^ " pre true inv true post true" in + let r2 = rule_of_str s signat [] "rule3" in + assert_equal ~printer:(fun (_,x)->x) ~msg:"2. update" + (false,"Rule update functions differ") + (ContinuousRule.compare_diff r1 r2); + + let upd_eq = " f(c) = 2. * f(a);\n f(d) = f(b)\n" in + let dyn_eq = " f(a)' = (2. * f(a)) + t;\n f(b)' = f(b)" in + let s = discr ^ "\ndynamics\n" ^ dyn_eq ^ "\nupdate\n" ^ upd_eq ^ + " pre true inv true post true" in + let r1 = rule_of_str s signat [] "rule4" in + let dyn_eq = " f(a)' = (3. * f(a)) + t;\n f(b)' = f(b)" in + let s = discr ^ "\ndynamics\n" ^ dyn_eq ^ "\nupdate\n" ^ upd_eq ^ + " pre true inv true post true" in + let r2 = rule_of_str s signat [] "rule5" in + assert_equal ~printer:(fun (_,x)->x) ~msg:"3. dynamics" + (false,"Rule dynamics differ") + (ContinuousRule.compare_diff r1 r2); + ); + ] let a = Modified: trunk/Toss/Arena/DiscreteRule.ml =================================================================== --- trunk/Toss/Arena/DiscreteRule.ml 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/Arena/DiscreteRule.ml 2011-03-14 11:11:08 UTC (rev 1359) @@ -933,7 +933,7 @@ let opt_s = Aux.concat_map (fun rel -> try - let arity = signat rel in + let arity = List.assoc rel signat in let tups = List.map Array.of_list @@ -965,7 +965,7 @@ let rhs_struc, elem = Structure.add_new_elem rhs_struc ~name () in rhs_struc, (name, elem)::struc_elems) - (Structure.empty_structure (), []) struc_elems in + (Structure.empty_with_signat signat, []) struc_elems in let add_rels = List.fold_left (fun struc (rel, args) -> Structure.add_rel struc rel (Array.map (fun n -> List.assoc n struc_elems) args)) in @@ -1040,8 +1040,8 @@ let fprint_rule f r = Format.fprintf f "@[<1>%a@ ->@ %a" - Structure.fprint r.lhs_struc - Structure.fprint r.rhs_struc; + (Structure.fprint ~show_empty:false) r.lhs_struc + (Structure.fprint ~show_empty:false) r.rhs_struc; if r.emb_rels <> [] then Format.fprintf f "@ @[<1>emb@ %a@]" (Aux.fprint_sep_list "," Format.pp_print_string) r.emb_rels; @@ -1089,3 +1089,58 @@ rhs.Structure.elements [] | Some rs -> List.map (fun (re,le) -> r_elem re, l_elem le) rs + + +(* Compare two rules and explain the first difference + met. Preconditions are compared for structural equality. *) +exception Diff_result of string + +let compare_diff ?(cmp_funs=(=)) r1 r2 = + try + let eq, msg = + Structure.compare_diff ~cmp_funs r1.lhs_struc r2.lhs_struc in + if not eq then raise (Diff_result ( + "Rule LHS structures differ: "^msg)); + let eq, msg = + Structure.compare_diff ~cmp_funs r1.rhs_struc r2.rhs_struc in + if not eq then raise (Diff_result ( + "Rule RHS structures differ: "^msg)); + let pre1 = FormulaOps.flatten_formula r1.pre in + let pre2 = FormulaOps.flatten_formula r2.pre in + if pre1 <> pre2 then raise (Diff_result ( + Printf.sprintf "Rule preconditions differ:\n%s\n =/=\n%s" + (Formula.sprint pre1) (Formula.sprint pre2))); + let embs1 = Aux.list_diff r1.emb_rels r2.emb_rels in + if embs1 <> [] then raise ( + Diff_result ("Relation "^List.hd embs1^ + " is embedded only in the first rule")); + let embs2 = Aux.list_diff r1.emb_rels r2.emb_rels in + if embs2 <> [] then raise ( + Diff_result ("Relation "^List.hd embs2^ + " is embedded only in the second rule")); + (* enough to check that "the diagram commutes" in one direction... *) + List.iter (fun (rhs_e,lhs_e) -> + let lhs_n = Structure.elem_str r1.lhs_struc lhs_e in + let rhs_n = Structure.elem_str r1.rhs_struc rhs_e in + let rhs_e2 = Structure.find_elem r2.rhs_struc rhs_n in + (let try lhs_e2 = List.assoc rhs_e2 r2.rule_s in + let lhs_n2 = Structure.elem_str r2.lhs_struc lhs_e2 in + if lhs_n <> lhs_n2 then raise (Diff_result ( + Printf.sprintf + "RHS element %s is mapped to LHS %s instead of %s in the second rule" + rhs_n lhs_n2 lhs_n)) + with Not_found -> raise (Diff_result ( + Printf.sprintf "Element %s is fresh only in the second rule" + rhs_n))) + ) r1.rule_s; + (* if we check the domain *) + List.iter (fun (rhs_e2,lhs_e2) -> + let rhs_n2 = Structure.elem_str r2.rhs_struc rhs_e2 in + let rhs_e1 = Structure.find_elem r1.rhs_struc rhs_n2 in + if not (List.mem_assoc rhs_e1 r1.rule_s) + then raise (Diff_result ( + Printf.sprintf "RHS element %s is fresh only in the first rule" + rhs_n2)) + ) r2.rule_s; + true, "equal" + with Diff_result expl -> false, expl Modified: trunk/Toss/Arena/DiscreteRule.mli =================================================================== --- trunk/Toss/Arena/DiscreteRule.mli 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/Arena/DiscreteRule.mli 2011-03-14 11:11:08 UTC (rev 1359) @@ -131,7 +131,7 @@ val translate_from_precond : precond:Formula.formula -> add:(string * string array) list -> (* del:(string * string array) list -> *) - emb_rels:string list -> signat:(string -> int) -> + emb_rels:string list -> signat:(string * int) list -> struc_elems:string list -> rule (** {2 Printing.} *) @@ -152,3 +152,9 @@ val build_rule_s : ?rule_s:(string * string) list -> Structure.structure -> Structure.structure -> (int * int) list + +(** Compare two rules and explain the first difference + met. Preconditions are compared for structural equality. *) +val compare_diff : + ?cmp_funs:(float -> float -> bool) -> + rule -> rule -> bool * string Modified: trunk/Toss/Arena/DiscreteRuleTest.ml =================================================================== --- trunk/Toss/Arena/DiscreteRuleTest.ml 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/Arena/DiscreteRuleTest.ml 2011-03-14 11:11:08 UTC (rev 1359) @@ -36,11 +36,11 @@ "sprint: simple" >:: (fun () -> let s= - "[a | P:1 {}; Q (a) | ] -> [b | P (b); Q:1 {} | ] emb Q with [b <- a]" in + "[a | Q (a) | ] -> [b | P (b) | ] emb Q with [b <- a]" in let r = rule_of_str ["Q",1;"P",1] s in assert_equal s ~printer:(fun x->x) (sprint_rule r); - let s="[a | P:1 {}; Q (a) | ] -> [a | P (a); Q:1 {} | ]" in + let s="[a | Q (a) | ] -> [a | P (a) | ]" in let r = rule_of_str ["Q",1;"P",1] s in assert_equal ~printer:(fun x->x) s (sprint_rule r); ); @@ -51,7 +51,7 @@ D {(c, c); (c, a); (c, b); (b, a); (b, b)}; P {c; b}; Q {a; b}; R {(c, c); (a, c); (a, b); (b, c); (b, b)} | f {b->3., a->2., c->4.}; g {a->1., c->5.} - ] -> [b, c | D {(c, b); (c, c)}; P (b); Q:1 {}; R (c, c) | ] emb Q + ] -> [b, c | D {(c, b); (c, c)}; P (b); R (c, c) | ] emb Q with [c <- c, b <- a]" in let r = rule_of_str ["D",2;"R",2;"Q",1;"P",1] s in assert_equal ~printer:(fun x->x) s (sprint_rule r); @@ -683,6 +683,44 @@ (rule_obj_str rule_obj); ); + + "compare_diff" >:: + (fun () -> + let r1 = rule_of_str ["Q",1;"P",1] + "[a | P:1 {}; Q (a) | ] -> [b | P (b); Q:1 {} | ] emb Q with [b <- a]" in + let r2 = rule_of_str ["Q",1;"P",1] + "[a | Q (a) | ] -> [b | P (b) | ] emb Q with [b <- a]" in + assert_equal ~printer:(fun (_,x)->x) + (true,"equal") + (DiscreteRule.compare_diff r1 r2); + + let r1 = rule_of_str ["Q",1;"P",1] + "[a | P (a); Q (a) | ] -> [b | P (b) | ] emb Q with [b <- a]" in + let r2 = rule_of_str ["Q",1;"P",1] + "[a | Q (a) | ] -> [b | P (b) | ] emb Q with [b <- a]" in + assert_equal ~printer:(fun (_,x)->x) + (false,"Rule LHS structures differ: Relation tuple P(a) not found in the second structure") + (DiscreteRule.compare_diff r1 r2); + + let r1 = rule_of_str ["Q",1;"P",1] + "[a | Q (a) | ] -> [b | P (b) | ] emb Q with [b <- a]" in + let r2 = rule_of_str ["Q",1;"P",1] + "[a | Q (a) | ] -> [b | P (b) | ] emb P with [b <- a]" in + assert_equal ~printer:(fun (_,x)->x) + (false,"Relation Q is embedded only in the first rule") + (DiscreteRule.compare_diff r1 r2); + + let r1 = rule_of_str ["Q",1;"P",1] + "[a,b | Q (a); P(b) | ] -> [b | P (b) | ] emb Q with [b <- a]" in + let r2 = rule_of_str ["Q",1;"P",1] + "[a,b | Q (a); P(b) | ] -> [b | P (b) | ] emb Q with [b <- b]" in + assert_equal ~printer:(fun (_,x)->x) + (false, + "RHS element b is mapped to LHS b instead of a in the second rule") + (DiscreteRule.compare_diff r1 r2); + + ); + ] let a = Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/GGP/GDL.ml 2011-03-14 11:11:08 UTC (rev 1359) @@ -3382,8 +3382,7 @@ rname ); (* }}} *) - let signat rel = - Structure.StringMap.find rel struc.Structure.rel_signature in + let signat = Structure.rel_signature struc in let discrete = DiscreteRule.translate_from_precond ~precond ~add:rhs_pos ~emb_rels:fluents ~signat ~struc_elems in @@ -3432,7 +3431,7 @@ } in (* {{{ log entry *) (* * - let file = open_out "./GGP/tests/connect5-raw.toss" in + let file = open_out "./GGP/tests/breakthrough-raw.toss" in output_string file (Arena.state_str result); close_out file; * *) @@ -3452,7 +3451,7 @@ ) loc_noop_legal in (* {{{ log entry *) (* * - let file = open_out "./GGP/tests/connect5-simpl.toss" in + let file = open_out "./GGP/tests/breakthrough-simpl.toss" in output_string file (Arena.state_str result); close_out file; * *) @@ -3550,8 +3549,7 @@ (Formula.sprint precond) ); (* }}} *) - let signat rel = - Structure.StringMap.find rel struc.Structure.rel_signature in + let signat = Structure.rel_signature struc in let rule = DiscreteRule.translate_from_precond ~precond ~add ~emb_rels:gdl.fluents ~signat ~struc_elems in Modified: trunk/Toss/GGP/GDLTest.ml =================================================================== --- trunk/Toss/GGP/GDLTest.ml 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/GGP/GDLTest.ml 2011-03-14 11:11:08 UTC (rev 1359) @@ -5,6 +5,13 @@ GDLParser.parse_game_description KIFLexer.lex (Lexing.from_string s) +let state_of_file s = + let f = open_in s in + let res = + ArenaParser.parse_game_state Lexer.lex + (Lexing.from_channel f) in + res + let load_rules fname = let f = open_in fname in let descr = @@ -83,15 +90,16 @@ (fun () -> let connect5 = load_rules "./GGP/examples/connect5.gdl" in let _, res = GDL.translate_game (Const "x") connect5 in - let goalf = open_in "./GGP/tests/connect5-simpl.toss" in + let goal = state_of_file "./GGP/tests/connect5-simpl.toss" in let resf = open_out "./GGP/tests/connect5-temp.toss" in - let goal_str = Aux.input_file goalf in let res_str = Arena.state_str res in output_string resf res_str; - close_in goalf; close_out resf; - assert_equal - ~msg:"GGP/examples/connect5.gdl to GGP/tests/connect5-simpl.toss, see GGP/tests/connect5-temp.toss" - goal_str res_str; + close_out resf; + let eq, msg = Arena.compare_diff goal res in + assert_bool + ("GGP/examples/connect5.gdl to GGP/tests/connect5-simpl.toss, \ + see GGP/tests/connect5-temp.toss: "^msg) + eq; Sys.remove "./GGP/tests/connect5-temp.toss" ); @@ -99,15 +107,17 @@ (fun () -> let breakthrough = load_rules "./GGP/examples/breakthrough.gdl" in let _, res = GDL.translate_game (Const "white") breakthrough in - let goalf = open_in "./GGP/tests/breakthrough-simpl.toss" in + let goal = state_of_file "./GGP/tests/breakthrough-simpl.toss" in let resf = open_out "./GGP/tests/breakthrough-temp.toss" in - let goal_str = Aux.input_file goalf in let res_str = Arena.state_str res in output_string resf res_str; - close_in goalf; close_out resf; - assert_equal - ~msg:"GGP/examples/breakthrough.gdl to GGP/tests/breakthrough-simpl.toss, see GGP/tests/breakthrough-temp.toss" - goal_str res_str; + close_out resf; + let eq, msg = Arena.compare_diff goal res in + assert_bool + ("GGP/examples/breakthrough.gdl to \ + GGP/tests/breakthrough-simpl.toss, see + GGP/tests/breakthrough-temp.toss: "^msg) + eq; Sys.remove "./GGP/tests/breakthrough-temp.toss" ); @@ -136,5 +146,5 @@ let breakthrough = load_rules "./GGP/examples/breakthrough.gdl" in let connect5 = load_rules "./GGP/examples/connect5.gdl" in let tictactoe = load_rules "./GGP/examples/tictactoe.gdl" in - let gdl_def, toss_def = GDL.translate_game (Const "x") connect5 in + let gdl_def, toss_def = GDL.translate_game (Const "white") breakthrough in ignore gdl_def; ignore connect5; ignore breakthrough; ignore tictactoe Modified: trunk/Toss/GGP/GameSimplTest.ml =================================================================== --- trunk/Toss/GGP/GameSimplTest.ml 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/GGP/GameSimplTest.ml 2011-03-14 11:11:08 UTC (rev 1359) @@ -14,15 +14,16 @@ (fun () -> let connect5 = state_of_file "./GGP/tests/connect5-raw.toss" in let res = GameSimpl.simplify connect5 in - let goalf = open_in "./GGP/tests/connect5-simpl.toss" in + let goal = state_of_file "./GGP/tests/connect5-simpl.toss" in let resf = open_out "./GGP/tests/connect5-temp.toss" in - let goal_str = Aux.input_file goalf in let res_str = Arena.state_str res in output_string resf res_str; - close_in goalf; close_out resf; - assert_equal - ~msg:"tests/connect5-raw.toss to tests/connect5-simpl.toss, see GGP/tests/connect5-temp.toss" - goal_str res_str; + close_out resf; + let eq, msg = Arena.compare_diff goal res in + assert_bool + ("tests/connect5-raw.toss to tests/connect5-simpl.toss, see \ + GGP/tests/connect5-temp.toss: "^msg) + eq; Sys.remove "./GGP/tests/connect5-temp.toss" ); @@ -30,15 +31,16 @@ (fun () -> let breakthrough = state_of_file "./GGP/tests/breakthrough-raw.toss" in let res = GameSimpl.simplify breakthrough in - let goalf = open_in "./GGP/tests/breakthrough-simpl.toss" in + let goal = state_of_file "./GGP/tests/breakthrough-simpl.toss" in let resf = open_out "./GGP/tests/breakthrough-temp.toss" in - let goal_str = Aux.input_file goalf in let res_str = Arena.state_str res in output_string resf res_str; - close_in goalf; close_out resf; - assert_equal - ~msg:"tests/breakthrough-raw.toss to tests/breakthrough-simpl.toss, see GGP/tests/breakthrough-temp.toss" - goal_str res_str; + close_out resf; + let eq, msg = Arena.compare_diff goal res in + assert_bool + ("tests/breakthrough-raw.toss to tests/breakthrough-simpl.toss, see \ + GGP/tests/breakthrough-temp.toss: "^msg) + eq; Sys.remove "./GGP/tests/breakthrough-temp.toss" ); Modified: trunk/Toss/Solver/Solver.ml =================================================================== --- trunk/Toss/Solver/Solver.ml 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/Solver/Solver.ml 2011-03-14 11:11:08 UTC (rev 1359) @@ -142,8 +142,9 @@ if List.exists (fun v -> List.mem v aset_vars) vl then let asg_s = AssignmentSet.str aset in let form_s = Formula.str (Ex (vl, phi)) in - let msg_s = "solver: multiple vars?\n "^ asg_s ^ "\n "^ form_s in - (* failwith msg_s *) Any + (*let msg_s = + "solver: multiple vars?\n "^ asg_s ^ "\n "^ form_s in + failwith msg_s *) Any else aset in let phi_asgn = eval model elems in_aset phi in report (join aset (project_list elems phi_asgn vl)) @@ -153,8 +154,9 @@ if List.exists (fun v -> List.mem v aset_vars) vl then let asg_s = AssignmentSet.str aset in let form_s = Formula.str (Ex (vl, phi)) in - let msg_s = "solver: multiple vars?\n "^ asg_s ^ "\n "^ form_s in - (* failwith msg_s *) Any + (*let msg_s = + "solver: multiple vars?\n "^ asg_s ^ "\n "^ form_s in + failwith msg_s *) Any else aset in let phi_asgn = eval model elems in_aset phi in report (join aset (universal_list elems phi_asgn vl)) Modified: trunk/Toss/Solver/Structure.ml =================================================================== --- trunk/Toss/Solver/Structure.ml 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/Solver/Structure.ml 2011-03-14 11:11:08 UTC (rev 1359) @@ -483,13 +483,15 @@ (* Print the structure [struc] as string, in extensive form (not using condensed representations like boards). *) -let ext_str struc = +let ext_str ?(show_empty=true) struc = let elem_s = String.concat ", " (List.map (elem_str struc) (Elems.elements struc.elements)) in let (rel_s, fun_s) = (ref "", ref "") in StringMap.iter - (fun rn ts -> rel_s := !rel_s ^ "; " ^ rel_str struc rn ts) + (fun rn ts -> + if show_empty || not (Tuples.is_empty ts) then + rel_s := !rel_s ^ "; " ^ rel_str struc rn ts) struc.relations; StringMap.iter (fun fn vals -> fun_s := !fun_s ^ "; " ^ fun_str struc fn vals) @@ -998,9 +1000,9 @@ board ^ "\"", gc_elems !ret -let str struc = +let str ?(show_empty=true) struc = let board, struc = board_to_string struc in - ext_str struc ^ (if board = "" then "" else " " ^ board) + ext_str ~show_empty struc ^ (if board = "" then "" else " " ^ board) let fprint_rel ?(print_arity=true) struc f (rel_name, ts) = if print_arity && Tuples.is_empty ts then @@ -1023,9 +1025,12 @@ Format.fprintf f "@[<1>%s@ {@,@[<1>%a@]@,}@]" fun_name (Aux.fprint_sep_list "," update) elements -let fprint_ext_structure f struc = +let fprint_ext_structure ~show_empty f struc = let rels = - StringMap.fold (fun k v acc -> (k,v)::acc) struc.relations [] in + StringMap.fold (fun k v acc -> + if show_empty || not (Tuples.is_empty v) then + (k,v)::acc + else acc) struc.relations [] in let funs = StringMap.fold (fun k v acc -> (k,v)::acc) struc.functions [] in let rels = List.rev rels and funs = List.rev funs in @@ -1037,19 +1042,20 @@ (Aux.fprint_sep_list ";" (fprint_rel struc)) rels (Aux.fprint_sep_list ";" (fprint_fun struc)) funs -let fprint f struc = +let fprint ~show_empty f struc = let board, struc = board_to_string struc in - if board = "" then fprint_ext_structure f struc + if board = "" then fprint_ext_structure ~show_empty f struc else (* no line break after the closing bracket to stress that it is the same structure; no formatter breaks inside the board *) Format.fprintf f "%a @[<h 1>%s@]" - fprint_ext_structure struc board + (fprint_ext_structure ~show_empty) struc board -let print struc = fprint Format.std_formatter struc -let sprint struc = +let print ?(show_empty=true) struc = + fprint ~show_empty Format.std_formatter struc +let sprint ?(show_empty=true) struc = ignore (Format.flush_str_formatter ()); - Format.fprintf Format.str_formatter "%a" fprint struc; + Format.fprintf Format.str_formatter "%a" (fprint ~show_empty) struc; Format.flush_str_formatter () let board_elem_coords name = @@ -1066,6 +1072,56 @@ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" in Char.escaped col_index.[col-1] ^ string_of_int row +(* Compare two structures and explain the first difference met. *) +exception Diff_result of string +let contained_in cmp_funs s1 s2 other = + let map_elem e1 = + let name = elem_str s1 e1 in + try find_elem s2 name + with Not_found -> raise (Diff_result ( + "Element "^name^" not found in the "^other^" structure")) in + Elems.iter (fun e -> ignore (map_elem e)) s1.elements; + StringMap.iter (fun rel tups -> + (let try tups2 = StringMap.find rel s2.relations in + Tuples.iter (fun tup -> + let tup2 = Array.map map_elem tup in + if not (Tuples.mem tup2 tups2) + then raise (Diff_result ( + Printf.sprintf + "Relation tuple %s(%s) not found in the %s structure" + rel (String.concat ", " + (List.map (elem_str s1) (Array.to_list tup))) + other)) + ) tups + with Not_found -> raise (Diff_result ( + "Relation "^rel^" not found in the "^other^" structure")) + )) s1.relations; + StringMap.iter (fun fn vals -> + (let try vals2 = StringMap.find fn s2.functions in + IntMap.iter (fun e v -> + let v2 = IntMap.find (map_elem e) vals2 in + try + if not (cmp_funs v v2) + then raise (Diff_result ( + Printf.sprintf + "Function %s(%s)->%F is %F instead in the %s structure" + fn (elem_str s1 e) v v2 other)) + with Not_found -> raise (Diff_result ( + Printf.sprintf + "Function %s(%s) not found in the second structure" + fn (elem_str s1 e))) + ) vals + with Not_found -> raise (Diff_result ( + "Function "^fn^" not found in the "^other^" structure")) + )) s1.functions + +let compare_diff ?(cmp_funs=(=)) s1 s2 = + try + contained_in cmp_funs s1 s2 "second"; + contained_in cmp_funs s2 s1 "first"; + true, "equal" + with Diff_result expl -> false, expl + (* -------------------- PARSER HELPERS -------------------- *) let is_uppercase c = c >= 'A' && c <= 'Z' Modified: trunk/Toss/Solver/Structure.mli =================================================================== --- trunk/Toss/Solver/Structure.mli 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/Solver/Structure.mli 2011-03-14 11:11:08 UTC (rev 1359) @@ -82,11 +82,12 @@ val sig_str : structure -> string (** Print the structure [struc] as string, in extensive form (not using - condensed representations like boards). *) -val ext_str : structure -> string + condensed representations like boards). If [show_empty] is false, + do not print the signatures of empty relations. *) +val ext_str : ?show_empty:bool -> structure -> string (** Print the structure [struc] as string. *) -val str : structure -> string +val str : ?show_empty:bool -> structure -> string val fprint_rel : @@ -97,14 +98,14 @@ structure -> Format.formatter -> string * float IntMap.t -> unit val fprint_ext_structure : - Format.formatter -> structure -> unit + show_empty:bool -> Format.formatter -> structure -> unit val fprint : - Format.formatter -> structure -> unit + show_empty:bool -> Format.formatter -> structure -> unit -val print : structure -> unit +val print : ?show_empty:bool -> structure -> unit -val sprint : structure -> string +val sprint : ?show_empty:bool -> structure -> string (** Coordinates, column first, of a board element name. Raises [Not_found] if the name is not of proper format. *) @@ -114,6 +115,11 @@ [Not_found] if the coordinates are out of bounds. *) val board_coords_name : int * int -> string +(** Compare two structures and explain the first difference met. *) +val compare_diff : + ?cmp_funs:(float -> float -> bool) -> + structure -> structure -> bool * string + (** {2 Adding elements possibly with string names} *) Modified: trunk/Toss/Solver/StructureTest.ml =================================================================== --- trunk/Toss/Solver/StructureTest.ml 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/Solver/StructureTest.ml 2011-03-14 11:11:08 UTC (rev 1359) @@ -379,6 +379,50 @@ ]" ); + + "compare_diff" >:: + (fun () -> + assert_equal ~printer:(fun (_,x)->x) + (true, "equal") + (compare_diff + (struc_of_string "[a,b | R(a,b) | ]") + (struc_of_string "[a,b | R(a,b) | ]")); + assert_equal ~printer:(fun (_,x)->x) + (true, "equal") + (compare_diff + (struc_of_string "[a,b,c | R(a,b) | f {a->2.}; g{b->3.} ]") + (struc_of_string "[a,b,c | R(a,b) | f {a->2.}; g{b->3.} ]")); + assert_equal ~printer:(fun (_,x)->x) + (false, "Relation tuple R(a, b) not found in the second structure") + (compare_diff + (struc_of_string "[a,b | R(a,b) | ]") + (struc_of_string "[a,b | R(b,a) | ]")); + assert_equal ~printer:(fun (_,x)->x) + (false, "Function g(b)->3. is 4. instead in the second structure") + (compare_diff + (struc_of_string "[a,b,c | R(a,b) | f {a->2.}; g{b->3.} ]") + (struc_of_string "[a,b,c | R(a,b) | f {a->2.}; g{b->4.} ]")); + assert_equal ~printer:(fun (_,x)->x) + (false, "Relation R not found in the second structure") + (compare_diff + (struc_of_string "[a,b | R(a,b) | ]") + (struc_of_string "[a,b | C(a,b) | ]")); + assert_equal ~printer:(fun (_,x)->x) + (false, "Element b not found in the second structure") + (compare_diff + (struc_of_string "[a,b | P(a) | ]") + (struc_of_string "[a | P(a) | ]")); + assert_equal ~printer:(fun (_,x)->x) + (false, "Relation C not found in the first structure") + (compare_diff + (struc_of_string "[a,b | R(a,b) | ]") + (struc_of_string "[a,b | R(a,b); C(a,b) | ]")); + assert_equal ~printer:(fun (_,x)->x) + (false, "Relation tuple R(a, c) not found in the first structure") + (compare_diff + (struc_of_string "[a,b,c | R(a,b) | ]") + (struc_of_string "[a,b,c | R{(a,b); (a,c)} | ]")); + ); ] Modified: trunk/Toss/caml_extensions/pa_backtrace.ml =================================================================== --- trunk/Toss/caml_extensions/pa_backtrace.ml 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/caml_extensions/pa_backtrace.ml 2011-03-14 11:11:08 UTC (rev 1359) @@ -16,10 +16,10 @@ [ "backtrace"; "("; e = expr ; ")" -> <:expr< (try $e$ with exn -> ( print_endline "Backtracing exception:"; - List.map print_endline + List.iter print_endline (Str.split (Str.regexp_string "\\\\n") (Printexc.to_string exn)); print_endline "Exception backtrace:"; - List.map print_endline + List.iter print_endline (Str.split (Str.regexp_string "\\\\n") (Printexc.get_backtrace ())); raise exn ) ) >> Modified: trunk/Toss/examples/rewriting_example.toss =================================================================== --- trunk/Toss/examples/rewriting_example.toss 2011-03-14 03:24:33 UTC (rev 1358) +++ trunk/Toss/examples/rewriting_example.toss 2011-03-14 11:11:08 UTC (rev 1359) @@ -1,6 +1,6 @@ PLAYERS 1, 2 RULE Rewrite: - [1, 2 | R (1, 2); S:2 {} | + [1, 2 | R (1, 2) | vx {2->0., 1->0.}; vy {2->0., 1->0.}; x {2->12.1, 1->-56.1}; y {2->-16.5, 1->-19.8} ] -> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-14 03:24:42
|
Revision: 1358 http://toss.svn.sourceforge.net/toss/?rev=1358&view=rev Author: lukaszkaiser Date: 2011-03-14 03:24:33 +0000 (Mon, 14 Mar 2011) Log Message: ----------- Translations and many tiny corrections. Modified Paths: -------------- trunk/Toss/Server/Server.ml trunk/Toss/WebClient/Main.js trunk/Toss/WebClient/index.html trunk/Toss/www/.cvsignore trunk/Toss/www/Publications/.cvsignore trunk/Toss/www/Publications/Makefile trunk/Toss/www/contact.xml trunk/Toss/www/create.xml trunk/Toss/www/default.mak trunk/Toss/www/develop.xml trunk/Toss/www/docs.xml trunk/Toss/www/examples.xml trunk/Toss/www/gui_interface.xml trunk/Toss/www/index.xml trunk/Toss/www/navigation.xml trunk/Toss/www/play.xml trunk/Toss/www/styles/screen.css trunk/Toss/www/xsl/books.xsl trunk/Toss/www/xsl/include/common.xsl trunk/Toss/www/xsl/include/layout.xsl trunk/Toss/www/xsl/main.xsl trunk/Toss/www/xsl/publications.xsl Property Changed: ---------------- trunk/Toss/www/ trunk/Toss/www/Publications/ Modified: trunk/Toss/Server/Server.ml =================================================================== --- trunk/Toss/Server/Server.ml 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/Server/Server.ml 2011-03-14 03:24:33 UTC (rev 1358) @@ -30,8 +30,8 @@ let g_heur = ref None let no_gtree = ref false -let exp_p1_timeout = ref 9000 -let exp_p2_timeout = ref 9000 +let exp_p1_timeout = ref 10000 +let exp_p2_timeout = ref 10000 (* -------------------- GENERAL SERVER AND REQUEST HANDLER ------------------ *) Modified: trunk/Toss/WebClient/Main.js =================================================================== --- trunk/Toss/WebClient/Main.js 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/WebClient/Main.js 2011-03-14 03:24:33 UTC (rev 1358) @@ -219,7 +219,7 @@ CUR_PLAY_I = pi; VIEW_MIRROR = (PLAYS[CUR_PLAY_I][0] == UNAME) ? 0 : 1; document.getElementById("cur-player").innerHTML = - disp_name(PLAYS[CUR_PLAY_I][PLAYS[CUR_PLAY_I][3] % 2]); + disp_name(PLAYS[CUR_PLAY_I][PLAYS[CUR_PLAY_I][3]]); toss_open_db (play_py_id(pi)); full_redraw (); } @@ -408,14 +408,14 @@ } function decrease_moving (n) { - document.getElementById("working").innerHTML = "Moving in " + n + " ..."; + document.getElementById("working").innerHTML = "Moving in " + n + "s ..."; if (n > 0) { setTimeout("decrease_moving(" + (n-1) + ")", 1000); } } function suggest_move_async (f) { - document.getElementById("working").innerHTML = "Moving in 5 ..."; + document.getElementById("working").innerHTML = "Moving in 5s ..."; document.getElementById("working").style.display = "block"; setTimeout("decrease_moving(4)", 1000) var fm = function (m) { @@ -426,6 +426,10 @@ async_srv("SUGGEST", 'c, '+ play_py_id (CUR_PLAY_I), fm); } +function suggest_move_click () { + suggest_move_async (function () {}); +} + function suggest_move_better () { document.getElementById("working").innerHTML = "Calculating move..."; document.getElementById("working").style.display = "block"; @@ -436,6 +440,18 @@ return (m); } +function suggest_move_better_click () { + document.getElementById("working").innerHTML = "Moving in 10s ..."; + document.getElementById("working").style.display = "block"; + setTimeout("decrease_moving(9)", 1000) + var fm = function (m) { + document.getElementById("working").style.display = "none"; + document.getElementById("working").innerHTML = "Working..."; + if (m != "") { show_move (m); f() } + }; + async_srv("SUGGESTX", 'c, '+ play_py_id (CUR_PLAY_I), fm); +} + function toggle_suggestions () { var txt = document.getElementById("suggestions-toggle").innerHTML; if (txt.indexOf ("Show") == -1) { Modified: trunk/Toss/WebClient/index.html =================================================================== --- trunk/Toss/WebClient/index.html 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/WebClient/index.html 2011-03-14 03:24:33 UTC (rev 1358) @@ -226,10 +226,10 @@ <p id="player-info-par"> Moving: <span id="cur-player">?</span> - <button id="sugbt" class="bt" onclick="suggest_move()"> + <button id="sugbt" class="bt" onclick="suggest_move_click()"> Suggest (weak, fast) </button> - <button id="sugbts" class="bt" onclick="suggest_move_better()"> + <button id="sugbts" class="bt" onclick="suggest_move_better_click()"> Suggest (stronger, slow) </button> </p> Property changes on: trunk/Toss/www ___________________________________________________________________ Modified: svn:ignore - # We are still using .cvsignore files as we find them easier to manage # than svn properties. Therefore if you change .cvsignore do the following. # svn propset svn:ignore -F .cvsignore . *.html *.html.de *.html.en *.texml *.xml.de *.xml.en reference.xml code_doc *.ps *.dvi *.aux *.out *.log *.bbl *.blg *.idx *.thm *.snm *.nav *.toc *.flc *~ + # We are still using .cvsignore files as we find them easier to manage # than svn properties. Therefore if you change .cvsignore do the following. # svn propset svn:ignore -F .cvsignore . *.html *.html.de *.html.en *.html.pl *.texml *.xml.de *.xml.en *.xml.pl reference.xml code_doc *.ps *.dvi *.aux *.out *.log *.bbl *.blg *.idx *.thm *.snm *.nav *.toc *.flc *~ Modified: trunk/Toss/www/.cvsignore =================================================================== --- trunk/Toss/www/.cvsignore 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/.cvsignore 2011-03-14 03:24:33 UTC (rev 1358) @@ -5,9 +5,11 @@ *.html *.html.de *.html.en +*.html.pl *.texml *.xml.de *.xml.en +*.xml.pl reference.xml code_doc *.ps Property changes on: trunk/Toss/www/Publications ___________________________________________________________________ Modified: svn:ignore - # We are still using .cvsignore files as we find them easier to manage # than svn properties. Therefore if you change .cvsignore do the following. # svn propset svn:ignore -F .cvsignore . *.xml.de *.xml.en *.html *.html.de *.html.en all.texml all.xml *~ + # We are still using .cvsignore files as we find them easier to manage # than svn properties. Therefore if you change .cvsignore do the following. # svn propset svn:ignore -F .cvsignore . *.xml.de *.xml.en *.xml.pl *.html *.html.de *.html.en *.html.pl all.texml all.xml *~ Modified: trunk/Toss/www/Publications/.cvsignore =================================================================== --- trunk/Toss/www/Publications/.cvsignore 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/Publications/.cvsignore 2011-03-14 03:24:33 UTC (rev 1358) @@ -4,9 +4,11 @@ *.xml.de *.xml.en +*.xml.pl *.html *.html.de *.html.en +*.html.pl all.texml all.xml Modified: trunk/Toss/www/Publications/Makefile =================================================================== --- trunk/Toss/www/Publications/Makefile 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/Publications/Makefile 2011-03-14 03:24:33 UTC (rev 1358) @@ -1,6 +1,6 @@ TOPDIR = .. BINDIR = $(TOPDIR)/bin -LANGS = de en +LANGS = de en pl BIB_FILES = $(wildcard ./*.bib) BIBTEXML_TEX_FILES = $(patsubst %.bib,%.texml,$(BIB_FILES)) Modified: trunk/Toss/www/contact.xml =================================================================== --- trunk/Toss/www/contact.xml 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/contact.xml 2011-03-14 03:24:33 UTC (rev 1358) @@ -6,13 +6,14 @@ <personal> <title lang="en">Contact and Links</title> <title lang="de">Kontakt und Links</title> + <title lang="pl">Kontakt i Linki</title> <history> <link id="contact" href="/contact.html">Contact</link> </history> <portrait src="http://sflogo.sourceforge.net/sflogo.php?group_id=115606&type=15"/> - <section title="Email"> + <section title="Email" lang="en"> <par>Toss is an open source project hosted by <a href="http://sourceforge.net">SourceForge</a> and distributed under the BSD licence.<br/></par> @@ -20,8 +21,24 @@ <mailto address="tos...@li..."/> </par> </section> + <section title="Email" lang="de"> + <par>Toss ist ein Open-Source Projekt, wird auf + <a href="http://sourceforge.net">SourceForge</a> + gehosted und eine BSD Licence disribuiert.<br/></par> + <par>Man kann uns unter folgener Addresse erreichen: + <mailto address="tos...@li..."/> + </par> + </section> + <section title="Email" lang="pl"> + <par>Toss jest projektem open source z hostem na + <a href="http://sourceforge.net">SourceForge</a> + i pod licencja BSD.<br/></par> + <par>Najłatwiej się z nami skontaktować pisząc na + <mailto address="tos...@li..."/> + </par> + </section> - <section title="Toss Links"> + <section title="Toss Links" lang="en"> <itemize> <item><a href="http://sourceforge.net/projects/toss/">Toss Project at SourceForge.net</a></item> @@ -29,6 +46,22 @@ Toss Subversion Repository</a></item> </itemize> </section> + <section title="Links von Toss" lang="de"> + <itemize> + <item><a href="http://sourceforge.net/projects/toss/">Toss Project at + SourceForge.net</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/"> + Toss Subversion Repository</a></item> + </itemize> + </section> + <section title="Linki Tossa" lang="pl"> + <itemize> + <item><a href="http://sourceforge.net/projects/toss/">Toss Project at + SourceForge.net</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/"> + Toss Subversion Repository</a></item> + </itemize> + </section> <section title="Game Playing Links"> Modified: trunk/Toss/www/create.xml =================================================================== --- trunk/Toss/www/create.xml 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/create.xml 2011-03-14 03:24:33 UTC (rev 1358) @@ -6,24 +6,55 @@ <personal> <title lang="en">Create New Games</title> <title lang="de">Neue Spiele Erzeugen</title> + <title lang="pl">Stwórz Nową Grę</title> <history> <link id="create" href="/create.html">Create</link> </history> - <section title="Two Ways to Create a New Game"> + + <section title="Two Ways to Create a New Game" lang="en"> <par>When you are done playing the games already defined in Toss, it's time to start the real fun – create your own game! There are two ways to create a game in Toss.</par> <itemize> - <item>You can use the GUI to edit and create games</item> - <item>You can edit the .toss files directly</item> + <item>You can use the GUI to edit and create games.</item> + <item>You can edit the .toss files directly.</item> </itemize> - If you plan to make small changes or an easy experiment, the GUI might - be the better option. For larger or completely new games, it is more - convenient to edit the files in your favorite text editor. + <par>If you plan to make small changes or an easy experiment, the GUI might + be the better option. For larger or completely new games, it is more + convenient to edit the files in your favorite text editor.</par> </section> + + <section title="Zwei Methoden um ein neues Spiel in Toss zu erzeugen" + lang="de"> + <par>Wenn man schon genug online gespielt hat, kann man mit den wirklichen + Spass in Toss anfangen und ein neues Spiel erschaffen. Zwei Wege + kann man dazu nutzen.</par> + <itemize> + <item>Die Toss GUI erlaubt es, Spiele zu erzeugen.</item> + <item>Die .toss Files kann man auch direkt editieren.</item> + </itemize> + <par>Um kleine Änderungen zu machen oder ein einfaches Beispiel zu + definieren kann man wohl die GUI benutzen. Um kompliziertere Spiele zu + erzeugen und ganz neue Ideen zu realisieren ist es bequemer, die .toss + Files direkt in einem Editor zu bearbeiten.</par> + </section> - <section title="Creating Games in Toss GUI"> + <section title="Dwa Sposoby Tworzenia Nowych Gier w Tossie" lang="pl"> + <par>Gdy już znudzi Ci się granie online, czas na prawdziwą zabawę + z Tossem – stwórz swoją własną grę! W Tossie są dwa sposoby + na tworzenie własnych gier.</par> + <itemize> + <item>Można użyć interfejsu graficznego Tossa (GUI).</item> + <item>Możliwa jest też bezpośrednia edycja plików .toss.</item> + </itemize> + <par>Do małych zmian i prostych eksperymentów wystarczy użycie GUI, + natomiast dla nowych i bardziej skomplikowanych gier wygodniej jest + bezpośrednio edytować pliki .toss w edytorze tekstu.</par> + </section> + + + <section title="Creating Games the in the Toss GUI" lang="en"> <par>To start the Toss GUI do the following.</par> <itemize> <item><em>Download</em> Toss from the @@ -36,13 +67,47 @@ <par>When you have the GUI running, we recommend that you watch the <a href="http://vimeo.com/10110495">Toss Tutorial</a> below, which shows all the steps needed to define a simple game in Toss and explains - several other features. Alternatively, you can take a look at our - <a href="gui_interface.html">GUI interface</a> description page - and play with the examples.<br/></par> + several other features.<br/></par> <par><br/><toss-video/></par> </section> - <section title="Creating Games in Text Editor" lang="en"> + <section title="Spiele im Toss GUI Erzeugen" lang="de"> + <par>Um die Toss GUI zu starten, muss man:</par> + <itemize> + <item>Toss <em>runterladen</em> von der + <a href="http://sourceforge.net/project/showfiles.php?group_id=115606"> + SourceForge Seite</a>.</item> + <item><em>Toss ausführen</em>, indem man auf <em>Toss.py</em> clickt. + Man kann am Anfang einer der Files im <em>examples</em> Verzeichniss + öffnen.</item> + </itemize> + <par>Wenn die GUI schon läuft, kann man am besten den + <a href="http://vimeo.com/10110495">Toss Tutorial</a> unten angucken, + wo es gezeigt wird, wie man ein einfaches Spiel in Toss vollständig + definiert und wo auch andere Features erklärt sind.<br/></par> + <par><br/><toss-video/></par> + </section> + + + <section title="Tworzenie Gier w Interfejsie Graficznym Tossa" lang="pl"> + <par>Aby uruchomić interfejs graficzny Tossa:</par> + <itemize> + <item><em>Ściągnij</em> Tossa ze + <a href="http://sourceforge.net/project/showfiles.php?group_id=115606"> + strony SourceForge</a>.</item> + <item><em>Uruchom Tossa</em> klikając na <em>Toss.py</em>. + Na początek najlepiej otworzyć przykład z katalogu <em>examples</em>. + </item> + </itemize> + <par>Gdy GUI Tossa już działa, polecamy obejrzeć i wykonać poniższy + <a href="http://vimeo.com/10110495">Toss Tutorial</a>. + Pokazane tam są wszystkie kroki do zdefiniowania prostej gry w Tossie, + a także wyjaśnione niektóre bardziej zaawansowane możliwości.<br/></par> + <par><br/><toss-video/></par> + </section> + + + <section title="Creating Games in your Text Editor" lang="en"> <par>For larger games, we find it easier to edit them in text form than from the GUI. To understand the meaning of the fields in the text file, you should probably first be acquainted with @@ -58,5 +123,40 @@ </itemize> </section> + <section title="Spiele in Text Form erschaffen" lang="de"> + <par>Wir glauben, dass es für kompliziertere Spiele einfacher ist, + ein Texteditor zu benutzen als die Toss GUI immer zu starten. + Um die verschiedenen Felder im .toss Files zu verstehen ist es aber + nötig, erstmal die Grundlagen von Toss durchzuarbeiten, z.B. indem + man das Tutorial oben durchgeht, und auch das + <a href="reference/reference.pdf">reference.pdf</a> File wenigstens + durchzublättert, und auch die <a href="docs.html">Dokumentation</a>. + Danach kann man einfach die .toss Files im Editor + bearbeiten, Mit einer von den folgenden kann man gut anfangen. + </par> + <itemize> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Breakthrough.toss?revision=1349">Breakthrough</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Chess.toss?revision=1349">Chess</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Tic-Tac-Toe.toss?revision=1349">Tic-Tac-Toe</a></item> + </itemize> + </section> + <section title="Tworzenie Gier w Edytorze Tekstu" lang="pl"> + <par>Gdy gry stają się bardziej skomplikowane, łatwiej bezpośrednio + edytować pliki .toss niż za każdym razem uruchamiać GUI Tossa. + Jednak żeby zrozumieć co znaczą poszczególne pola w pliku .toss trzeba + znać już podstawy Tossa – np. obejrzeć tutorial powyżej, oraz + przynajmniej przekartkować plik + <a href="reference/reference.pdf">reference.pdf</a> i zerknąć na + <a href="docs.html">dokumentację</a>. Potem można po prostu + edytować pliki .toss, być może zaczynając od jednego z tych. + </par> + <itemize> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Breakthrough.toss?revision=1349">Breakthrough</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Chess.toss?revision=1349">Chess</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Tic-Tac-Toe.toss?revision=1349">Tic-Tac-Toe</a></item> + </itemize> + </section> + + </personal> Modified: trunk/Toss/www/default.mak =================================================================== --- trunk/Toss/www/default.mak 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/default.mak 2011-03-14 03:24:33 UTC (rev 1358) @@ -1,5 +1,5 @@ BINDIR = $(TOPDIR)/bin -LANGS = de en +LANGS = de en pl BIB_FILES = $(wildcard ./*.bib) BIBTEXML_TEX_FILES = $(patsubst %.bib,%.texml,$(BIB_FILES)) @@ -75,6 +75,14 @@ chmod 664 $@ ;\ fi +%.html.pl : LANG=pl +%.html.pl : %.xml.pl $(AUXILIARY_FILES) $(XSL_FILES) $(BIBTEXML_FILES) + lang=$(LANG) ; if [ -n "$$lang" ] ; then \ + xsltproc $(XSLTPROC_PARAM) --stringparam "lang" "$(LANG)" --stringparam "uri" "$<" $< \ + | $(BINDIR)/hrefprocess "$(TOPDIR)" "$(LANG)" > $@ ;\ + chmod 664 $@ ;\ + fi + %.html : %.html.en @echo Modified: trunk/Toss/www/develop.xml =================================================================== --- trunk/Toss/www/develop.xml 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/develop.xml 2011-03-14 03:24:33 UTC (rev 1358) @@ -6,11 +6,12 @@ <personal> <title lang="en">Develop Toss</title> <title lang="de">Toss Ausbauen</title> + <title lang="pl">Programuj Tossa</title> <history> <link id="develop" href="/develop.html">Develop Toss</link> </history> - <section title="Preparation"> + <section title="Preparation" lang="en"> <itemize> <item>Except for the interfaces, most of Toss is programmed in <a href="http://caml.inria.fr/">Objective Caml</a>. You will need @@ -36,7 +37,60 @@ it succeeds.</item> </itemize> </section> - + <section title="Vorbereitung" lang="de"> + <itemize> + <item>Except for the interfaces, most of Toss is programmed in + <a href="http://caml.inria.fr/">Objective Caml</a>. You will need + a good understanding of OCaml and a full OCaml installation + to work on the Toss Engine. + </item> + <item>Toss <em>build system</em> is based on <em>ocamlbuild</em> + and uses <em>Makefiles</em> for compilation of the C parts. + You will need a system which supports these to build Toss. + </item> + <item>If you want to develop Toss on Ubuntu, here is a command with + a list of packages to install.<br/> + sudo apt-get install g++ python-qt4 python-dev pyqt4-dev-tools + ocaml-findlib menhir libounit-ocaml-dev libapache2-mod-python + sqlite3 python-pysqlite2 + </item> + <item>This command will checkout the + <a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/">Toss + SVN Repository</a> to the <em>Toss</em> directory.<br/> + svn co https://toss.svn.sourceforge.net/svnroot/toss/trunk/Toss Toss + </item> + <item>In the Toss directory run <em>make</em> and check that + it succeeds.</item> + </itemize> + </section> + <section title="Przygotowanie" lang="pl"> + <itemize> + <item>Except for the interfaces, most of Toss is programmed in + <a href="http://caml.inria.fr/">Objective Caml</a>. You will need + a good understanding of OCaml and a full OCaml installation + to work on the Toss Engine. + </item> + <item>Toss <em>build system</em> is based on <em>ocamlbuild</em> + and uses <em>Makefiles</em> for compilation of the C parts. + You will need a system which supports these to build Toss. + </item> + <item>If you want to develop Toss on Ubuntu, here is a command with + a list of packages to install.<br/> + sudo apt-get install g++ python-qt4 python-dev pyqt4-dev-tools + ocaml-findlib menhir libounit-ocaml-dev libapache2-mod-python + sqlite3 python-pysqlite2 + </item> + <item>This command will checkout the + <a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/">Toss + SVN Repository</a> to the <em>Toss</em> directory.<br/> + svn co https://toss.svn.sourceforge.net/svnroot/toss/trunk/Toss Toss + </item> + <item>In the Toss directory run <em>make</em> and check that + it succeeds.</item> + </itemize> + </section> + + <section title="Understanding Toss"> <itemize> <item><a href="create.html">Create</a> at least one simple game Modified: trunk/Toss/www/docs.xml =================================================================== --- trunk/Toss/www/docs.xml 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/docs.xml 2011-03-14 03:24:33 UTC (rev 1358) @@ -6,18 +6,34 @@ <personal> <title lang="en">Documentation</title> <title lang="de">Dokumentation</title> + <title lang="pl">Dokumentacja</title> <history> <link id="docs" href="/docs.html">Documentation</link> </history> - <section title="Using Toss"> + <section title="Using Toss" lang="en"> <par>If you want to learn how to use Toss to create games, go to the <a href="create.html">Create Games</a> page or just watch the video tutorial below to get started.<br/></par> <par><br/><toss-video/></par> </section> - <section title="Reference"> + <section title="Toss Benutzen" lang="de"> + <par>Um zu lehrnen wie man Toss benutzt um neue Spiele zu erschaffen, + besuche die <a href="create.html">Neue Spiele Erzeugen</a> Seite oder + fange schnell an mit dem Video Tutorial unten.<br/></par> + <par><br/><toss-video/></par> + </section> + + <section title="Używanie Tossa" lang="pl"> + <par>Żeby nauczyć się tworzyć gry w Tossie najlepiej odwiedzić stronę + o <a href="create.html">Tworzeniu Nowych Gier</a> albo szybko obejrzeć + poniższy tutorial.<br/></par> + <par><br/><toss-video/></par> + </section> + + + <section title="Reference" lang="en"> <par>The Toss Design and Specification reference is an evolving document in which we try to describe the high-level mathematical model of Toss and the main ideas used in the implementation. The document is best @@ -25,37 +41,127 @@ a <a href="reference/">html version</a> is available as well for fast fact-checking.</par> </section> + <section title="Referenz" lang="de"> + <par>"Toss Design and Specification" ist ein oft erneuerter Dokument + in dem wir versuchen, ein Übersicht über die mathematische Grundlagen + von Toss und die Hauptideen der Algorithmen die wir implementiert haben + zu geben. Es ist am besten als + <a href="reference/reference.pdf">reference.pdf</a> zu lesen, aber + eine <a href="reference/">html Version</a> mit niedriegerer Qualität + steht auch zur Verfügung falls man etwas ganz schnell finden muss.</par> + </section> + <section title="Opis" lang="pl"> + <par>"Toss Design and Specification" to ciągle zmieniający się dokument, + w którym próbujemy opisać matematyczny model Tossa i najważniejsze + idee i algorytmy użyte w implementacji. Najlepiej oglądać ten opis + jako <a href="reference/reference.pdf">reference.pdf</a>, ale wersja + <a href="reference/">html</a> w niższej jakości też jest dostępna gdy + trzeba coś szybko sprawdzić.</par> + </section> - <section title="Code Documentation"> + + <section title="Code Documentation" lang="en"> We generate <a href="code_doc/">documentation from code comments</a> using <a href="http://caml.inria.fr/pub/docs/manual-ocaml/manual029.html"> ocamldoc</a>. It gives the most up-to date information on our code, modules and their interfaces. </section> + <section title="Quellcode Dokumentation" lang="de"> + Wir erzeugen <a href="code_doc/">Quellcode Dokumentation</a> von + Kommentaren mit Hilfe von + <a href="http://caml.inria.fr/pub/docs/manual-ocaml/manual029.html"> + ocamldoc</a>. Es ist die aktuellste Information über Toss Quellcode, + die Modulen und deren Zussamenhänge.</section> + <section title="Dokumentacja Kodu" lang="pl"> + <a href="code_doc/">Dokumentację z komentarzy w kodzie</a> generujemy + przy pomocy + <a href="http://caml.inria.fr/pub/docs/manual-ocaml/manual029.html"> + ocamldoca</a>. To najbardziej aktualna informacja o kodzie Tossa, + naszych modułach i ich interfejsach. + </section> - <section title="Scientific Background"> + + <section title="Scientific Background of Toss" lang="en"> <par>To learn more about the mathematical background and - the design of Toss, go to the <a href="Publications/">Papers - and Talks</a> page or use the following links.</par> + the design of Toss, use the following links.</par> <itemize> - <item><em>Compact description</em> of the mathematical model behind - Toss and our game playing algorithm can be found in the paper + <item><em>Compact description</em> of the mathematical model behind Toss + and our UCT game playing algorithm can be found in the paper <a href="pub/playing_structure_rewriting_games.pdf">Playing Structure Rewriting Games</a>. </item> - <item> <em>Complexity</em> of a syntactic fragment of Toss was - analyzed in the paper <a href="pub/graph_games_short.pdf"> - Synthesis for Structure Rewriting Systems</a>. + + <item> <em>Complexity</em> of a syntactic fragment of Toss was analyzed in + the paper <a href="pub/graph_games_short.pdf">Synthesis + for Structure Rewriting Systems</a>. </item> + <item><em>Presentation</em> on the mathematics behind Toss was given at <em>IIT Kanpur</em> and can be <a href="http://www2.cse.iitk.ac.in/~fsttcs/2009/videos/star/LukaszKaiser.avi"> watched</a> online. </item> + <item><em>Shorter presentation</em> focusing on the AI side was given at <em>AGI 2010</em> and can also be - <a href="http://www.vimeo.com/15326245">watched</a> online.</item> + <a href="http://www.vimeo.com/15326245">watched</a> online. + </item> </itemize> </section> + + <section title="Mathematische Grundlagen von Toss" lang="de"> + <par>Um mehr über Toss zu erfahren, folge diese Links.</par> + <itemize> + <item><em>Eine kompakte Darstellung</em> der mathematischen Modell hinter + Toss findet man in <a href="pub/playing_structure_rewriting_games.pdf"> + Playing Structure Rewriting Games</a>. + </item> + + <item><em>Komplexität</em> einer syntaktischen Fragment of Toss wurde + in dem Paper <a href="pub/graph_games_short.pdf"> + Synthesis for Structure Rewriting Systems</a> analysiert. + </item> + + <item><em>Eine Presentation</em> über die Mathematik von Toss wurde bei + <em>IIT Kanpur</em> gegeben und man kann sie + <a href="http://www2.cse.iitk.ac.in/~fsttcs/2009/videos/star/LukaszKaiser.avi"> + online sehen</a>. + </item> + + <item><em>Eine kürzere Presentation</em> über Toss als AI Programm wurde + bei <em>AGI 2010</em> gegeben und man kann die auch + <a href="http://www.vimeo.com/15326245">online sehen</a>. + </item> + </itemize> + </section> + + <section title="Matematyczne Podstawy Tossa" lang="pl"> + <par>Matematyczne podstawy Tossa są bardzo bogate. Poniższe linki + pozwalają zapoznać się z częścią z nich.</par> + <itemize> + <item><em>Zwięzły opis</em> matematycznego modelu używanego w Tossie + i algorytmu UCT znajduje się w pracy + <a href="pub/playing_structure_rewriting_games.pdf">Playing + Structure Rewriting Games</a>. + </item> + + <item><em>Złożoność</em> pewnego składniowego fragmentu Tossa została + opisana w pracy <a href="pub/graph_games_short.pdf">Synthesis + for Structure Rewriting Systems</a>. + </item> + + <item><em>Prezentacja</em> matematycznego modelu Tossa udzielona w + <em>IIT Kanpur</em> w Indiach w 2010 jest + <a href="http://www2.cse.iitk.ac.in/~fsttcs/2009/videos/star/LukaszKaiser.avi"> + dostępna online</a>. + </item> + + <item><em>Krótsza prezentacje</em> Tossa skupiająca się na sztucznej + inteligencji była częścią <em>AGI 2010</em> i też jest + <a href="http://www.vimeo.com/15326245">dostępna online</a>. + </item> + </itemize> + </section> + </personal> Modified: trunk/Toss/www/examples.xml =================================================================== --- trunk/Toss/www/examples.xml 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/examples.xml 2011-03-14 03:24:33 UTC (rev 1358) @@ -6,51 +6,127 @@ <personal> <title lang="en">Examples</title> <title lang="de">Beispiele</title> + <title lang="pl">Przykłady</title> <history> <link id="create" href="/create.html">Create New Games</link> <link id="examples" href="/examples.html">Examples</link> </history> - <section title="Simple Games"> - <par>We use tic-tac-toe as the simplest example of a game. + <section title="Tic-Tac-Toe" lang="en"> + <par>We use Tic-Tac-Toe as the simplest example of a game. The players play by assigning P and Q to blank positions and the winning condition is given as a formula. You can click - <i>Hint</i> to get a move suggestion from Toss.</par> + <i>Hint</i> to get a move suggestion from Toss. + </par> + <itemize> + <item><em>(1) Tic-Tac-Toe.</em> + A simple Tic-Tac-Toe game modelled using a structure.</item> + </itemize> + <a href="tic_tac_toe_screen.png"> + <image src="tic_tac_toe_screen_small.png" /> + </a> + </section> + <section title="Drei Gewinnt (Tic-Tac-Toe)" lang="de"> + <par>Tic-Tac-Toe ist das einfachste Spiel in Toss. + Die Spieler müssen nur die P und Q Prädikate an leere Positionen + plazieren und die Gewinnbedingug ist durch eine einfache Formel gegeben. + Man kann in Toss auch auf <i>Hint</i> klicken um ein Hinweis zu + bekommen.</par> <itemize> - <item><em>(1) Tic Tac Toe</em> - A simple tic-tac-toe game modelled using a structure.</item> + <item><em>(1) Tic Tac Toe.</em> + Ein einfaches Tic-Tac-Toe Spiel in Toss.</item> </itemize> <a href="tic_tac_toe_screen.png"> <image src="tic_tac_toe_screen_small.png" /> </a> </section> - <section title="Basic Board Games"> + <section title="Kółko i Krzyżyk (Tic-Tac-Toe)" lang="pl"> + <par>Kółko i Krzyżyk to jedna z najprostszych gier w Tossie. + Gracze muszą tylko używac predykatów P i Q i wstawiać je na + odpowiednie elementy w strukturze. Wypłaty są też zadane bardzo + prostymi formułami. Można kliknąć na <i>Hint</i> w Tossie aby + dostać wskazówkę ruchu.</par> + <itemize> + <item><em>(1) Kółko i Krzyżyk.</em> + Bardzo prosta gra w Kółko i Krzyżyk w Tossie.</item> + </itemize> + <a href="tic_tac_toe_screen.png"> + <image src="tic_tac_toe_screen_small.png" /> + </a> + </section> + + + <section title="Basic Board Games" lang="en"> <par>Here are more examples of board games which you can construct - with Toss.</par> - + with the Toss GUI easily.</par> <itemize> - <item><em>(2) Gomoku</em> + <item><em>(2) Gomoku.</em> This is the Gomoku (Connect-5) game played on an 8x8 board.</item> - <item><em>(3) Breakthrough</em> - Standard breakthrough game.</item> + <item><em>(3) Breakthrough.</em> + Standard Breakthrough game.</item> </itemize> + <a href="imgs/gomoku_screen.png"> + <image src="gomoku_screen_small.png" /></a> + <a href="imgs/breakthrough_screen.png"> + <image src="breakthrough_screen_small.png" /></a> + </section> + <section title="Einfache Brettspiele" lang="de"> + <par>Hier geben wir einige andere Beispiele von Brettspiele, + die man leicht in Toss GUI erschaffen kann.</par> + <itemize> + <item><em>(2) Gomoku.</em> + Das ist Gomoku (Fünf in eine Reihe) auf einem 8x8 Brett.</item> + <item><em>(3) Breakthrough.</em> + Das Spiel Durchbruch (Breakthrough).</item> + </itemize> <a href="imgs/gomoku_screen.png"> <image src="gomoku_screen_small.png" /></a> + <a href="imgs/breakthrough_screen.png"> + <image src="breakthrough_screen_small.png" /></a> + </section> + <section title="Proste Gry Planszowe" lang="pl"> + <par>Kilka dalszych przykładów gier planszowych które łatwo + stworzyć w GUI Tossa.</par> + <itemize> + <item><em>(2) Gomoku.</em> + Gomoku (5 punktów), japońska gra na planszy 8x8.</item> + <item><em>(3) Breakthrough.</em> + Zwyczajna plansza Breakthrough.</item> + </itemize> + <a href="imgs/gomoku_screen.png"> + <image src="gomoku_screen_small.png" /></a> <a href="imgs/breakthrough_screen.png"> <image src="breakthrough_screen_small.png" /></a> </section> - <section title="More Complex Games"> + + <section title="More Complex Games" lang="en"> <par>To create more complex games, like Chess, it may be more convenient to edit directly the textual game definition files, rather than using only the GUI. Here are a few standard games defined in Toss. You can them use as a starting point for your own definitions.</par> + </section> + <section title="Kompliziertere Spiele" lang="de"> + <par>Um kompliziertere Spiele, wie Schach, zu definieren, kann es + bequemer sein, direkt die text Files (.toss) zu bearbeiten. + Unten geben wir die .toss Files für einige der Standardspiele an. + Man kann diese Files auch als Anfangspunkt für eigene Spiele nutzen.</par> + </section> + + <section title="Bardziej Złożone Gry" lang="pl"> + <par>Gdy definiuje się w Tossie bardziej złożone gry, takie jak szachy, + wygodniej edytować bezpośrednio pliki .toss niż używać tylko GUI. + Poniżej podajemy pliki .toss dla kilku znanych gier, możesz ich + też użyć jako podstawy do stworzenia własnej gry.</par> + </section> + + <section> <itemize> <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Breakthrough.toss?revision=1349">Breakthrough</a></item> <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Checkers.toss?revision=1349">Checkers</a></item> Modified: trunk/Toss/www/gui_interface.xml =================================================================== --- trunk/Toss/www/gui_interface.xml 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/gui_interface.xml 2011-03-14 03:24:33 UTC (rev 1358) @@ -6,6 +6,7 @@ <personal> <title lang="en">GUI Interface Guide</title> <title lang="de">GUI Interface Guide</title> + <title lang="pl">GUI Interface Guide</title> <history> <link id="create" href="/create.html">Create New Games</link> <link id="examples" href="/examples.html">Examples</link> Modified: trunk/Toss/www/index.xml =================================================================== --- trunk/Toss/www/index.xml 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/index.xml 2011-03-14 03:24:33 UTC (rev 1358) @@ -21,12 +21,24 @@ </section> <section title="Über Toss" lang="de"> - <par><em>Toss</em> erlaubt es Spiele zu erzeugen, zu analysieren - und zu spielen. Experimentiere mit deine Spielideen und trete + <par><em>Toss</em> erlaubt es, Spiele zu erzeugen, zu analysieren + und zu spielen. Dank einem allgeminen Algorithmus ist es möglich, + ein Spiel zu Bauen und direkt gegen dem Computer zu spielen. + Hast du schon mal gewundert, wie man Schach spielt wenn die Brettmitte + fehlt? Experimentiere mit deine Spielideen und trete gegen deine Freunde online an! </par> </section> + <section title="O Tossie" lang="pl"> + <par><em>Toss</em> jest programem do tworzenia, analizowania + i grania w gry. Dzięki ogólnemu algorytmowi możesz stworzyc grę + i od razu zagrać w nią z komputerem. Na przykład, jak grałoby + się w szachy bez środka planszy? Z Tossem łatwo to sprawdzić! + </par> + </section> + + <games-section> <game-div> <game-link game="Breakthrough"/> @@ -40,62 +52,138 @@ </game-div> </games-section> + <section title="Create New Games" lang="en"> <par>The <a href="http://vimeo.com/10110495">Toss Tutorial</a> below shows all the steps needed to define a simple game in Toss and explains - several other features. Alternatively, you can just take a look at our - <a href="interface.php">Interface</a> page and play with the examples. + several other features. With Toss, you can make your game ideas come + true! Go to the <a href="create.html">Create Games</a> page to learn + how to build new games with Toss. <br/></par> <par><br/><toss-video/></par> </section> <section title="Neue Spiele Erzeugen" lang="de"> - <par>The <a href="http://vimeo.com/10110495">Toss Tutorial</a> below - shows all the steps needed to define a simple game in Toss and explains - several other features. Alternatively, you can just take a look at our - <a href="interface.php">Interface</a> page and play with the examples. + <par>Das <a href="http://vimeo.com/10110495">Toss Tutorial</a> unten + zeigt, wie man in Toss ein einfaches Spiel definieren kann, und es + erklärt auch einige andere Features von Toss. Mit Toss ist es möglich, + deine Spielideen zu realisieren! Lehrne wie man mit Toss neue + <a href="create.html">Spiele erzeugt.</a> + <br/></par> + <par><br/><toss-video/></par> + </section> + + <section title="Stwórz Nową Grę" lang="pl"> + <par><a href="http://vimeo.com/10110495">Tutorial Tossa</a> poniżej + pokazuje, jak zdefiniować prostą grę w Kółko i Krzyżyk w Tossie, + wyjaśnia też inne możliwości Tossa. Dzięki Tossowi możesz zrealizować + swój pomysł na nową grę! Zobacz poniższą stronę i dowiedz się jak + <a href="create.html">stworzyć nową grę</a>. <br/></par> <par><br/><toss-video/></par> </section> - <section title="Features"> + + <section title="Toss Features" lang="en"> <par>Games in Toss are defined as mathematical structures and moves by structure rewriting rules. Payoffs are given by formulas of monadic second-order logic with real values.</par> <itemize> -<item><em>Structures</em> can have an arbitrary number of relations of any arity - and additional real-valued functions.</item> -<item><em>Rules</em> work by matching arbitrary left-hand side structures - and replacing them with a right-hand side structure.</item> -<item><em>Continuous dynamics</em> can be specified using ODEs. - This allows for example to simulate movements and collisions.</item> -<item><em>Constraints</em> can be put on the rule, including preconditions, - invariants and postconditions.</item> -<item><em>Logic</em> is used for constraints and payoffs. We support full monadic - second-order logic with additional real arithmetic.</item> -<item><em>Solver</em> in Toss is optimized: it does quantifier elimination and - formula decomposition (with <a href="http://minisat.se/">MiniSat</a>).</item> -<item><em>Move hints</em> are given in all games using our general - game playing algorithm based on UCT or Maximax.</item> + <item><em>Structures</em> can have an arbitrary number of relations of + any arity and additional real-valued functions.</item> + <item><em>Rules</em> work by matching arbitrary left-hand side structures + and replacing them with the right-hand side structure.</item> + <item><em>Continuous dynamics</em> can be specified using ODEs. + This allows for example to simulate movements and collisions.</item> + <item><em>Constraints</em> can be put on the rule, including + preconditions, invariants and postconditions.</item> + <item><em>Logic</em> is used for constraints and payoffs. We support + full monadic second-order logic with additional real arithmetic.</item> + <item><em>Solver</em> in Toss is optimized: it does quantifier + elimination and formula decomposition + (with <a href="http://minisat.se/">MiniSat</a>).</item> + <item><em>Move hints</em> are given in all games using our general + game playing algorithm based on UCT or Maximax.</item> </itemize> </section> - <section title="Background"> + + <section title="Eigenschaften von Toss" lang="de"> + <par>Die Spiele in Toss sind durch relationale Strukturen definiert, + und die Züge durch Graphersetzungregeln. Das Ergebniss eines Spiels + wird durch Formeln der monadischer Logik zweiter Stufe definiert, die + in Toss mit Zählquantoren erweitert ist, um reele Werte zu liefern.</par> + <itemize> + <item><em>Strukturen</em> in Toss können beliebiege Relationen beinhalten + und dazu noch zusätzliche Funktionen mir reelen Werte.</item> + <item><em>Ersetzungsregeln</em> werden ausgeführt indem die Struktur + auf der linken Seite mit der Hauptstruktur gematcht wird und danach + mit der auf der rechten Seite ersetzt wird.</item> + <item><em>Kontinuerliche dynamik</em> kann durch ein ODE System + eingegeben werden. Das erlaubt die Simulation von Bewegung und + andere physykalischen Eigenschaften der Objekte.</item> + <item><em>Zusätzliche Bedingungen</em> können die Ersetzungsregeln + beschränken. Dazu gehören Prekonditionen, Invarianten, und + Postkonditionen.</item> + <item><em>Logik</em> wird benutzt, um die Bedingungen und die Ergebnisse + zu definieren. In Toss ist die vollständige monadische Logik zweiter + Stufe implementiert, mit zusätzlichen Zählquantoren.</item> + <item><em>Der Solver</em> in Toss ist stark optimiert. Es eliminiert + die Quantoren wenn möglich und dekomponiert die Formel + (mit Hilfe von <a href="http://minisat.se/">MiniSat</a>).</item> + <item><em>Hinweise</em> können dadurch allgemein in allen Spielen + gegeben werden, der Zugauswahl passiert durch UCT oder Maximax.</item> + </itemize> + </section> + + <section title="Funkcje Tossa" lang="pl"> + <par>Gry w Tossie są zdefiniowane jako matematyczne struktury, + a ruchy zadane przez reguły przepisywania struktur. Wypłaty na + końcu gry definiujemy formułami monadycznej logiki drugiego rzędu, + rozszerzonej o termy z wartościami rzeczywistymi, np. zliczaniem.</par> + <itemize> + <item><em>Struktury</em> mogą zawierać dowolne relacje i dodatkowo + funkcje w wartościami rzeczywistymi.</item> + <item><em>Reguły przepisywania</em> dopasowują dowolną strukturę z + lewej strony reguły do głównej struktury i zastępują ją strukturą + z prawej strony reguły.</item> + <item><em>Dynamika</em> (ciągła) układu może być zadana systemem + zwyczajnych równań różniczkowych (ODE), co pozwala symulować ruch + i inne własności fizyczne układu.</item> + <item><em>Więzy</em> dla reguł mogą być zadane jako dowolne formuły. + Dopuszczalne są zarówno pre-kondycje, niezmienniki, jak i post-kondycje. + </item> + <item><em>Logika</em> służy do definiowania więzów jak i wyników gier + i reguł. W Tossie dopuszczmy pełną monadyczną logikę drugiego rzędu z + dodatkowymi kwantyfikatorami o wartościach rzeczywistch, + jak np. zliczanie.</item> + <item><em>Solver</em> w Tossie jest zoptymalizowany dla naszych formuł. + Wykonuje eliminację kwantyfikatorów gdzie to możliwe i rozkład formuł + (przy pomocy <a href="http://minisat.se/">MiniSata</a>).</item> + <item>Dzięki temu <em>Podpowiedzi Ruchu</em> są automatycznie generowane + dla każdej gry w Tossie. Ruch jest wybierany na bazie + UCT lub Maximaxa.</item> + </itemize> + </section> + + + <section title="Scientific Background of Toss" lang="en"> <par>To learn more about the mathematical background and the design of Toss, use the following links.</par> <itemize> <item><em>Compact description</em> of the mathematical model behind Toss - and our game playing algorithm can be found in the paper - <a href="http://logic.rwth-aachen.de/~kaiser/playing_structure_rewriting_games.pdf">Playing Structure Rewriting Games</a>. + and our UCT game playing algorithm can be found in the paper + <a href="pub/playing_structure_rewriting_games.pdf">Playing + Structure Rewriting Games</a>. </item> - + <item><em>Design and specification</em> of Toss are described in - the <a href="reference.pdf">reference.pdf</a> document. + the <a href="reference/reference.pdf">reference.pdf</a> document. </item> <item> <em>Complexity</em> of a syntactic fragment of Toss was analyzed in - the paper <a href="http://logic.rwth-aachen.de/~kaiser/graph_games_short.pdf"> - Synthesis for Structure Rewriting Systems</a>. + the paper <a href="pub/graph_games_short.pdf">Synthesis + for Structure Rewriting Systems</a>. </item> <item><em>Presentation</em> on the mathematics behind Toss was given at @@ -111,4 +199,66 @@ </itemize> </section> + <section title="Mathematische Grundlagen von Toss" lang="de"> + <par>Um mehr über Toss zu erfahren, folge diese Links.</par> + <itemize> + <item><em>Eine kompakte Darstellung</em> der mathematischen Modell hinter + Toss findet man in <a href="pub/playing_structure_rewriting_games.pdf"> + Playing Structure Rewriting Games</a>. + </item> + + <item><em>Design und Specifikation</em> von Toss sind im + <a href="reference/reference.pdf">reference.pdf</a> beschrieben. + </item> + + <item><em>Komplexität</em> einer syntaktischen Fragment of Toss wurde + in dem Paper <a href="pub/graph_games_short.pdf"> + Synthesis for Structure Rewriting Systems</a> analysiert. + </item> + + <item><em>Eine Presentation</em> über die Mathematik von Toss wurde bei + <em>IIT Kanpur</em> gegeben und man kann sie + <a href="http://www2.cse.iitk.ac.in/~fsttcs/2009/videos/star/LukaszKaiser.avi"> + online sehen</a>. + </item> + + <item><em>Eine kürzere Presentation</em> über Toss als AI Programm wurde + bei <em>AGI 2010</em> gegeben und man kann die auch + <a href="http://www.vimeo.com/15326245">online sehen</a>. + </item> + </itemize> + </section> + + <section title="Matematyczne Podstawy Tossa" lang="pl"> + <par>Matematyczne podstawy Tossa są bardzo bogate. Poniższe linki + pozwalają zapoznać się z częścią z nich.</par> + <itemize> + <item><em>Zwięzły opis</em> matematycznego modelu używanego w Tossie + i algorytmu UCT znajduje się w pracy + <a href="pub/playing_structure_rewriting_games.pdf">Playing + Structure Rewriting Games</a>. + </item> + + <item><em>Design i specyfikacja</em> Tossa są opisane w + <a href="reference/reference.pdf">reference.pdf</a>. + </item> + + <item><em>Złożoność</em> pewnego składniowego fragmentu Tossa została + opisana w pracy <a href="pub/graph_games_short.pdf">Synthesis + for Structure Rewriting Systems</a>. + </item> + + <item><em>Prezentacja</em> matematycznego modelu Tossa udzielona w + <em>IIT Kanpur</em> w Indiach w 2010 jest + <a href="http://www2.cse.iitk.ac.in/~fsttcs/2009/videos/star/LukaszKaiser.avi"> + dostępna online</a>. + </item> + + <item><em>Krótsza prezentacje</em> Tossa skupiająca się na sztucznej + inteligencji była częścią <em>AGI 2010</em> i też jest + <a href="http://www.vimeo.com/15326245">dostępna online</a>. + </item> + </itemize> + </section> + </personal> Modified: trunk/Toss/www/navigation.xml =================================================================== --- trunk/Toss/www/navigation.xml 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/navigation.xml 2011-03-14 03:24:33 UTC (rev 1358) @@ -10,7 +10,7 @@ >Download Toss</item> <menu title="Create Games" href="/create.html" id="create"> <item href="http://vimeo.com/10110495" id="tut">Video Tutorial</item> - <item href="/examples.html" id="examples">Basic Examples</item> + <item href="/examples.html" id="examples">Examples</item> <item href="/gui_interface.html" id="gui_interface">GUI Interface Guide</item> </menu> <item href="/play.html" id="play">Watch Toss Play</item> @@ -36,13 +36,38 @@ <item href="/examples.html" id="examples">Beispiele</item> <item href="/gui_interface.html" id="gui_interface">GUI Interface Guide</item> </menu> - <item href="/play.html" id="play">Toss Spielt</item> + <item href="/play.html" id="play">Wie Toss Spielt</item> <menu title="Dokumentation" href="/docs.html" id="docs"> - <item href="/background.html" id="background">Hintergrund</item> + <item href="/reference/reference.pdf" id="refpdf">Referenz (pdf)</item> + <item href="/reference/" id="refhtml">Referenz (html)</item> + <item href="/code_doc/" id="code">Quellcode Dokumentation</item> </menu> <item href="/Publications/" id="Publications">Papers und Talks</item> <item href="/develop.html" id="develop">Toss Ausbauen</item> <item href="/contact.html" id="contact">Kontakt und Links</item> </menu> + +<menu lang="pl"> + <item href="/" id="Home">Strona Domowa</item> + <item href="/ideas.html" id="ideas">Pomysły na GSoC</item> + <item href="http://tplay.org">Graj Online</item> + <item href="http://sourceforge.net/project/showfiles.php?group_id=115606" + >Ściągnij Tossa</item> + <menu title="Twórz Nowe Gry" href="/create.html" id="create"> + <item href="http://vimeo.com/10110495" id="tut">Tutorial Video</item> + <item href="/examples.html" id="examples">Przykłady</item> + <item href="/gui_interface.html" id="gui_interface">Interfejs GUI</item> + </menu> + <item href="/play.html" id="play">Jak Toss Gra</item> + <menu title="Dokumentacja" href="/docs.html" id="docs"> + <item href="/reference/reference.pdf" id="refpdf">Opis (pdf)</item> + <item href="/reference/" id="refhtml">Opis (html)</item> + <item href="/code_doc/" id="code">Dokumentacja Kodu</item> + </menu> + <item href="/Publications/" id="Publications">Prace i Referaty</item> + <item href="/develop.html" id="develop">Programuj Tossa</item> + <item href="/contact.html" id="contact">Kontakt i Linki</item> +</menu> + </navigation> Modified: trunk/Toss/www/play.xml =================================================================== --- trunk/Toss/www/play.xml 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/play.xml 2011-03-14 03:24:33 UTC (rev 1358) @@ -5,12 +5,13 @@ <personal> <title lang="en">Watch Toss Play</title> - <title lang="de">Toss Spielt</title> + <title lang="de">Wie Toss Spielt</title> + <title lang="pl">Jak Toss Gra</title> <history> <link id="play" href="/play.html">Toss Play</link> </history> - <section title="General Game Playing"> + <section title="General Game Playing" lang="en"> <a href="http://en.wikipedia.org/wiki/General_Game_Playing">General Game Playing</a>, GGP in short, is a name for the task of playing a previously unknown game. GGP is currently a popular field of AI, @@ -19,6 +20,7 @@ doing great work. Players which accept games in the GDL format can play on the <a href="http://euklid.inf.tu-dresden.de:8180/ggpserver/"> Dresden GGP Server</a> and Toss recently started competing there as well. + <br/> Games in GDL format are not directly suited for online presentation, but the <a href="http://code.google.com/p/ggp-galaxy/">GGP Galaxy Project</a> has recently started to work on bringing them online – something @@ -26,8 +28,44 @@ the games played by Toss against Fluxplayer on the Dresden Server. </section> + <section title="Allgemeines Spielen (General Game Playing)" lang="de"> + <a href="http://en.wikipedia.org/wiki/General_Game_Playing">General + Game Playing</a>, kurz GGP, fördert von einem Computer dass er + ein vorher unbekanntes Spiel spielt. Es ist ein stark wachsendes KI Feld + mit Wissenschaftler bei <a href="http://games.stanford.edu/">Stanford</a> + und in <a href="http://www.general-game-playing.de/">Deutschland</a>. + Programme, die Spiele in GDL-Format spielen können kann man auf dem + <a href="http://euklid.inf.tu-dresden.de:8180/ggpserver/"> + Dresden GGP Server</a> gegeneinander spielen lassen, und Toss hat + da letztens auch einiger Erfolgreiche Partien gespielt. + <br/> + Spiele im GDL-Format lassen sich nicht direkt Online darstellen, aber + das <a href="http://code.google.com/p/ggp-galaxy/">GGP Galaxy Project</a> + hat letztens angefangen zu versuchen, dieses Problem zu beseitigen. + Die Spiele im Toss-Format kann man dagegen direkt Online ansehen und + spielen. Darunter zeigen wir einige Spiele von Toss gegen Fluxplayer. + </section> - <section title="Breakthrough Games"> + <section title="Ogólne Programy do Gier (General Game Playing)" lang="pl"> + <a href="http://en.wikipedia.org/wiki/General_Game_Playing">General + Game Playing</a> (GGP) to nazwa problemu w którym program komputerowy + musi grać w nieznaną mu wcześniej grę. GGP to obecnie popularny kierunek + AI nad którym pracują w <a href="http://games.stanford.edu/">Stanfordzie</a> + oraz w <a href="http://www.general-game-playing.de/">Niemczech</a>. + Programy grające w gry w formacie GDL mogą rywalizować ze sobą na serwerze + <a href="http://euklid.inf.tu-dresden.de:8180/ggpserver/"> + Dresden GGP Server</a>, gdzie Toss ostatnio też odnosił pewne sukcesy. + <br/> + Gry w formacie GDL nie są niestety przystosowane do bezpośredniego + oglądania i grania przez ludzi, w przeciwieństwie do gier Tossa, choć + <a href="http://code.google.com/p/ggp-galaxy/">GGP Galaxy Project</a> + próbuje ostatnio przystosować nieco GGP do gry online. Toss nie ma tego + problemów, a kilka gier przeciwko dobremu programowi GGP (Fluxplayer) + z serwera z Dresna zostalo przedstawionych ponizej. + </section> + + + <section title="Breakthrough"> <itemize> <item><ggp-game match_id="breakthrough.1297045579170" name="Breakthrough 1"/></item> @@ -72,7 +110,7 @@ </itemize> </section> - <section title="Gomoku Games"> + <section title="Gomoku"> <itemize> <item><ggp-game match_id="connect5.1297281103161" name="Gomoku 1"/></item> @@ -118,7 +156,7 @@ </section> - <section title="Pawn Whopping Games"> + <section title="Pawn Whopping"> <itemize> <item><ggp-game match_id="pawn_whopping_corrected.1297079331820" name="Pawn Whopping 1"/></item> Modified: trunk/Toss/www/styles/screen.css =================================================================== --- trunk/Toss/www/styles/screen.css 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/styles/screen.css 2011-03-14 03:24:33 UTC (rev 1358) @@ -156,7 +156,7 @@ } #parentnav li.selected { - background: url("../img/tabon1.png") no-repeat left top; + background: url("../img/tabon1.png") no-repeat left top; } #parentnav li.selected a, #parentnav li.selected span { Modified: trunk/Toss/www/xsl/books.xsl =================================================================== --- trunk/Toss/www/xsl/books.xsl 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/xsl/books.xsl 2011-03-14 03:24:33 UTC (rev 1358) @@ -29,6 +29,9 @@ <xsl:if test="$lang='en'"> <h1 property="dc:title">Books</h1> </xsl:if> + <xsl:if test="$lang='pl'"> + <h1 property="dc:title">Ksiazki</h1> + </xsl:if> <!-- <xsl:if test="$lang='de'"> <p><em>Der Inhalt dieser Seite ist nur auf Englisch verfügbar.</em></p> Modified: trunk/Toss/www/xsl/include/common.xsl =================================================================== --- trunk/Toss/www/xsl/include/common.xsl 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/xsl/include/common.xsl 2011-03-14 03:24:33 UTC (rev 1358) @@ -73,8 +73,13 @@ <xsl:apply-templates /> <p><a href="http://tplay.org">Weitere Spiele</a></p> </xsl:when> + <xsl:when test="$lang='pl'"> + <h3><a href="http://tplay.org">Zagraj Online z Tossem</a></h3> + <xsl:apply-templates /> + <p><a href="http://tplay.org">Więcej gier</a></p> + </xsl:when> <xsl:otherwise> - <h3><a href="http://tplay.org">Play Online against Toss</a></h3> + <h3><a href="http://tplay.org">Play Online Against Toss</a></h3> <xsl:apply-templates /> <p><a href="http://tplay.org">More Games</a></p> </xsl:otherwise> @@ -170,11 +175,29 @@ </xsl:template> <xsl:template match="game-link"> - <a href="http://tplay.org/index_{@game}.html" - title="Play {@game}" class="game-link" id="game-link-{@game}"> - <img class="game-img" src="{$topdir}/img/{@game}.png" - alt="{@game} Board Image" id="game-img-{@game}" /> - </a> + <xsl:choose> + <xsl:when test="$lang='de'"> + <a href="http://tplay.org/index_{@game}.html" + title="Spiel {@game}" class="game-link" id="game-link-{@game}"> + <img class="game-img" src="{$topdir}/img/{@game}.png" + alt="{@game}Brett" id="game-img-{@game}" /> + </a> + </xsl:when> + <xsl:when test="$lang='pl'"> + <a href="http://tplay.org/index_{@game}.html" + title="Graj w {@game}" class="game-link" id="game-link-{@game}"> + <img class="game-img" src="{$topdir}/img/{@game}.png" + alt="Plansza {@game}" id="game-img-{@game}" /> + </a> + </xsl:when> + <xsl:otherwise> + <a href="http://tplay.org/index_{@game}.html" + title="Play {@game}" class="game-link" id="game-link-{@game}"> + <img class="game-img" src="{$topdir}/img/{@game}.png" + alt="{@game} Board Image" id="game-img-{@game}" /> + </a> + </xsl:otherwise> + </xsl:choose> </xsl:template> <xsl:template match="flag"> Modified: trunk/Toss/www/xsl/include/layout.xsl =================================================================== --- trunk/Toss/www/xsl/include/layout.xsl 2011-03-13 17:36:46 UTC (rev 1357) +++ trunk/Toss/www/xsl/include/layout.xsl 2011-03-14 03:24:33 UTC (rev 1358) @@ -26,8 +26,8 @@ <html xmlns='http://www.w3.org/1999/xhtml' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:foaf='http://xmlns.com/foaf/0.1/' - xml:lang="en" - lang="en"> + xml:lang="{$lang}" + lang="{$lang}"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <link rel="stylesheet" type="text/css" href="{$topdir}/styles/common.css" media="all"/> @@ -55,6 +55,9 @@ <xsl:if test="$lang='en'"> <title>Publications</title> </xsl:if> + <xsl:if test="$lang='pl'"> + <title>Publikacje</title> + </xsl:if> </xsl:when> <xsl:when test="$title='Publications' and $author!='all'"> <xsl:variable name="fullname" select="normalize-space(concat(document('../../people.xml')/people/person[@id=$author]/first,' ',document('../../people.xml')/people/person[@id=$author]/last))"/> @@ -64,6 +67,9 @@ <xsl:if test="$lang='en'"> <title>Publications: <xsl:value-of select="$fullname"/></title> </xsl:if> + <xsl:if test="$lang='pl'"> + <title>Publikacje: <xsl:value-of select="$fullname"/></title> + </xsl:if> </xsl:when> <xsl:otherwise> <title><xsl:value-of select="$title"/></title> @@ -126,... [truncated message content] |
From: <luk...@us...> - 2011-03-13 17:36:54
|
Revision: 1357 http://toss.svn.sourceforge.net/toss/?rev=1357&view=rev Author: lukaszkaiser Date: 2011-03-13 17:36:46 +0000 (Sun, 13 Mar 2011) Log Message: ----------- Web work, async moves, chess correction. Modified Paths: -------------- trunk/Toss/WebClient/Connect.js trunk/Toss/WebClient/Main.js trunk/Toss/examples/Chess.toss trunk/Toss/www/docs.xml trunk/Toss/www/index.xml trunk/Toss/www/navigation.xml trunk/Toss/www/styles/screen.css trunk/Toss/www/xsl/include/common.xsl Added Paths: ----------- trunk/Toss/www/develop.xml Modified: trunk/Toss/WebClient/Connect.js =================================================================== --- trunk/Toss/WebClient/Connect.js 2011-03-13 00:09:53 UTC (rev 1356) +++ trunk/Toss/WebClient/Connect.js 2011-03-13 17:36:46 UTC (rev 1357) @@ -28,6 +28,8 @@ var PAYOFF_STR = "" var PLAYER_STR = "" +var ASYNC_REQ_PENDING = 0; + // Helper function: sign of a number. function sign (x) { if (x > 0.01) { return (1); } @@ -76,19 +78,21 @@ } // Send [msg] to server asynchronously, ignore response text. -function async_server_msg (msg) { +function async_server_msg (msg, f) { var xml_request = new XMLHttpRequest (); xml_request.open ('POST', 'Handler.py', true); xml_request.setRequestHeader ('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xml_request.onreadystatechange = function () { if (xml_request.readyState == 4) { + ASYNC_REQ_PENDING -= 1; resp = xml_request.responseText; if (resp.indexOf ("MOD_PYTHON ERROR") > -1) { alert (resp.substring(resp.indexOf("Traceback"))); - } + } else { f(resp) }; } }; + ASYNC_REQ_PENDING += 1; xml_request.send (msg); } @@ -98,10 +102,15 @@ } // Send [msg] to server attaching prefix '[cmd]#' async., ignore response. -function async_srv (cmd, msg) { - return (async_server_msg (cmd + '#' + msg)); +function async_srv_ignore (cmd, msg) { + return (async_server_msg (cmd + '#' + msg, function(x) { } )); } +// Send [msg] to server attaching prefix '[cmd]#' async., run f on return. +function async_srv (cmd, msg, f) { + return (async_server_msg (cmd + '#' + msg, f )); +} + // Strip [c1] and [c2] from beginning and end of [str]. function strip (c1, c2, str) { if (str.length == 0) return (str); Modified: trunk/Toss/WebClient/Main.js =================================================================== --- trunk/Toss/WebClient/Main.js 2011-03-13 00:09:53 UTC (rev 1356) +++ trunk/Toss/WebClient/Main.js 2011-03-13 17:36:46 UTC (rev 1357) @@ -119,6 +119,7 @@ // Handler for clicks on elements. function handle_elem_click (elem) { + if (ASYNC_REQ_PENDING != 0) { return; } var moves = get_moves (elem, LAST_CLICKED_ELEM); if (moves.length == 0) { LAST_CLICKED_ELEM = ""; @@ -209,6 +210,7 @@ } function play_click (game, play_id, pi) { + document.getElementById("opponents").style.display = "none"; list_plays (game); game_click (game); document.getElementById ("game-title").innerHTML = game; @@ -232,7 +234,11 @@ return; } document.getElementById("working").style.display = "block"; - var info = srv("MOVE_PLAY", 'c, '+ CUR_MOVE +', '+ play_py_id (CUR_PLAY_I)); + async_srv("MOVE_PLAY", 'c, '+ CUR_MOVE +', '+ play_py_id (CUR_PLAY_I), + make_move_continue); +} + +function make_move_continue (info) { set_info (info); CUR_MOVE = ""; CUR_ELEMS = []; @@ -242,14 +248,15 @@ disp_name(PLAYS[CUR_PLAY_I][PLAYER_STR]); document.getElementById("working").style.display = "none"; full_redraw (); - async_srv ("UPD_SVG", play_py_id(CUR_PLAY_I) + ", " + svg_string()); + async_srv_ignore ("UPD_SVG", play_py_id(CUR_PLAY_I) + ", " + svg_string()); var old_li = document.getElementById ("plays-list-" + GAME_NAME + "-elem-" + CUR_PLAY_I); var li = new_play_item (GAME_NAME, CUR_PLAY_I); old_li.parentNode.replaceChild (li, old_li); if (PLAYS[CUR_PLAY_I][PLAYER_STR] == "computer") { - var m = suggest_move (); - if (m != "") { make_move (); } + //var m = suggest_move (); + //if (m != "") { make_move (); } + suggest_move_async (make_move); } } @@ -380,7 +387,7 @@ PLAYS.push(p); set_info(info_nbr.substring(info_idx+1)); full_redraw (); - async_srv ("UPD_SVG", play_py_id(CUR_PLAY_I) + ", " + svg_string()); + async_srv_ignore ("UPD_SVG", play_py_id(CUR_PLAY_I) + ", " + svg_string()); li = new_play_item (GAME_NAME, CUR_PLAY_I); document.getElementById("plays-list-" + GAME_NAME).appendChild(li); } @@ -400,6 +407,25 @@ return (m); } +function decrease_moving (n) { + document.getElementById("working").innerHTML = "Moving in " + n + " ..."; + if (n > 0) { + setTimeout("decrease_moving(" + (n-1) + ")", 1000); + } +} + +function suggest_move_async (f) { + document.getElementById("working").innerHTML = "Moving in 5 ..."; + document.getElementById("working").style.display = "block"; + setTimeout("decrease_moving(4)", 1000) + var fm = function (m) { + document.getElementById("working").style.display = "none"; + document.getElementById("working").innerHTML = "Working..."; + if (m != "") { show_move (m); f() } + }; + async_srv("SUGGEST", 'c, '+ play_py_id (CUR_PLAY_I), fm); +} + function suggest_move_better () { document.getElementById("working").innerHTML = "Calculating move..."; document.getElementById("working").style.display = "block"; Modified: trunk/Toss/examples/Chess.toss =================================================================== --- trunk/Toss/examples/Chess.toss 2011-03-13 00:09:53 UTC (rev 1356) +++ trunk/Toss/examples/Chess.toss 2011-03-13 17:36:46 UTC (rev 1357) @@ -49,7 +49,7 @@ wP . -" emb w, b post not CheckW() +" emb w, b pre not IsEight(a2) post not CheckW() RULE BlackPawnMove: [ | | ] " ... @@ -61,7 +61,7 @@ ... bP -" emb w, b post not CheckB() +" emb w, b pre not IsFirst(a1) post not CheckB() RULE WhitePawnMoveDbl: [ | | ] " @@ -98,7 +98,16 @@ [ a, b | wP { a }; b { b } | - ] -> [ a, b | wP { b } | - ] - emb w, b pre ex z (C(a, z) and (R(z, b) or R(b, z))) post not CheckW() + emb w, b + pre not IsEight(b) and ex z (C(a, z) and (R(z, b) or R(b, z))) + post not CheckW() +RULE WhitePawnBeatPromote: + [ a, b | wP { a }; b { b } | - ] + -> + [ a, b | wQ { b } | - ] + emb w, b + pre IsEight(b) and ex z (C(a, z) and (R(z, b) or R(b, z))) + post not CheckW() RULE WhitePawnBeatRDbl: [ | | ] " ... @@ -135,7 +144,16 @@ [ a, b | bP { a }; w { b } | - ] -> [ a, b | bP { b } | - ] - emb w, b pre ex z (C(z, a) and (R(z, b) or R(b, z))) post not CheckB() + emb w, b + pre not IsFirst(b) and ex z (C(z, a) and (R(z, b) or R(b, z))) + post not CheckB() +RULE BlackPawnBeatPromote: + [ a, b | bP { a }; w { b } | - ] + -> + [ a, b | bQ { b } | - ] + emb w, b + pre IsFirst(b) and ex z (C(z, a) and (R(z, b) or R(b, z))) + post not CheckB() RULE BlackPawnBeatRDbl: [ | | ] " ... @@ -304,6 +322,7 @@ [WhitePawnMove -> 1]; [WhitePawnMoveDbl -> 1]; [WhitePawnBeat -> 1]; + [WhitePawnBeatPromote -> 1]; [WhitePawnBeatLDbl -> 1]; [WhitePawnBeatRDbl -> 1]; [WhitePawnPromote -> 1]; @@ -327,6 +346,7 @@ [BlackPawnMove -> 0]; [BlackPawnMoveDbl -> 0]; [BlackPawnBeat -> 0]; + [BlackPawnBeatPromote -> 0]; [BlackPawnBeatLDbl -> 0]; [BlackPawnBeatRDbl -> 0]; [BlackPawnPromote -> 0]; @@ -350,6 +370,7 @@ [WhitePawnMove -> 3]; [WhitePawnMoveDbl -> 3]; [WhitePawnBeat -> 3]; + [WhitePawnBeatPromote -> 3]; [WhitePawnBeatLDbl -> 3]; [WhitePawnBeatRDbl -> 3]; [WhitePawnPromote -> 3]; @@ -372,6 +393,7 @@ [BlackPawnMove -> 2]; [BlackPawnMoveDbl -> 2]; [BlackPawnBeat -> 2]; + [BlackPawnBeatPromote -> 2]; [BlackPawnBeatLDbl -> 2]; [BlackPawnBeatRDbl -> 2]; [BlackPawnPromote -> 2]; @@ -395,6 +417,7 @@ [WhitePawnMove -> 5]; [WhitePawnMoveDbl -> 5]; [WhitePawnBeat -> 5]; + [WhitePawnBeatPromote -> 5]; [WhitePawnBeatLDbl -> 5]; [WhitePawnBeatRDbl -> 5]; [WhitePawnPromote -> 5]; @@ -417,6 +440,7 @@ [BlackPawnMove -> 4]; [BlackPawnMoveDbl -> 4]; [BlackPawnBeat -> 4]; + [BlackPawnBeatPromote -> 4]; [BlackPawnBeatLDbl -> 4]; [BlackPawnBeatRDbl -> 4]; [BlackPawnPromote -> 4]; @@ -440,6 +464,7 @@ [WhitePawnMove -> 7]; [WhitePawnMoveDbl -> 7]; [WhitePawnBeat -> 7]; + [WhitePawnBeatPromote -> 7]; [WhitePawnBeatLDbl -> 7]; [WhitePawnBeatRDbl -> 7]; [WhitePawnPromote -> 7]; @@ -461,6 +486,7 @@ [BlackPawnMove -> 6]; [BlackPawnMoveDbl -> 6]; [BlackPawnBeat -> 6]; + [BlackPawnBeatPromote -> 6]; [BlackPawnBeatLDbl -> 6]; [BlackPawnBeatRDbl -> 6]; [BlackPawnPromote -> 6]; @@ -484,6 +510,7 @@ [WhitePawnMove -> 9]; [WhitePawnMoveDbl -> 9]; [WhitePawnBeat -> 9]; + [WhitePawnBeatPromote -> 9]; [WhitePawnBeatLDbl -> 9]; [WhitePawnBeatRDbl -> 9]; [WhitePawnPromote -> 9]; @@ -507,6 +534,7 @@ [BlackPawnMove -> 8]; [BlackPawnMoveDbl -> 8]; [BlackPawnBeat -> 8]; + [BlackPawnBeatPromote -> 8]; [BlackPawnBeatLDbl -> 8]; [BlackPawnBeatRDbl -> 8]; [BlackPawnPromote -> 8]; @@ -529,6 +557,7 @@ [WhitePawnMove -> 11]; [WhitePawnMoveDbl -> 11]; [WhitePawnBeat -> 11]; + [WhitePawnBeatPromote -> 11]; [WhitePawnBeatLDbl -> 11]; [WhitePawnBeatRDbl -> 11]; [WhitePawnPromote -> 11]; @@ -551,6 +580,7 @@ [BlackPawnMove -> 10]; [BlackPawnMoveDbl -> 10]; [BlackPawnBeat -> 10]; + [BlackPawnBeatPromote -> 10]; [BlackPawnBeatLDbl -> 10]; [BlackPawnBeatRDbl -> 10]; [BlackPawnPromote -> 10]; @@ -573,6 +603,7 @@ [WhitePawnMove -> 13]; [WhitePawnMoveDbl -> 13]; [WhitePawnBeat -> 13]; + [WhitePawnBeatPromote -> 13]; [WhitePawnBeatLDbl -> 13]; [WhitePawnBeatRDbl -> 13]; [WhitePawnPromote -> 13]; @@ -595,6 +626,7 @@ [BlackPawnMove -> 12]; [BlackPawnMoveDbl -> 12]; [BlackPawnBeat -> 12]; + [BlackPawnBeatPromote -> 12]; [BlackPawnBeatLDbl -> 12]; [BlackPawnBeatRDbl -> 12]; [BlackPawnPromote -> 12]; @@ -617,6 +649,7 @@ [WhitePawnMove -> 15]; [WhitePawnMoveDbl -> 15]; [WhitePawnBeat -> 15]; + [WhitePawnBeatPromote -> 15]; [WhitePawnBeatLDbl -> 15]; [WhitePawnBeatRDbl -> 15]; [WhitePawnPromote -> 15]; @@ -638,6 +671,7 @@ [BlackPawnMove -> 14]; [BlackPawnMoveDbl -> 14]; [BlackPawnBeat -> 14]; + [BlackPawnBeatPromote -> 14]; [BlackPawnBeatLDbl -> 14]; [BlackPawnBeatRDbl -> 14]; [BlackPawnPromote -> 14]; @@ -660,6 +694,7 @@ [WhitePawnMove -> 17]; [WhitePawnMoveDbl -> 17]; [WhitePawnBeat -> 17]; + [WhitePawnBeatPromote -> 17]; [WhitePawnBeatLDbl -> 17]; [WhitePawnBeatRDbl -> 17]; [WhitePawnPromote -> 17]; @@ -683,6 +718,7 @@ [BlackPawnMove -> 16]; [BlackPawnMoveDbl -> 16]; [BlackPawnBeat -> 16]; + [BlackPawnBeatPromote -> 16]; [BlackPawnBeatLDbl -> 16]; [BlackPawnBeatRDbl -> 16]; [BlackPawnPromote -> 16]; @@ -705,6 +741,7 @@ [WhitePawnMove -> 19]; [WhitePawnMoveDbl -> 19]; [WhitePawnBeat -> 19]; + [WhitePawnBeatPromote -> 19]; [WhitePawnBeatLDbl -> 19]; [WhitePawnBeatRDbl -> 19]; [WhitePawnPromote -> 19]; @@ -727,6 +764,7 @@ [BlackPawnMove -> 18]; [BlackPawnMoveDbl -> 18]; [BlackPawnBeat -> 18]; + [BlackPawnBeatPromote -> 18]; [BlackPawnBeatLDbl -> 18]; [BlackPawnBeatRDbl -> 18]; [BlackPawnPromote -> 18]; @@ -749,6 +787,7 @@ [WhitePawnMove -> 21]; [WhitePawnMoveDbl -> 21]; [WhitePawnBeat -> 21]; + [WhitePawnBeatPromote -> 21]; [WhitePawnBeatLDbl -> 21]; [WhitePawnBeatRDbl -> 21]; [WhitePawnPromote -> 21]; @@ -771,6 +810,7 @@ [BlackPawnMove -> 20]; [BlackPawnMoveDbl -> 20]; [BlackPawnBeat -> 20]; + [BlackPawnBeatPromote -> 20]; [BlackPawnBeatLDbl -> 20]; [BlackPawnBeatRDbl -> 20]; [BlackPawnPromote -> 20]; @@ -793,6 +833,7 @@ [WhitePawnMove -> 23]; [WhitePawnMoveDbl -> 23]; [WhitePawnBeat -> 23]; + [WhitePawnBeatPromote -> 23]; [WhitePawnBeatLDbl -> 23]; [WhitePawnBeatRDbl -> 23]; [WhitePawnPromote -> 23]; @@ -814,6 +855,7 @@ [BlackPawnMove -> 22]; [BlackPawnMoveDbl -> 22]; [BlackPawnBeat -> 22]; + [BlackPawnBeatPromote -> 22]; [BlackPawnBeatLDbl -> 22]; [BlackPawnBeatRDbl -> 22]; [BlackPawnPromote -> 22]; @@ -836,6 +878,7 @@ [WhitePawnMove -> 25]; [WhitePawnMoveDbl -> 25]; [WhitePawnBeat -> 25]; + [WhitePawnBeatPromote -> 25]; [WhitePawnBeatLDbl -> 25]; [WhitePawnBeatRDbl -> 25]; [WhitePawnPromote -> 25]; @@ -859,6 +902,7 @@ [BlackPawnMove -> 24]; [BlackPawnMoveDbl -> 24]; [BlackPawnBeat -> 24]; + [BlackPawnBeatPromote -> 24]; [BlackPawnBeatLDbl -> 24]; [BlackPawnBeatRDbl -> 24]; [BlackPawnPromote -> 24]; @@ -880,6 +924,7 @@ [WhitePawnMove -> 27]; [WhitePawnMoveDbl -> 27]; [WhitePawnBeat -> 27]; + [WhitePawnBeatPromote -> 27]; [WhitePawnBeatLDbl -> 27]; [WhitePawnBeatRDbl -> 27]; [WhitePawnPromote -> 27]; @@ -902,6 +947,7 @@ [BlackPawnMove -> 26]; [BlackPawnMoveDbl -> 26]; [BlackPawnBeat -> 26]; + [BlackPawnBeatPromote -> 26]; [BlackPawnBeatLDbl -> 26]; [BlackPawnBeatRDbl -> 26]; [BlackPawnPromote -> 26]; @@ -923,6 +969,7 @@ [WhitePawnMove -> 29]; [WhitePawnMoveDbl -> 29]; [WhitePawnBeat -> 29]; + [WhitePawnBeatPromote -> 29]; [WhitePawnBeatLDbl -> 29]; [WhitePawnBeatRDbl -> 29]; [WhitePawnPromote -> 29]; @@ -945,6 +992,7 @@ [BlackPawnMove -> 28]; [BlackPawnMoveDbl -> 28]; [BlackPawnBeat -> 28]; + [BlackPawnBeatPromote -> 28]; [BlackPawnBeatLDbl -> 28]; [BlackPawnBeatRDbl -> 28]; [BlackPawnPromote -> 28]; @@ -966,6 +1014,7 @@ [WhitePawnMove -> 31]; [WhitePawnMoveDbl -> 31]; [WhitePawnBeat -> 31]; + [WhitePawnBeatPromote -> 31]; [WhitePawnBeatLDbl -> 31]; [WhitePawnBeatRDbl -> 31]; [WhitePawnPromote -> 31]; @@ -987,6 +1036,7 @@ [BlackPawnMove -> 30]; [BlackPawnMoveDbl -> 30]; [BlackPawnBeat -> 30]; + [BlackPawnBeatPromote -> 30]; [BlackPawnBeatLDbl -> 30]; [BlackPawnBeatRDbl -> 30]; [BlackPawnPromote -> 30]; Added: trunk/Toss/www/develop.xml =================================================================== --- trunk/Toss/www/develop.xml (rev 0) +++ trunk/Toss/www/develop.xml 2011-03-13 17:36:46 UTC (rev 1357) @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE lecture SYSTEM "xsl/xhtml1-lat1.ent"> + +<?xml-stylesheet type="text/xsl" href="xsl/main.xsl" charset="UTF-8"?> + +<personal> + <title lang="en">Develop Toss</title> + <title lang="de">Toss Ausbauen</title> + <history> + <link id="develop" href="/develop.html">Develop Toss</link> + </history> + + <section title="Preparation"> + <itemize> + <item>Except for the interfaces, most of Toss is programmed in + <a href="http://caml.inria.fr/">Objective Caml</a>. You will need + a good understanding of OCaml and a full OCaml installation + to work on the Toss Engine. + </item> + <item>Toss <em>build system</em> is based on <em>ocamlbuild</em> + and uses <em>Makefiles</em> for compilation of the C parts. + You will need a system which supports these to build Toss. + </item> + <item>If you want to develop Toss on Ubuntu, here is a command with + a list of packages to install.<br/> + sudo apt-get install g++ python-qt4 python-dev pyqt4-dev-tools + ocaml-findlib menhir libounit-ocaml-dev libapache2-mod-python + sqlite3 python-pysqlite2 + </item> + <item>This command will checkout the + <a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/">Toss + SVN Repository</a> to the <em>Toss</em> directory.<br/> + svn co https://toss.svn.sourceforge.net/svnroot/toss/trunk/Toss Toss + </item> + <item>In the Toss directory run <em>make</em> and check that + it succeeds.</item> + </itemize> + </section> + + <section title="Understanding Toss"> + <itemize> + <item><a href="create.html">Create</a> at least one simple game + to get started.</item> + <item>Get acquainted with <a href="docs.html">Toss documentation</a>. + </item> + <item>Do not forget to read the <a href="reference/reference.pdf"> + reference.pdf</a> document.</item> + <item>When you start looking at the code, you might find + the <a href="code_doc/">interface documentation</a> handy.</item> + <item>Skim through the <a href="Publications/">papers and talks</a> + about Toss to get an idea where the ideas come from.</item> + </itemize> + </section> + + <section title="Working with the Toss Team"> + <par>If you have an idea for Toss, a request, want to become a developer + or just want to talk, contact us! Most engaged Toss developers do + respond to Toss questions on their private emails every + day (see below), but <em>toss-devel</em> is the place we prefer.</par> + <itemize> + <item>Toss Mailing List: + <mailto address="tos...@li..."/></item> + <item>Łukasz Kaiser: + <mailto address="luk...@gm..."/></item> + <item>Łukasz Stafiniak: + <mailto address="luk...@gm..."/></item> + <item>Michał Wójcik: + <mailto address="mic...@gm..."/></item> + </itemize> + </section> + +</personal> Modified: trunk/Toss/www/docs.xml =================================================================== --- trunk/Toss/www/docs.xml 2011-03-13 00:09:53 UTC (rev 1356) +++ trunk/Toss/www/docs.xml 2011-03-13 17:36:46 UTC (rev 1357) @@ -52,6 +52,9 @@ <a href="http://www2.cse.iitk.ac.in/~fsttcs/2009/videos/star/LukaszKaiser.avi"> watched</a> online. </item> + <item><em>Shorter presentation</em> focusing on the AI side was given at + <em>AGI 2010</em> and can also be + <a href="http://www.vimeo.com/15326245">watched</a> online.</item> </itemize> </section> Modified: trunk/Toss/www/index.xml =================================================================== --- trunk/Toss/www/index.xml 2011-03-13 00:09:53 UTC (rev 1356) +++ trunk/Toss/www/index.xml 2011-03-13 17:36:46 UTC (rev 1357) @@ -11,10 +11,12 @@ <section title="About" lang="en"> <par><em>Toss</em> is a program to create, modify and play games. + It includes a general game playing engine so that you can play any + game you create against the computer. For example, did you ever wonder how your favorite game would feel if you removed the middle of the board? With Toss, it is easy to experiment! And after your game is ready, you can play it online - against a computer or compete with your friends! + and compete with your friends! </par> </section> @@ -82,20 +84,30 @@ <par>To learn more about the mathematical background and the design of Toss, use the following links.</par> <itemize> -<item><em>Compact description</em> of the mathematical model behind Toss and -our game playing algorithm can be found in the paper -<a href="http://logic.rwth-aachen.de/~kaiser/playing_structure_rewriting_games.pdf">Playing Structure Rewriting Games</a>.</item> + <item><em>Compact description</em> of the mathematical model behind Toss + and our game playing algorithm can be found in the paper + <a href="http://logic.rwth-aachen.de/~kaiser/playing_structure_rewriting_games.pdf">Playing Structure Rewriting Games</a>. + </item> -<item><em>Design and specification</em> of Toss are described in - the <a href="reference.pdf">reference.pdf</a> document.</item> + <item><em>Design and specification</em> of Toss are described in + the <a href="reference.pdf">reference.pdf</a> document. + </item> -<item> <em>Complexity</em> of a syntactic fragment of Toss was analyzed in - the paper <a href="http://logic.rwth-aachen.de/~kaiser/graph_games_short.pdf"> - Synthesis for Structure Rewriting Systems</a>.</item> -<item><em>Presentation</em> on the mathematics behind Toss was given at - <em>IIT Kanpur</em> and can be - <a href="http://www2.cse.iitk.ac.in/~fsttcs/2009/videos/star/LukaszKaiser.avi"> - watched</a> online.</item> + <item> <em>Complexity</em> of a syntactic fragment of Toss was analyzed in + the paper <a href="http://logic.rwth-aachen.de/~kaiser/graph_games_short.pdf"> + Synthesis for Structure Rewriting Systems</a>. + </item> + + <item><em>Presentation</em> on the mathematics behind Toss was given at + <em>IIT Kanpur</em> and can be + <a href="http://www2.cse.iitk.ac.in/~fsttcs/2009/videos/star/LukaszKaiser.avi"> + watched</a> online. + </item> + + <item><em>Shorter presentation</em> focusing on the AI side was given at + <em>AGI 2010</em> and can also be + <a href="http://www.vimeo.com/15326245">watched</a> online. + </item> </itemize> </section> Modified: trunk/Toss/www/navigation.xml =================================================================== --- trunk/Toss/www/navigation.xml 2011-03-13 00:09:53 UTC (rev 1356) +++ trunk/Toss/www/navigation.xml 2011-03-13 17:36:46 UTC (rev 1357) @@ -20,6 +20,7 @@ <item href="/code_doc/" id="code">Code Documentation</item> </menu> <item href="/Publications/" id="Publications">Papers and Talks</item> + <item href="/develop.html" id="develop">Develop Toss</item> <item href="/contact.html" id="contact">Contact and Links</item> </menu> @@ -39,8 +40,8 @@ <menu title="Dokumentation" href="/docs.html" id="docs"> <item href="/background.html" id="background">Hintergrund</item> </menu> - - <item href="/Publications/" id="Publications">Publikationen und Vorträge</item> + <item href="/Publications/" id="Publications">Papers und Talks</item> + <item href="/develop.html" id="develop">Toss Ausbauen</item> <item href="/contact.html" id="contact">Kontakt und Links</item> </menu> Modified: trunk/Toss/www/styles/screen.css =================================================================== --- trunk/Toss/www/styles/screen.css 2011-03-13 00:09:53 UTC (rev 1356) +++ trunk/Toss/www/styles/screen.css 2011-03-13 17:36:46 UTC (rev 1357) @@ -120,6 +120,7 @@ position: absolute; bottom: 0px; right: 0px; + /*display: none;*/ } #parentnav ul { Modified: trunk/Toss/www/xsl/include/common.xsl =================================================================== --- trunk/Toss/www/xsl/include/common.xsl 2011-03-13 00:09:53 UTC (rev 1356) +++ trunk/Toss/www/xsl/include/common.xsl 2011-03-13 17:36:46 UTC (rev 1357) @@ -69,12 +69,12 @@ <xsl:template match="games-section"> <xsl:choose> <xsl:when test="$lang='de'"> - <h3><a href="http://tplay.org">Online Spielen</a></h3> + <h3><a href="http://tplay.org">Online Spielen gegen Toss</a></h3> <xsl:apply-templates /> <p><a href="http://tplay.org">Weitere Spiele</a></p> </xsl:when> <xsl:otherwise> - <h3><a href="http://tplay.org">Play Online</a></h3> + <h3><a href="http://tplay.org">Play Online against Toss</a></h3> <xsl:apply-templates /> <p><a href="http://tplay.org">More Games</a></p> </xsl:otherwise> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-13 00:10:01
|
Revision: 1356 http://toss.svn.sourceforge.net/toss/?rev=1356&view=rev Author: lukaszkaiser Date: 2011-03-13 00:09:53 +0000 (Sun, 13 Mar 2011) Log Message: ----------- Corrections to web sites, rename rules in pawn whopping. Modified Paths: -------------- trunk/Toss/Arena/Arena.mli trunk/Toss/GGP/GDL.ml trunk/Toss/Play/Heuristic.ml trunk/Toss/Server/Server.ml trunk/Toss/WebClient/Handler.py trunk/Toss/WebClient/Main.js trunk/Toss/WebClient/Style.css trunk/Toss/WebClient/Wrapper.py trunk/Toss/WebClient/contact.html trunk/Toss/examples/Pawn-Whopping.toss trunk/Toss/www/contact.xml trunk/Toss/www/create.xml trunk/Toss/www/docs.xml trunk/Toss/www/ideas.xml trunk/Toss/www/index.xml Modified: trunk/Toss/Arena/Arena.mli =================================================================== --- trunk/Toss/Arena/Arena.mli 2011-03-12 19:24:32 UTC (rev 1355) +++ trunk/Toss/Arena/Arena.mli 2011-03-13 00:09:53 UTC (rev 1356) @@ -110,8 +110,9 @@ val map_to_formulas : (Formula.formula -> Formula.formula) -> game -> game -(** ------------------ REQUESTS TO THE ARENA USED IN OPERATION --------------- *) +(** {2 Requests to the Arena used in Operation} *) + (** Location of a structure: either arena or left or right-hand side of a rule *) type struct_loc = Struct | Left of string | Right of string Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-03-12 19:24:32 UTC (rev 1355) +++ trunk/Toss/GGP/GDL.ml 2011-03-13 00:09:53 UTC (rev 1356) @@ -3713,7 +3713,6 @@ game_description := game_descr; let pterms = [|Const "WHITE"; Const "RED"|] in let noops = [|Some (Const "NOOP"); Some (Const "NOOP")|] in - Heuristic.use_monotonic := false; let (* effort, horizon, heur_adv_ratio *) params = 10, 100, 4.0 in pterms, noops, state, Some params @@ -3849,36 +3848,36 @@ match actions with | [Func ("MOVE", [Const x1; Const y1; Const x2; Const y2]); Const "NOOP"] when x1 = x2 && (s2i y2) - (s2i y1) = 1 -> - "WhiteStraight", + "WhiteMove", ["a1", Structure.board_coords_name (s2i x1, s2i y1); "a2", Structure.board_coords_name (s2i x2, s2i y2)] | [Func ("MOVE", [Const x1; Const y1; Const x2; Const y2]); Const "NOOP"] when x1 = x2 && (s2i y2) - (s2i y1) = 2 -> - "WhiteStraightTwo", + "WhiteMoveTwo", ["a1", Structure.board_coords_name (s2i x1, s2i y1); "a2", Structure.board_coords_name (s2i x1, (s2i y1) + 1); "a3", Structure.board_coords_name (s2i x2, s2i y2)] | [Func ("CAPTURE", [Const x1; Const y1; Const x2; Const y2]); Const "NOOP"] -> - "WhiteDiag", + "WhiteBeat", ["a", Structure.board_coords_name (s2i x1, s2i y1); "b", Structure.board_coords_name (s2i x2, s2i y2)] | [Const "NOOP"; Func ("MOVE", [Const x1; Const y1; Const x2; Const y2])] when x1 = x2 && (s2i y1) - (s2i y2) = 1 -> - "BlackStraight", + "BlackMove", ["a2", Structure.board_coords_name (s2i x1, s2i y1); "a1", Structure.board_coords_name (s2i x2, s2i y2)] | [Const "NOOP"; Func ("MOVE", [Const x1; Const y1; Const x2; Const y2])] when x1 = x2 && (s2i y1) - (s2i y2) = 2 -> - "BlackStraightTwo", + "BlackMoveTwo", ["a3", Structure.board_coords_name (s2i x1, s2i y1); "a2", Structure.board_coords_name (s2i x1, (s2i y1) - 1); "a1", Structure.board_coords_name (s2i x2, s2i y2)] | [Const "NOOP"; Func ("CAPTURE", [Const x1; Const y1; Const x2; Const y2])] -> - "BlackDiag", + "BlackBeat", ["a", Structure.board_coords_name (s2i x1, s2i y1); "b", Structure.board_coords_name (s2i x2, s2i y2)] | _ -> assert false Modified: trunk/Toss/Play/Heuristic.ml =================================================================== --- trunk/Toss/Play/Heuristic.ml 2011-03-12 19:24:32 UTC (rev 1355) +++ trunk/Toss/Play/Heuristic.ml 2011-03-13 00:09:53 UTC (rev 1356) @@ -959,7 +959,10 @@ List.map (fun r -> (snd r).ContinuousRule.compiled) rules in let fluents = Aux.concat_map DiscreteRule.fluents drules in let frels = Aux.strings_of_list fluents in - let monotonic = !use_monotonic && + let free_pre r = + let pre = (snd r).ContinuousRule.discrete.DiscreteRule.pre in + FormulaOps.free_vars pre = [] in + let monotonic = !use_monotonic && List.for_all free_pre rules && List.for_all DiscreteRule.monotonic drules in let advr = match advr with Some r -> r | None -> Modified: trunk/Toss/Server/Server.ml =================================================================== --- trunk/Toss/Server/Server.ml 2011-03-12 19:24:32 UTC (rev 1355) +++ trunk/Toss/Server/Server.ml 2011-03-13 00:09:53 UTC (rev 1356) @@ -205,9 +205,10 @@ let heur = match !game_modified, !g_heur with | false, Some h -> h | true, _ | _, None -> + let adr = match advr with Some a -> a | None -> 4. in g_heur := Some (Heuristic.default_heuristic ~struc:(snd !state).Arena.struc - ~advr:4. (fst !state)); + ~advr:adr (fst !state)); Aux.unsome !g_heur in let (move, _) = Play.maximax_unfold_choose effort (fst !state) (snd !state) heur in Modified: trunk/Toss/WebClient/Handler.py =================================================================== --- trunk/Toss/WebClient/Handler.py 2011-03-12 19:24:32 UTC (rev 1355) +++ trunk/Toss/WebClient/Handler.py 2011-03-13 00:09:53 UTC (rev 1356) @@ -256,9 +256,9 @@ client.set_cur_loc (loc) #depth = client.get_data ("depth") #if depth == "none": depth = 2 - #adv_ratio = client.get_data ("adv_ratio") - #if adv_ratio == "none": adv_ratio = 2 - return (client.suggest (offset)) + adv_ratio = client.get_data ("adv_ratio") + if adv_ratio == "none": adv_ratio = 4 + return (client.suggest (offset, adv_ratio)) def suggest (db, client, g, p1, p2, pid, m): return (suggest_offset (5, db, client, g, p1, p2, pid, m)) Modified: trunk/Toss/WebClient/Main.js =================================================================== --- trunk/Toss/WebClient/Main.js 2011-03-12 19:24:32 UTC (rev 1355) +++ trunk/Toss/WebClient/Main.js 2011-03-13 00:09:53 UTC (rev 1356) @@ -55,6 +55,16 @@ svg_e.parentNode.removeChild (svg_e); } +// Substitute players for 0 and 1 in a payoff string. +function subst_pl (s) { + var s1 = s.replace (/0:/g, disp_name(PLAYS[CUR_PLAY_I][0]) + ":"); + var s2 = s1.replace (/1:/g, disp_name(PLAYS[CUR_PLAY_I][1]) + ":"); + var s3 = s2.replace (/1.,/g, "1,"); + var s4 = s3.replace (/0.,/g, "0,"); + var s5 = s4.replace (/1.$/g, "1"); + return (s5.replace (/0.$/g, "0")); +} + // Full redraw. function full_redraw () { clear_svg (); @@ -67,7 +77,7 @@ document.getElementById('cur-move').innerHTML = "none"; } else { document.getElementById('movebt').innerHTML = "Payoffs:"; - document.getElementById('cur-move').innerHTML = PAYOFF_STR; + document.getElementById('cur-move').innerHTML = subst_pl(PAYOFF_STR); } document.getElementById("working").style.display = "none"; } Modified: trunk/Toss/WebClient/Style.css =================================================================== --- trunk/Toss/WebClient/Style.css 2011-03-12 19:24:32 UTC (rev 1355) +++ trunk/Toss/WebClient/Style.css 2011-03-13 00:09:53 UTC (rev 1356) @@ -712,7 +712,8 @@ stroke-width: 3px; } -.chessW .chess-path-A { +.Game-Chess .chessW .chess-path-A, .Game-Pawn-Whopping .chessW .chess-path-A, + .Game-Checkers .chessB .chess-path-A { opacity: 1; fill: #fff1d4; fill-opacity: 1; @@ -727,7 +728,8 @@ stroke-opacity: 1; } -.chessB .chess-path-A { +.Game-Chess .chessB .chess-path-A, .Game-Pawn-Whopping .chessB .chess-path-A, + .Game-Checkers .chessW .chess-path-A { opacity: 1; fill: #400827; fill-opacity: 1; @@ -742,7 +744,8 @@ stroke-opacity: 1; } -.chessW .chess-path-B { +.Game-Chess .chessW .chess-path-B, .Game-Pawn-Whopping .chessW .chess-path-B, + .Game-Checkers .chessB .chess-path-B { opacity: 1; fill: #fff1d4; fill-opacity: 1; @@ -756,7 +759,8 @@ stroke-opacity: 1; } -.chessB .chess-path-B { +.Game-Chess .chessB .chess-path-B, .Game-Pawn-Whopping .chessB .chess-path-B, + .Game-Checkers .chessW .chess-path-B { opacity: 1; fill: #400827; fill-opacity: 1; @@ -770,7 +774,9 @@ stroke-opacity: 1; } -.chessW .chess-path-Bx { + +.Game-Chess .chessW .chess-path-Bx, .Game-Pawn-Whopping .chessW .chess-path-Bx, + .Game-Checkers .chessB .chess-path-Bx { opacity: 1; fill: #fff1d4; fill-opacity: 1; @@ -784,7 +790,8 @@ stroke-opacity: 1; } -.chessB .chess-path-Bx { +.Game-Chess .chessB .chess-path-Bx, .Game-Pawn-Whopping .chessB .chess-path-Bx, + .Game-Checkers .chessW .chess-path-Bx { opacity: 1; fill: #fff1d4; fill-opacity: 1; @@ -798,7 +805,8 @@ stroke-opacity: 1; } -.chessW .chess-path-C { +.Game-Chess .chessW .chess-path-C, .Game-Pawn-Whopping .chessW .chess-path-C, + .Game-Checkers .chessB .chess-path-C { opacity: 1; fill: #400827; fill-opacity: 1; @@ -811,7 +819,8 @@ stroke-opacity: 1; } -.chessB .chess-path-C { +.Game-Chess .chessB .chess-path-C, .Game-Pawn-Whopping .chessB .chess-path-C, + .Game-Checkers .chessW .chess-path-C { opacity:1; fill: #fff1d4; fill-opacity: 1; @@ -824,7 +833,8 @@ stroke-opacity: 1; } -.chessW .chess-path-D { +.Game-Chess .chessW .chess-path-D, .Game-Pawn-Whopping .chessW .chess-path-D, + .Game-Checkers .chessB .chess-path-D { fill: #fff1d4; fill-opacity: 0.75; fill-rule: evenodd; @@ -837,7 +847,8 @@ stroke-opacity: 1; } -.chessB .chess-path-D { +.Game-Chess .chessB .chess-path-D, .Game-Pawn-Whopping .chessB .chess-path-D, + .Game-Checkers .chessW .chess-path-D { fill: #400827; fill-opacity: 0.75; fill-rule: evenodd; Modified: trunk/Toss/WebClient/Wrapper.py =================================================================== --- trunk/Toss/WebClient/Wrapper.py 2011-03-12 19:24:32 UTC (rev 1355) +++ trunk/Toss/WebClient/Wrapper.py 2011-03-13 00:09:53 UTC (rev 1356) @@ -218,10 +218,10 @@ t = [s.strip() for s in m.split('/')] return ((float(t[0]), float(t[1]))) - def suggest (self, timeout): + def suggest (self, timeout, advr): loc = self.get_cur_loc () (ts, t) = self.get_time () - m = self.msg ("EVAL LOC MOVES 4.0 " + str(loc) + + m = self.msg ("EVAL LOC MOVES " + str(advr) + ".0 " + str(loc) + " TIMEOUT "+ str(timeout) + " 55500 alpha_beta_ord") self.set_time (ts, t) msg = [s.strip() for s in m.split(';')] Modified: trunk/Toss/WebClient/contact.html =================================================================== --- trunk/Toss/WebClient/contact.html 2011-03-12 19:24:32 UTC (rev 1355) +++ trunk/Toss/WebClient/contact.html 2011-03-13 00:09:53 UTC (rev 1356) @@ -32,7 +32,8 @@ <ul> <li><a class="ta" href="http://toss.sourceforge.net/">Toss Homepage</a></li> <li><a class="ta" href="http://www.playok.com/">Online games on PlayOK</a></li> -<li><a class="ta" href="http://apronus.com/chess/index.htm">Chess on Apronus</a></li> +<li><a class="ta" href="http://www.apronus.com/chess/wbeditor.php">Chess + on Apronus</a></li> </ul> </div> Modified: trunk/Toss/examples/Pawn-Whopping.toss =================================================================== --- trunk/Toss/examples/Pawn-Whopping.toss 2011-03-12 19:24:32 UTC (rev 1355) +++ trunk/Toss/examples/Pawn-Whopping.toss 2011-03-13 00:09:53 UTC (rev 1356) @@ -8,10 +8,10 @@ REL IsSeventh(x) = ex y (C(x, y) and IsEight(y)) REL WhiteEnds() = (ex x (wP(x) and not ex y C(x, y))) or (not ex z bP(z)) REL BlackEnds() = (ex x (bP(x) and not ex y C(y, x))) or (not ex z wP(z)) -RULE WhiteDiag: +RULE WhiteBeat: [ a, b | wP { a }; bP { b } | - ] -> [ a, b | wP { b } | - ] emb wP, bP pre DiagW(a, b) and not BlackEnds() -RULE WhiteStraight: +RULE WhiteMove: [ | bP:1 {}; R:2 {} | ] " . @@ -23,7 +23,7 @@ . " emb wP, bP pre not BlackEnds() -RULE WhiteStraightTwo: +RULE WhiteMoveTwo: [ | bP:1 {}; R:2 {} | ] " . @@ -39,7 +39,7 @@ . " emb wP, bP pre IsSecond(a1) and not BlackEnds() -RULE WhitePawnRightDbl: +RULE WhiteRightPassant: [ | | ] " ... ?..-bP @@ -55,7 +55,7 @@ ... .... " emb wP, bP pre not BlackEnds() -RULE WhitePawnLeftDbl: +RULE WhiteLeftPassant: [ | | ] " ... -bP? @@ -71,10 +71,10 @@ ... .... " emb wP, bP pre not BlackEnds() -RULE BlackDiag: +RULE BlackBeat: [ a, b | bP { a }; wP { b } | - ] -> [ a, b | bP { b } | - ] emb wP, bP pre DiagB(a, b) and not WhiteEnds() -RULE BlackStraight: +RULE BlackMove: [ | R:2 {}; wP:1 {} | ] " bP @@ -86,7 +86,7 @@ bP " emb wP, bP pre not WhiteEnds() -RULE BlackStraightTwo: +RULE BlackMoveTwo: [ | R:2 {}; wP:1 {} | ] " bP @@ -102,7 +102,7 @@ bP " emb wP, bP pre IsSeventh(a3) and not WhiteEnds() -RULE BlackPawnRightDbl: +RULE BlackRightPassant: [ | | ] " ... bP.wP @@ -118,7 +118,7 @@ ... ?... " emb wP, bP pre not WhiteEnds() -RULE BlackPawnLeftDbl: +RULE BlackLeftPassant: [ | | ] " ... wP.bP @@ -140,7 +140,8 @@ 1: :(WhiteEnds()) - :(BlackEnds()); 2: :(BlackEnds()) - :(WhiteEnds()) } - MOVES [WhiteDiag -> 1]; [WhiteStraight -> 1]; [WhiteStraightTwo -> 1] + MOVES [WhiteBeat -> 1]; [WhiteMove -> 1]; [WhiteMoveTwo -> 1]; + [WhiteRightPassant -> 1]; [WhiteLeftPassant -> 1] } LOC 1 { PLAYER 2 @@ -148,7 +149,8 @@ 1: :(WhiteEnds()) - :(BlackEnds()); 2: :(BlackEnds()) - :(WhiteEnds()) } - MOVES [BlackDiag -> 0]; [BlackStraight -> 0]; [BlackStraightTwo -> 0] + MOVES [BlackBeat -> 0]; [BlackMove -> 0]; [BlackMoveTwo -> 0]; + [BlackRightPassant -> 0]; [BlackLeftPassant -> 0] } MODEL [ | | ] " ... ... ... ... Modified: trunk/Toss/www/contact.xml =================================================================== --- trunk/Toss/www/contact.xml 2011-03-12 19:24:32 UTC (rev 1355) +++ trunk/Toss/www/contact.xml 2011-03-13 00:09:53 UTC (rev 1356) @@ -32,46 +32,57 @@ <section title="Game Playing Links"> - <par><a href="http://www.dozingcatsoftware.com/Gridlock/">Gridlock</a><br/> - Gridlock is a collection of open-source board games. It is nice to play - but is does not allow you to change the game in any easy way.</par> + <itemize> + <item><a href="http://www.apronus.com/chess/wbeditor.php">Apronus Chess + Board Editor</a> is our favorite site for simple chess boards. + </item> - <par><br/><a href="http://www.zillions-of-games.com/">Zillions of Games</a><br/> - Zillions of Games is a language for defining games together with a - simulator and a large library of games. It is very nice but unluckily - not open source.</par> + <item><a href="http://www.dozingcatsoftware.com/Gridlock/">Gridlock</a> + is a collection of open-source board games. It is nice to play + but is does not allow you to change the game in any easy way. + </item> - <par><br/><a href="http://www.kurnik.pl/">Kurnik</a><br/> - Kurnik is a polish site on which you can play various games.</par> + <item><a href="http://www.zillions-of-games.com/">Zillions of Games</a> + is a language for defining games together with a simulator and a large + library of games. It is very nice but unluckily not open source. + </item> - <par><br/><a href="http://abstractstrategy.com/main.html">Abstract Strategy - Games</a><br/> Abstract Strategy Games site allows you to learn and - play such games.</par> + <item><a href="http://www.kurnik.pl/">Kurnik</a> + is a polish site on which you can play various games.</item> - <par><br/><a href="http://www.yourturnmyturn.com/">Your Turn My Turn</a><br/> - On Your-Turn-My-Turn you can play various board games online.</par> + <item><a href="http://abstractstrategy.com/main.html">Abstract + Strategy Games</a> site allows you to learn and play such games. + </item> + + <item><a href="http://www.yourturnmyturn.com/">Your Turn My + Turn</a> allows you to play various board games online.</item> + </itemize> </section> <section title="Modelling Links"> - <par><a href="http://edu.kde.org/step/">Step</a><br/> - Step is an open-source physics simulator, a part of the KDE Education - Project. It can be used for simulation of systems with continuous - dynamics.</par> + <itemize> + <item><a href="http://edu.kde.org/step/">Step</a> + is an open-source physics simulator, a part of the KDE Education + Project. It can be used for simulation of systems with continuous + dynamics. + </item> - <par><br/><a href="http://www.iseesystems.com/softwares/Education/StellaSoftware.aspx">STELLA</a><br/> - STELLA is a commercial simulator allowing both continuous and discrete - dynamics.</par> + <item><a href="http://www.iseesystems.com/softwares/Education/StellaSoftware.aspx">STELLA</a> is a commercial simulator allowing both continuous + and discrete dynamics. + </item> - <par><br/><a href="http://ptolemy.eecs.berkeley.edu/">Ptolemy</a><br/> - The Ptolemy project studies modelling, simulation, and design of - concurrent, real-time, embedded systems. This advanced project - allows to use various models of computation that govern - the interactions between components.</par> + <item><a href="http://ptolemy.eecs.berkeley.edu/">Ptolemy</a> project + studies modelling, simulation, and design of concurrent, real-time, + embedded systems. This advanced project allows to use various models + of computation that govern the interactions between components. + </item> - <par><br/><a href="http://www.microsoft.com/esp/about_esp/overview.htm" - >Microsoft ESP</a><br/>ESP is a visual simulation platform - that applies game-based technology to some more complex problems.</par> + <item><a href="http://www.microsoft.com/esp/about_esp/overview.htm" + >Microsoft ESP</a> is a visual simulation platform + that applies game-based technology to some more complex problems. + </item> + </itemize> </section> <section title="Team"> @@ -85,7 +96,7 @@ <item>Michał Wójcik</item> </itemize> - <par>Friends who helped us a lot with dicussion and code.</par> + <par>Friends who helped us a lot with discussion and code.</par> <itemize> <item>Dietmar Berwanger</item> <item>Matko Botincan</item> Modified: trunk/Toss/www/create.xml =================================================================== --- trunk/Toss/www/create.xml 2011-03-12 19:24:32 UTC (rev 1355) +++ trunk/Toss/www/create.xml 2011-03-13 00:09:53 UTC (rev 1356) @@ -20,7 +20,7 @@ </itemize> If you plan to make small changes or an easy experiment, the GUI might be the better option. For larger or completely new games, it is more - convenient to edit the files in your favourite text editor. + convenient to edit the files in your favorite text editor. </section> <section title="Creating Games in Toss GUI"> @@ -28,7 +28,7 @@ <itemize> <item><em>Download</em> Toss from the <a href="http://sourceforge.net/project/showfiles.php?group_id=115606"> - Sourceforge Download Page</a>.</item> + SourceForge Download Page</a>.</item> <item><em>Run Toss</em> by clicking <em>Toss.py</em>. You can start by opening a file from the <em>examples</em> directory.</item> @@ -47,7 +47,7 @@ form than from the GUI. To understand the meaning of the fields in the text file, you should probably first be acquainted with Toss (e.g. go through the tutorial above) and at least skim through - the <a href="reference/reference.pdf">referece.pdf</a> file, look + the <a href="reference/reference.pdf">reference.pdf</a> file, look at our <a href="docs.html">documentation</a>. After this, you can simply edit the .toss file, maybe starting with one of these. </par> Modified: trunk/Toss/www/docs.xml =================================================================== --- trunk/Toss/www/docs.xml 2011-03-12 19:24:32 UTC (rev 1355) +++ trunk/Toss/www/docs.xml 2011-03-13 00:09:53 UTC (rev 1356) @@ -5,7 +5,7 @@ <personal> <title lang="en">Documentation</title> - <title lang="de">Dokumantation</title> + <title lang="de">Dokumentation</title> <history> <link id="docs" href="/docs.html">Documentation</link> </history> Modified: trunk/Toss/www/ideas.xml =================================================================== --- trunk/Toss/www/ideas.xml 2011-03-12 19:24:32 UTC (rev 1355) +++ trunk/Toss/www/ideas.xml 2011-03-13 00:09:53 UTC (rev 1356) @@ -81,8 +81,8 @@ project, but it can become very interesting in the last phase! <br/><br/></par> <par><em>Possible Mentors (in order of preference):</em> - Łukasz Stafiniak, Łukasz Kaiser, - Michał Wójcik, Tobias Ganzow + Michał Wójcik, Tobias Ganzow, + Łukasz Stafiniak, Łukasz Kaiser </par> </section> @@ -204,8 +204,8 @@ defined in GDL, the Game Description Language used in GGP Competitions, to the Toss format. This allows to compete against GGP players, and we even won quite a few games already! But the GGP translation is not - complete and some games are translated to very inefficient variants, - on which it is almost impossible to play well. The idea is to improve + complete, games with recursive definitions cannot be translated yet, + and some translated definitions can be large. The idea is to improve this, but also to cooperate with the GGP guys, especially with the <a href="http://code.google.com/p/ggp-galaxy/">GGP Galaxy Project</a>, to make General Game Playing truly accessible for everyone! @@ -238,4 +238,76 @@ </section> + <section title="Idea: Feature Learning"> + <par><em>Description and Goals.</em> + Currently, Toss generates functions for position evaluation form + the payoffs and rules of the game in one way, fixed in the code. + It would be better to use a weighted mix of various evaluation functions + or their parts (which we call <em>features</em>) and learn + the appropriate weights by playing them against each other. + We expect that this will improve Toss strength significantly. + <br/><br/></par> + <par><em>Deliverables.</em> + By mid-term the basic framework for feature learning should be present, + and demonstrated e.g. by learning weights for pieces in chess. By the + end, the goals is to replace the default play mode of Toss by one which + uses feature learning. + <br/><br/></par> + <par><em>Modules (in planned construction order).</em> + <enumerate> + <item>Implement weighted mixing of heuristics (easy)</item> + <item>Hook up multi-dimensional optimization (medium, use GSL?)</item> + <item>Test weight learning, minimize needed playouts (easy)</item> + <item>Create features from various game parts (hard)</item> + <item>Memorize learned weights, replace default playout (medium)</item> + </enumerate> + <br/></par> + <par><em>Needed Skills and Difficulty.</em> + This is a medium to hard project – a lot depends how many + features will be generated and how, but even using just a few should + already improve playing strength. OCaml experience is required. + <br/><br/></par> + <par><em>Possible Mentors (in order of preference):</em> + Łukasz Stafiniak, Łukasz Kaiser + </par> + </section> + + <section title="Idea: Games with Imperfect Information"> + <par><em>Description and Goals.</em> + At present Toss only allows to define games with perfect information, + i.e. the complete state is known to all players. The idea to extend + Toss to imperfect information games is based on <em>views</em>, which + are tuples of formulas which convert the true state into a new structure, + which the player sees. Such extension should allow to define some well + know games with imperfect information such as a card game or Minesweeper. + <br/><br/></par> + <par><em>Deliverables.</em> + To add views it is necessary to extend the core game definition in Arena, + and to adapt many things which rely on this. Such extension, together + with a toy example and of course preserving the current functionality + should be ready by mid-term. After that, it will be necessary to adapt + automatic playing algorithms to take imperfect information into account, + and at least one full game with imperfect information should be defined + by the end of the project. + <br/><br/></par> + <par><em>Modules (in planned construction order).</em> + <enumerate> + <item>Add views to Arena, update everything (medium)</item> + <item>Adapt interfaces to account for views (medium)</item> + <item>Testing, a toy imperfect information game (easy)</item> + <item>Generalize automatic play to imperfect information (hard)</item> + <item>Define a full game with imperfect information (medium)</item> + </enumerate> + <br/></par> + <par><em>Needed Skills and Difficulty.</em> + Good knowledge of OCaml and some understanding of games with + imperfect information will be necessary. This project is medium + to hard, depending on how much effort one makes to adapt automatic play. + <br/><br/></par> + <par><em>Possible Mentors (in order of preference):</em> + Łukasz Kaiser, Dietmar Berwanger, Tobias Ganzow + </par> + </section> + + </personal> Modified: trunk/Toss/www/index.xml =================================================================== --- trunk/Toss/www/index.xml 2011-03-12 19:24:32 UTC (rev 1355) +++ trunk/Toss/www/index.xml 2011-03-13 00:09:53 UTC (rev 1356) @@ -14,7 +14,7 @@ For example, did you ever wonder how your favorite game would feel if you removed the middle of the board? With Toss, it is easy to experiment! And after your game is ready, you can play it online - and compete with friends! + against a computer or compete with your friends! </par> </section> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-12 19:24:46
|
Revision: 1355 http://toss.svn.sourceforge.net/toss/?rev=1355&view=rev Author: lukstafi Date: 2011-03-12 19:24:32 +0000 (Sat, 12 Mar 2011) Log Message: ----------- TossFullTest: new test modules, put module tests together. DiscreteRule: remember which LHS tuples required to be absent (useful for analysis); fixes in rule-from-precondition generation. FormulaOps: new partial simplification functions. GGP/tests: targets for GDL translation and GameSimpl simplification tests. GDL translation: much better branch pruning, fixes in erasure branch generation. GameSimpl: specification; removing redundant equivalent relations (still broken effect on rule LHS structures). Various modules: helper functions. Modified Paths: -------------- trunk/Toss/Arena/Arena.ml trunk/Toss/Arena/Arena.mli trunk/Toss/Arena/ContinuousRule.ml trunk/Toss/Arena/ContinuousRule.mli trunk/Toss/Arena/DiscreteRule.ml trunk/Toss/Arena/DiscreteRule.mli trunk/Toss/Formula/Aux.ml trunk/Toss/Formula/Aux.mli trunk/Toss/Formula/FormulaOps.ml trunk/Toss/Formula/FormulaOps.mli trunk/Toss/GGP/GDL.ml trunk/Toss/GGP/GDLTest.ml trunk/Toss/GGP/examples/breakthrough.gdl trunk/Toss/Server/ServerGDLTest.in trunk/Toss/TossFullTest.ml trunk/Toss/TossTest.ml Added Paths: ----------- trunk/Toss/GGP/GameSimpl.ml trunk/Toss/GGP/GameSimpl.mli trunk/Toss/GGP/GameSimplTest.ml trunk/Toss/GGP/tests/ trunk/Toss/GGP/tests/breakthrough-raw.toss trunk/Toss/GGP/tests/breakthrough-simpl.toss trunk/Toss/GGP/tests/connect5-raw.toss trunk/Toss/GGP/tests/connect5-simpl.toss Modified: trunk/Toss/Arena/Arena.ml =================================================================== --- trunk/Toss/Arena/Arena.ml 2011-03-12 17:51:51 UTC (rev 1354) +++ trunk/Toss/Arena/Arena.ml 2011-03-12 19:24:32 UTC (rev 1355) @@ -377,6 +377,20 @@ } in (game, state), player +let map_to_formulas f game = + {game with + rules = List.map (fun (rn, r) -> + rn, ContinuousRule.map_to_formulas f r + ) game.rules; + graph = Array.map (fun loc -> + {loc with + payoffs = + Array.map (FormulaOps.map_to_formulas_expr f) loc.payoffs; + }) game.graph; + defined_rels = List.map (fun (drel, (args, def)) -> + drel, (args, f def)) game.defined_rels; + } + (* ------------------ REQUESTS TO THE ARENA USED IN OPERATION --------------- *) (* Location of a structure: either arena or left or right-hand side of a rule *) Modified: trunk/Toss/Arena/Arena.mli =================================================================== --- trunk/Toss/Arena/Arena.mli 2011-03-12 17:51:51 UTC (rev 1354) +++ trunk/Toss/Arena/Arena.mli 2011-03-12 19:24:32 UTC (rev 1355) @@ -108,6 +108,8 @@ val process_definition : ?extend_state:game * game_state -> definition list -> game * game_state +val map_to_formulas : (Formula.formula -> Formula.formula) -> game -> game + (** ------------------ REQUESTS TO THE ARENA USED IN OPERATION --------------- *) (** Location of a structure: either arena or left or right-hand side of a rule *) Modified: trunk/Toss/Arena/ContinuousRule.ml =================================================================== --- trunk/Toss/Arena/ContinuousRule.ml 2011-03-12 17:51:51 UTC (rev 1354) +++ trunk/Toss/Arena/ContinuousRule.ml 2011-03-12 19:24:32 UTC (rev 1355) @@ -41,7 +41,7 @@ -(* ------------------ APPLYING FUNCTIONS TO SIDE STRUCTURES ----------------- *) +(* ------------------ APPLYING FUNCTIONS TO PARTS OF A RULE ----------------- *) (* Apply [f] to left (if [to_left]) or right side of the given named rule. Return the new rule and an additional result which [f] returns. *) @@ -59,6 +59,16 @@ let lhs r = r.discrete.DiscreteRule.lhs_struc let rhs r = r.discrete.DiscreteRule.rhs_struc +let map_to_formulas f r = + {r with + discrete = {r.discrete with DiscreteRule.pre = + f r.discrete.DiscreteRule.pre}; + compiled = {r.compiled with DiscreteRule.lhs_form = + f r.compiled.DiscreteRule.lhs_form}; + inv = f r.inv; + post = f r.post; + } + (* ---------------------- FINDING APPLICABLE MATCHES ------------------------ *) (* Find all matches of [r] in [struc] which satisfy [r]'s precondition. *) Modified: trunk/Toss/Arena/ContinuousRule.mli =================================================================== --- trunk/Toss/Arena/ContinuousRule.mli 2011-03-12 17:51:51 UTC (rev 1354) +++ trunk/Toss/Arena/ContinuousRule.mli 2011-03-12 19:24:32 UTC (rev 1355) @@ -54,8 +54,8 @@ val lhs : rule -> Structure.structure val rhs : rule -> Structure.structure +val map_to_formulas : (Formula.formula -> Formula.formula) -> rule -> rule - (** {2 Finding applicable matches} *) Modified: trunk/Toss/Arena/DiscreteRule.ml =================================================================== --- trunk/Toss/Arena/DiscreteRule.ml 2011-03-12 17:51:51 UTC (rev 1354) +++ trunk/Toss/Arena/DiscreteRule.ml 2011-03-12 19:24:32 UTC (rev 1355) @@ -35,6 +35,10 @@ lhs_elem_names : elem_names; lhs_elem_inv_names : elem_inv_names; lhs_elem_vars : string list; + lhs_neg_tups : (string * int array list) list; + (* Tuples of relations over the LHS structure elements that are + required to be absent for embedding; this is "meta-data" not + needed for matching and rewriting but useful for other purposes. *) lhs_form : Formula.formula; (* gets instantiated in the model *) (* the precondition [pre] is compiled as part of [lhs_form] *) @@ -558,21 +562,6 @@ let signat = List.filter (fun (rel,_) -> special_rel_of rel = None && not (List.mem_assoc rel defined_rels)) signat in - let expand_def_rels rel = - if List.mem_assoc rel defined_rels then - let args, rphi = List.assoc rel defined_rels in - List.map fst (List.filter (fun (rel, ar) -> - let selector = Structure.free_for_rel rel ar in - let res = Solver.M.check selector rphi in - (* {{{ log entry *) - if !debug_level > 3 then ( - Printf.printf "compile_rule.expand_def_rels: %s on %s = %b\n%!" - rel (Structure.str selector) res - ); - (* }}} *) - res - ) signat) - else [rel] in let expand_defrel_tups (drel, tups) = if List.mem_assoc drel defined_rels then @@ -613,7 +602,23 @@ else [drel, tups] in (* expand defined rels in embedding list *) let base_emb_rels = - unique (=) (concat_map expand_def_rels rule_src.emb_rels) in + let expand_def_rels rel = + if List.mem_assoc rel defined_rels then + let args, rphi = List.assoc rel defined_rels in + List.map fst (List.filter (fun (rel, ar) -> + let selector = Structure.free_for_rel rel ar in + let res = Solver.M.check selector rphi in + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf "compile_rule.expand_def_rels: %s on %s = %b\n%!" + rel (Structure.str selector) res + ); + (* }}} *) + res + ) signat) + else [rel] in + unique(*_sorted *) (=) + (concat_map expand_def_rels rule_src.emb_rels) in (* {{{ log entry *) if !debug_level > 1 then ( Printf.printf "compile_rule: emb=%s -- base_emb_rels=%s\n%!" @@ -723,8 +728,8 @@ let lhs_opt_rels, lhs_pos_tups, lhs_pos_expanded = compile_opt_rels lhs_rels in let lhs_all_tups n = - List.map Array.of_list (Aux.product - (Aux.fold_n (fun acc -> lhs_elems::acc) [] n)) in + List.map Array.of_list (Aux.product ( + Aux.fold_n (fun acc -> lhs_elems::acc) [] n)) in (* let lhs_all_tups n = List.fold_left (fun tups tup -> STups.add tup tups) @@ -818,8 +823,8 @@ ) tups) rhs_rels in let rhs_all_tups n = - List.map Array.of_list (Aux.product - (Aux.fold_n (fun acc -> rhs_elems::acc) [] n)) in + List.map Array.of_list (Aux.product ( + Aux.fold_n (fun acc -> rhs_elems::acc) [] n)) in (* a tuple is negative when it has to be removed: it is in $\tau_e$ and in the LHS, but it does not occur on the RHS even optionally *) let rhs_neg_tuples = @@ -861,6 +866,7 @@ lhs_elem_names = lhs_elem_names; lhs_elem_inv_names = lhs_elem_inv_names; lhs_elem_vars = lhs_elem_vars; + lhs_neg_tups = lhs_neg_tups; lhs_form = emb; rhs_elem_names = rule_src.rhs_struc.Structure.names; rhs_elem_vars = rhs_elem_vars; @@ -887,26 +893,32 @@ (* Build a rule by translating the "add" list into the RHS structure directly, and separating out from a precondition the LHS structure - over the [struc_vars] variables. All relations are - considered embedded. (Obviously, not all rules can be generated in - this way.) *) -let translate_from_precond ~precond ~add ~embed ~struc_elems = + over the [struc_vars] variables. Only and all the [emb_rels] relations + are embedded (usually the fluents). (Not all rules can be generated + using this function.) Caution: simplifies the precondition. + + The partition of embedded relations into positive and negative + tuples (literals) is extracted from the precondition. If the + partition does not cover all tuples, fail. *) +let translate_from_precond ~precond ~add ~emb_rels ~signat ~struc_elems = let rhs_names = Aux.unique_sorted (Aux.concat_map (fun (_,arg) -> Array.to_list arg) add) in assert (Aux.list_diff rhs_names struc_elems = []); let rewritable args = Aux.array_for_all (fun v -> List.mem (Formula.var_str v) struc_elems) args in - let conjs = FormulaOps.flatten_ands precond in - let literals, conjs = Aux.partition_map (function + let conjs = + FormulaOps.flatten_ands (FormulaOps.remove_redundant precond) in + let posi, conjs = Aux.partition_map (function | Formula.Rel (rel, args) when rewritable args -> - Left (Left (rel,args)) - | Not (Formula.Rel (rel, args)) when rewritable args -> - Left (Right (rel,args)) + Left (rel,args) | phi -> Right phi) conjs in - let posi, nega = Aux.partition_choice literals in - (* FIXME: TODO: check and at least warn when [nega] is smaller than - the complement of [posi] over embedded rels *) + let nega, conjs = Aux.partition_map (function + | Formula.Not (Formula.Rel (rel, args)) + when List.mem rel emb_rels && rewritable args -> + Left (rel,args) + | phi -> Right phi) conjs in + let lhs_extracted = posi @ nega in let precond = Formula.And conjs in let fvars = FormulaOps.free_vars precond in let local_vars = @@ -915,12 +927,39 @@ let precond = if local_vars = [] then precond else Formula.Ex (local_vars, precond) in - let emb_rels = Aux.list_inter embed - (Aux.unique_sorted - (List.map fst add @ List.map fst (posi @ nega))) in let posi_s = List.map (fun (rel, args) -> rel, Array.map Formula.var_str args) posi in + let opt_s = + Aux.concat_map (fun rel -> + try + let arity = signat rel in + let tups = + List.map + Array.of_list + (*Aux.array_map_of_list Formula.var_str*) + (Aux.product ( + Aux.fold_n (fun acc -> struc_elems::acc) [] arity)) in + let extracted = + List.map (Array.map Formula.var_str) + (Aux.assoc_all rel lhs_extracted) in + (* {{{ log entry *) + if !debug_level > 4 then ( + Printf.printf "translate_from_precond: _opt_%s -- extracted %s -- \ + remaining %s\n%!" rel + (String.concat "; " + (List.map (fun args -> + String.concat " " (Array.to_list args)) extracted)) + (String.concat "; " + (List.map (fun args -> + String.concat " " (Array.to_list args)) + (Aux.list_diff tups extracted))) + ); + (* }}} *) + let tups = Aux.list_diff tups extracted in + List.map (fun args -> "_opt_"^rel, args) tups + with Not_found -> []) + emb_rels in let rhs_struc, struc_elems = List.fold_left (fun (rhs_struc, struc_elems) name -> let rhs_struc, elem = @@ -933,7 +972,7 @@ let lhs_struc = rhs_struc in let rhs_struc = add_rels rhs_struc add in let lhs_struc = add_rels lhs_struc posi_s in - (* no relations are optional, righ? *) + let lhs_struc = add_rels lhs_struc opt_s in { lhs_struc = lhs_struc; rhs_struc = rhs_struc; @@ -942,6 +981,7 @@ pre = precond; } + (** {2 Printing and parsing.} *) let matching_str matching = Modified: trunk/Toss/Arena/DiscreteRule.mli =================================================================== --- trunk/Toss/Arena/DiscreteRule.mli 2011-03-12 17:51:51 UTC (rev 1354) +++ trunk/Toss/Arena/DiscreteRule.mli 2011-03-12 19:24:32 UTC (rev 1355) @@ -30,14 +30,19 @@ lhs_elem_names : elem_names; lhs_elem_inv_names : elem_inv_names; lhs_elem_vars : string list; + lhs_neg_tups : (string * int array list) list; + (** Tuples of relations over the LHS structure elements that are + required to be absent for embedding; this is "meta-data" not + needed for matching and rewriting but useful for other + purposes. *) lhs_form : Formula.formula; - (* gets instantiated in the model *) - (* the precondition [pre] is compiled as part of [lhs_form] *) + (** gets instantiated in the model *) + (** the precondition [pre] is compiled as part of [lhs_form] *) rhs_elem_names : elem_names; - rhs_elem_vars : string list; (* replaces the embedding *) - rhs_pos_tuples : (string * var_tuples) list; (* gets added *) - rhs_neg_tuples : (string * var_tuples) list; (* gets removed *) - rlmap : (string * string) list option; (* rule_s on variables (?) *) + rhs_elem_vars : string list; (** replaces the embedding *) + rhs_pos_tuples : (string * var_tuples) list; (** gets added *) + rhs_neg_tuples : (string * var_tuples) list; (** gets removed *) + rlmap : (string * string) list option; (** rule_s on variables *) } val elemvar_of_elem : elem_inv_names -> int -> string @@ -113,9 +118,21 @@ val changeable_rels : rule_obj list -> string list +(** Build a rule by translating the "add" list into the RHS structure + directly, and separating out from a precondition the LHS structure + over the [struc_vars] variables. Only and all the [emb_rels] + relations are embedded (usually the fluents). (Not all rules can be + generated using this function.) Caution: simplifies the + precondition. + + The partition of embedded relations into positive and negative + tuples (literals) is extracted from the precondition. If the + partition does not cover all tuples, fail. *) val translate_from_precond : precond:Formula.formula -> add:(string * string array) list -> - embed:string list -> struc_elems:string list -> rule + (* del:(string * string array) list -> *) + emb_rels:string list -> signat:(string -> int) -> + struc_elems:string list -> rule (** {2 Printing.} *) val matching_str : matching -> string Modified: trunk/Toss/Formula/Aux.ml =================================================================== --- trunk/Toss/Formula/Aux.ml 2011-03-12 17:51:51 UTC (rev 1354) +++ trunk/Toss/Formula/Aux.ml 2011-03-12 19:24:32 UTC (rev 1355) @@ -36,6 +36,14 @@ let intmap_filter p m = IntMap.fold (fun k v acc -> if p k v then (k,v)::acc else acc) m [] +let int_pow x n = + let rec aux acc res n = + if n = 0 then res + else if n mod 2 = 0 then aux (acc*acc) res (n/2) + else aux (acc*acc) (res*acc) (n/2) in + if n < 0 then 0 + else aux x 1 n + let is_digit c = (c = '0') || (c = '1') || (c = '2') || (c = '3') || (c = '4') || (c = '5') || (c = '6') || (c = '7') || (c = '8') || (c = '9') @@ -44,6 +52,12 @@ let snd3 (_,a,_) = a let trd3 (_,_,a) = a +module BasicOperators = struct + let (-|) f g x = f (g x) +end + +open BasicOperators + (* {2 Helper functions on lists and other functions lacking from the standard library.} *) Modified: trunk/Toss/Formula/Aux.mli =================================================================== --- trunk/Toss/Formula/Aux.mli 2011-03-12 17:51:51 UTC (rev 1354) +++ trunk/Toss/Formula/Aux.mli 2011-03-12 19:24:32 UTC (rev 1355) @@ -21,6 +21,14 @@ val intmap_filter : (int -> 'a -> bool) -> 'a IntMap.t -> (int * 'a) list +module BasicOperators : +sig + (** Function composition. *) + val ( -| ) : ('a -> 'b) -> ('c -> 'a) -> 'c -> 'b +end + +val int_pow : int -> int -> int + val is_digit : char -> bool val fst3 : 'a * 'b * 'c -> 'a Modified: trunk/Toss/Formula/FormulaOps.ml =================================================================== --- trunk/Toss/Formula/FormulaOps.ml 2011-03-12 17:51:51 UTC (rev 1354) +++ trunk/Toss/Formula/FormulaOps.ml 2011-03-12 19:24:32 UTC (rev 1355) @@ -142,7 +142,19 @@ | Sum (vs, phi, r) -> Sum (vs, map_to_literals f g phi, map_to_literals_expr f g r) +(* Map [f] to top-level formulas in the real expression ([Char]s and + [Sum] guards). *) +let rec map_to_formulas_expr f = function + | RVar _ | Const _ | Fun _ as x -> x + | Times (r1, r2) -> + Times (map_to_formulas_expr f r1, map_to_formulas_expr f r2) + | Plus (r1, r2) -> + Plus (map_to_formulas_expr f r1, map_to_formulas_expr f r2) + | Char (phi) -> Char (f phi) + | Sum (vs, phi, r) -> + Sum (vs, f phi, map_to_formulas_expr f r) + (* Map [f] to all atoms in the given formula. *) let map_to_atoms_full f g phi = map_to_literals (function Not (x) -> Not (f x) | x -> f x) g phi @@ -673,12 +685,62 @@ | Not phi -> Not (flatten_formula phi) | (Rel _ | Eq _ | In _ | RealExpr _) as atom -> atom -(* Formula as a list of conjuncts. *) +let rec flatten_ors = function + | Or disjs -> Aux.concat_map flatten_ors disjs + | phi -> [phi] + +(* Formula as a list of conjuncts, with one level of distributing + negation over disjunction and pushing quantifiers inside. *) let rec flatten_ands = function - | Formula.And conjs -> Aux.concat_map flatten_ands conjs + | And conjs -> Aux.concat_map flatten_ands conjs + | Not (Or disjs) -> + List.map (fun d -> Not d) + (Aux.concat_map flatten_ors disjs) + | All (vs, phi) -> + List.map (fun phi -> All (vs, phi)) (flatten_ands phi) + | Ex (vs, phi) as arg -> + (match flatten_ands phi with + | [] -> [] | [_] -> [arg] + | conjs -> + let free_conjs, bound_conjs = List.partition (fun conj -> + Aux.list_inter vs (free_vars conj) = []) conjs in + let bound_phi = match bound_conjs with + | [phi] -> phi | _ -> And bound_conjs in + free_conjs @ [Ex (vs, bound_phi)]) | phi -> [phi] +(* Remove literals from disjunctions in positive positions + (conjunctions in negative positions) that already occur conjoined + to the disjucntion. (Does not descend the real part currently.) *) +let remove_redundant phi = + let rec aux base neg = function + | And conjs when not neg -> + let more_base, subtasks = List.partition (function + | Rel _ | Not (Rel _) -> true | _ -> false) conjs in + And (more_base @ List.map (aux (more_base @ base) neg) subtasks) + | Or conjs when neg -> + let more_base, subtasks = List.partition (function + | Rel _ | Not (Rel _) -> true | _ -> false) conjs in + Or (more_base @ List.map (aux (more_base @ base) neg) subtasks) + | Or disjs (* when not neg *) -> + let literals, subtasks = List.partition (function + | Rel _ | Not (Rel _) -> true | _ -> false) disjs in + let disjs = + Aux.list_diff literals base @ List.map (aux base neg) subtasks in + (match disjs with [disj] -> disj | _ -> Or disjs) + | And disjs (* when neg *) -> + let literals, subtasks = List.partition (function + | Rel _ | Not (Rel _) -> true | _ -> false) disjs in + let disjs = + Aux.list_diff literals base @ List.map (aux base neg) subtasks in + (match disjs with [disj] -> disj | _ -> And disjs) + | Not phi -> Not (aux base (not neg) phi) + | Ex (vs, phi) -> Ex (vs, aux base neg phi) + | All (vs, phi) -> All (vs, aux base neg phi) + | phi -> phi in + aux [] false (flatten_formula phi) + (* Compute size of a formula (currently w/o descending the real part). *) let rec size = function | Or js | And js -> List.fold_left (+) 1 (List.map size js) Modified: trunk/Toss/Formula/FormulaOps.mli =================================================================== --- trunk/Toss/Formula/FormulaOps.mli 2011-03-12 17:51:51 UTC (rev 1354) +++ trunk/Toss/Formula/FormulaOps.mli 2011-03-12 19:24:32 UTC (rev 1355) @@ -26,6 +26,10 @@ val map_to_literals_expr : (formula -> formula) -> (real_expr -> real_expr) -> real_expr -> real_expr +(** Map [f] to top-level formulas in the real expression ([Char]s and + [Sum] guards). *) +val map_to_formulas_expr : (formula -> formula) -> real_expr -> real_expr + (** Map [f] to all atoms in the given formula. *) val map_to_atoms_full : (formula -> formula) -> (real_expr -> real_expr) -> formula -> formula @@ -84,9 +88,15 @@ (** Flatten "and"s and "or"s in a formula -- i.e. associativity. *) val flatten_formula : formula -> formula -(** Formula as a list of conjuncts. *) +(** Formula as a list of conjuncts, with one level of distributing + negation over disjunction and pushing quantifiers inside. *) val flatten_ands : formula -> formula list +(** Remove literals from disjunctions in positive positions + (conjunctions in negative positions) that already occur conjoined + to the disjucntion. (Does not descend the real part currently.) *) +val remove_redundant : formula -> formula + (** Compute size of a formula (currently w/o descending the real part). *) val size : formula -> int Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-03-12 17:51:51 UTC (rev 1354) +++ trunk/Toss/GGP/GDL.ml 2011-03-12 19:24:32 UTC (rev 1355) @@ -320,21 +320,17 @@ negated subformulas are "let free"). (7f4) Drop the erasure branches that contradict the "legal" - condition of their rule. + condition of their rule. (Add the "legal" condition for early pruning.) (7f5) Redistribute the erasure branches in case they were substituted with the "not distinct" unifier to proper equivalence classes (remove equivalence classes that become empty). - (7g) Instantiate remaining unfixed variables. Implementation TODO. + (7g) Instantiate remaining unfixed variables: Duplicate non-frame + rules with unfixed variables for each instantiation of the unfixed + variables warranted by the aggregate playout. (Perhaps can be done + "symbolically" to avoid explosion.) - (7g1) Duplicate non-frame rules with unfixed variables for each - instantiation of the unfixed variables warranted by the aggregate - playout. (Perhaps can be done "symbolically" to avoid explosion.) - - (7g2) Then, add instantiations of frame rules for each case their - head term unifies with one from all the non-frame rules. - (7h) Introduce a new element variable for each class of "next" and "true" terms equal modulo mask (i.e. there is a mask matching them and they differ only at-or-below metavariables). (Remember the @@ -544,8 +540,10 @@ (** Generate all tuples for equivalences, to faciliate further transformations of formulas in the game definition (outside of translation). *) -let equivalences_all_tuples = ref false +let equivalences_all_tuples = ref false (* true *) +open Aux.BasicOperators + type term = | Const of string | Var of string @@ -1502,7 +1500,7 @@ if more_state = [] then static_rels, state_rels else separate static (more_state @ state_rels) in let static_rels, state_rels = - separate (List.map (fun ((r,_),_,_)->r) rules) + separate (Aux.unique (=) (List.map (fun ((r,_),_,_)->r) rules)) ["init"; "does"; "true"; "next"; "terminal"; "goal"] in let static_rules, dynamic_rules = List.partition (fun ((rel,_),_,_) -> List.mem rel static_rels) rules in @@ -1707,32 +1705,7 @@ let translate_branches struc masks playout_terms static_rnames dyn_rels (brs : exp_def_branch list) = (* 7i *) - let pos_state_terms = - List.fold_left (fun acc -> function - | [next_arg], body, _ -> - let res = - List.fold_left (fun acc -> function - | "true", [true_arg] -> Terms.add true_arg acc - | "true", _ -> assert false - | _ -> acc) acc body in - if next_arg = Const "_IGNORE_RHS_" - then res - else Terms.add next_arg res - | _ -> assert false - ) Terms.empty brs in - let pos_state_terms = Terms.elements pos_state_terms in - (* {{{ log entry *) - if !debug_level > 2 then ( - Printf.printf "pos_state_terms: %s\n%!" - (String.concat ", " (List.map term_str pos_state_terms)) - ); - (* }}} *) - let pos_state_subterms = - Aux.concat_map (fun term -> - let mask, sb, m_sb, blanked = term_to_blank masks term in - List.map (fun (v,t) -> t, (mask, v, term)) sb - ) pos_state_terms in - let pos_conjs_4a (rel, args) = + let pos_conjs_4a pos_state_subterms (rel, args) = let ptups = List.map (fun arg -> Aux.assoc_all arg pos_state_subterms) args in (* {{{ log entry *) @@ -1760,7 +1733,8 @@ ); (* }}} *) res in - let neg_conjs_4a neg_state_terms neg_state_subterms (rel, args) = + let neg_conjs_4a pos_state_subterms + neg_state_terms neg_state_subterms (rel, args) = let ptups = List.map (fun arg -> Aux.assoc_all arg pos_state_subterms @ Aux.assoc_all arg neg_state_subterms) args in @@ -1785,18 +1759,9 @@ (* }}} *) res in (* 7i-4b *) - let pos_path_subterms = - Aux.concat_map (fun term -> - let mask, sb, m_sb, blanked = term_to_blank masks term in - Aux.map_some (function - | v, Var t -> - Some ((mask, v), (t, term)) - | _ -> None) sb - ) pos_state_terms in - let pos_path_subterms = Aux.collect pos_path_subterms in let constrained_vars = ref [] in - let pos_conjs_4b = - Aux.concat_map (fun ((mask, v), terms) -> + let pos_conjs_4b pos_path_subterms = + Aux.unique_sorted (Aux.concat_map (fun ((mask, v), terms) -> let rname = "EQ___" ^ term_to_name mask ^ "_" ^ v in let terms = Aux.collect terms in Aux.concat_map (fun (_,terms) -> @@ -1817,9 +1782,8 @@ | v::vs -> List.map (fun w -> [|v; w|]) vs in List.map (fun tup -> Formula.Rel (rname, tup)) tups ) terms - ) pos_path_subterms in - let pos_conjs_4b = Aux.unique_sorted pos_conjs_4b in - let neg_conjs_4b nterm = + ) pos_path_subterms) in + let neg_conjs_4b pos_path_subterms nterm = let nmask, nsb, _, _ = term_to_blank masks nterm in let _,ntossvar = toss_var masks nterm in Aux.concat_map (fun ((mask, v), terms) -> @@ -1839,25 +1803,65 @@ if !equivalences_all_tuples then Aux.concat_map - (fun v -> [[|v; ntossvar|]; [|ntossvar; v|]]) tossvars + (fun v -> + if v = ntossvar then [] + else [[|v; ntossvar|]; [|ntossvar; v|]]) tossvars else - List.map (fun v -> [|v; ntossvar|]) tossvars in + Aux.map_some (fun v -> + if v = ntossvar then None + else Some [|v; ntossvar|]) tossvars in List.map (fun tup -> Formula.Rel (rname, tup)) tups | _ -> [] ) pos_path_subterms in + (* calculate state terms twice: before and after filtering branches *) + let pos_state_terms = + List.fold_left (fun acc -> function + | [next_arg], body, _ -> + let res = + List.fold_left (fun acc -> function + | "true", [true_arg] -> Terms.add true_arg acc + | "true", _ -> assert false + | _ -> acc) acc body in + if next_arg = Const "_IGNORE_RHS_" + then res + else Terms.add next_arg res + | _ -> assert false + ) Terms.empty brs in + let pos_state_terms = Terms.elements pos_state_terms in + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf "pos_state_terms: %s\n%!" + (String.concat ", " (List.map term_str pos_state_terms)) + ); + (* }}} *) + let pos_state_subterms = + Aux.concat_map (fun term -> + let mask, sb, m_sb, blanked = term_to_blank masks term in + List.map (fun (v,t) -> t, (mask, v, term)) sb + ) pos_state_terms in + let pos_path_subterms = + Aux.concat_map (fun term -> + let mask, sb, m_sb, blanked = term_to_blank masks term in + Aux.map_some (function + | v, Var t -> + Some ((mask, v), (t, term)) + | _ -> None) sb + ) pos_state_terms in + let pos_path_subterms = Aux.collect pos_path_subterms in + (* only compute the static part to filter-out inconsistent branches *) + let pconjs_4b = pos_conjs_4b pos_path_subterms in let brs = Aux.map_some (function - | [next_arg],body,neg_body -> - let phi, lvars = - if next_arg = Const "_IGNORE_RHS_" then [], ref [] + | [next_arg],body,neg_body as br -> + let phi = + if next_arg = Const "_IGNORE_RHS_" then [] else let mask, sb, m_sb, blanked = term_to_blank masks next_arg in let rname = term_to_name mask in let _, svar = toss_var masks next_arg in - if List.mem svar !constrained_vars then [], ref [] + if List.mem svar !constrained_vars then [] else let phi = Formula.Rel (rname, [|svar|]) in - let lvars = ref [svar] in - [phi], lvars in + [phi] in let conjs = Aux.concat_map (fun (rel, args as fact) -> if rel = "true" then @@ -1866,7 +1870,6 @@ let mask, sb, m_sb, blanked = term_to_blank masks true_arg in let rname = term_to_name mask in let _, svar = toss_var masks true_arg in - lvars := svar :: !lvars; let phi = Formula.Rel (rname, [|svar|]) in let conjs = Aux.map_some (function @@ -1878,12 +1881,12 @@ then conjs else [phi] else if List.mem rel static_rnames then (* 7i-4a *) - pos_conjs_4a fact + pos_conjs_4a pos_state_subterms fact else [] ) body in - (* only to prune early -- we cannot get more than negated - relations for positive elements, because stuff related to - negative elements is under common negations/disjunctions *) + (* to prune early, we cannot get more than negated relations for + positive elements, because stuff related to negative elements + is under common negations/disjunctions *) let neg_conjs = Aux.concat_map (function | _, [rel, args as fact] -> @@ -1892,7 +1895,8 @@ then [] else if List.mem rel static_rnames then (* 7i-4a *) - List.map (fun c -> Formula.Not c) (pos_conjs_4a fact) + List.map (fun c -> Formula.Not c) + (pos_conjs_4a pos_state_subterms fact) else if rel = "distinct" then (* 7i0 *) if Aux.not_unique args then [Formula.Or []] @@ -1903,42 +1907,137 @@ "translate_game: (7i) unexpected dynamic %s\n%!" rel; assert false) | _ -> []) neg_body in - let all_conjs = phi @ conjs @ neg_conjs in + let all_conjs = phi @ conjs @ pconjs_4b @ neg_conjs in let phi = Formula.And all_conjs in - let lvars = (!lvars :> Formula.var list) in - let optim_conjs = List.filter (fun c-> - List.for_all (fun v->List.mem v lvars) - (FormulaOps.free_vars c)) (pos_conjs_4b @ all_conjs) in - let rphi = Formula.And optim_conjs in + let phi = Formula.Ex (FormulaOps.free_vars phi, phi) in (* {{{ log entry *) - if !debug_level > 4 then ( - Printf.printf "evaluating: %s\n%!" + if !debug_level > 3 then ( + Printf.printf "evaluating:\nbranch=%s\nphi=%s\n%!" + (exp_def_str ("eval", [br])) (Formula.str phi) ); - (* }}} *) - if Solver.M.check struc rphi + (* }}} *) + if Solver.M.check struc phi then ( (* {{{ log entry *) - if !debug_level > 4 then ( + if !debug_level > 3 then ( Printf.printf "holds\n%!" ); - (* }}} *) - Some (all_conjs, (next_arg,body,neg_body))) + (* }}} *) + Some (next_arg,body,neg_body)) else None | _ -> assert false) brs in (* 7j *) let check_brs = expand_branch_vars masks playout_terms ~freshen_unfixed:(Aux.Left false) - (List.map (fun (_,(head,body,neg_body))-> + (List.map (fun (head,body,neg_body)-> [head], body, neg_body) brs) in if List.exists (fun (sb,_)-> sb <> []) check_brs then failwith ("GDL.translate_game: expanding variables resulting in "^ "duplicating Toss rules not implemented yet"); - (* 7k *) + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf "Filtered-branches:\n%s\n%!" + (exp_def_str ("filtered", + List.map (fun (next_arg,body,neg_body) -> + [next_arg], body, neg_body) brs)); + ); + (* }}} *) + + (* 7i and 7k *) + let pos_state_terms = + List.fold_left (fun acc -> function + | (next_arg, body, _) -> + let res = + List.fold_left (fun acc -> function + | "true", [true_arg] -> Terms.add true_arg acc + | "true", _ -> assert false + | _ -> acc) acc body in + if next_arg = Const "_IGNORE_RHS_" + then res + else Terms.add next_arg res + ) Terms.empty brs in + let pos_state_terms = Terms.elements pos_state_terms in + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf "pos_state_terms: %s\n%!" + (String.concat ", " (List.map term_str pos_state_terms)) + ); + (* }}} *) + let pos_state_subterms = + Aux.concat_map (fun term -> + let mask, sb, m_sb, blanked = term_to_blank masks term in + List.map (fun (v,t) -> t, (mask, v, term)) sb + ) pos_state_terms in + let pos_path_subterms = + Aux.concat_map (fun term -> + let mask, sb, m_sb, blanked = term_to_blank masks term in + Aux.map_some (function + | v, Var t -> + Some ((mask, v), (t, term)) + | _ -> None) sb + ) pos_state_terms in + let pos_path_subterms = Aux.collect pos_path_subterms in + let pconjs_4b = pos_conjs_4b pos_path_subterms in let brs = - List.map (fun (static_conjs, (next_arg,body,neg_body)) -> + List.map (fun (next_arg,body,neg_body) -> + let phi = + if next_arg = Const "_IGNORE_RHS_" then [] + else + let mask, sb, m_sb, blanked = term_to_blank masks next_arg in + let rname = term_to_name mask in + let _, svar = toss_var masks next_arg in + if List.mem svar !constrained_vars then [] + else + let phi = Formula.Rel (rname, [|svar|]) in + [phi] in + let conjs = + Aux.concat_map (fun (rel, args as fact) -> + if rel = "true" then + (* 7i-4c *) + let true_arg = List.hd args in + let mask, sb, m_sb, blanked = term_to_blank masks true_arg in + let rname = term_to_name mask in + let _, svar = toss_var masks true_arg in + let phi = Formula.Rel (rname, [|svar|]) in + let conjs = + Aux.map_some (function + | _, Var _ -> None + | v, t as v_sb -> + let rname = term_to_name (subst_one v_sb mask) in + Some (Formula.Rel (rname, [|svar|]))) sb in + if conjs <> [] || List.mem svar !constrained_vars + then conjs else [phi] + else if List.mem rel static_rnames then + (* 7i-4a *) + pos_conjs_4a pos_state_subterms fact + else [] + ) body in + (* to prune early, we cannot get more than negated relations for + positive elements, because stuff related to negative elements + is under common negations/disjunctions *) + let neg_conjs = + Aux.concat_map (function + | _, [rel, args as fact] -> + if rel = "true" then [] + else if rel = "_DOES_PLACEHOLDER_" + then [] + else if List.mem rel static_rnames then + (* 7i-4a *) + List.map (fun c -> Formula.Not c) + (pos_conjs_4a pos_state_subterms fact) + else if rel = "distinct" then + (* 7i0 *) + if Aux.not_unique args then [Formula.Or []] + else [] + else ( + (* dynamic relations have been expanded *) + Printf.printf + "translate_game: (7i) unexpected dynamic %s\n%!" rel; + assert false) + | _ -> []) neg_body in let rhs_pos_preds = if next_arg = Const "_IGNORE_RHS_" then [] else @@ -1952,7 +2051,7 @@ let rname = term_to_name (subst_one v_sb mask) in Some (rname, [|rhs_elem|]) ) m_sb in - let static_conjs = ref static_conjs in + let static_conjs = ref (phi @ conjs @ neg_conjs) in let dyn_conjs = Aux.concat_map (fun (rel, args) -> if rel = "true" then @@ -1961,6 +2060,7 @@ let _, svar = toss_var masks true_arg in let mask_rname = term_to_name mask in let mask_phi = Formula.Rel (mask_rname, [|svar|]) in + (* the mask formula would be redundant *) static_conjs := Aux.list_remove mask_phi !static_conjs; Aux.map_some (fun (v,t as v_sb) -> if t = Const "_BLANK_" then @@ -2005,7 +2105,8 @@ Aux.concat_map (fun (rel,_ as fact) -> if rel <> "true" && List.mem rel static_rnames - then neg_conjs_4a neg_state_terms neg_state_subterms fact + then neg_conjs_4a pos_state_subterms + neg_state_terms neg_state_subterms fact else []) body in (* 7k-4b *) let neg_path_subterms = @@ -2033,14 +2134,16 @@ if v=w then None else Some [|v; w|]) vars) vars else match vars with [] -> [] - | v::vs -> List.map (fun w -> [|v; w|]) vs in + | v::vs -> Aux.map_some (fun w -> + if v=w then None else Some [|v; w|]) vs in List.map (fun tup -> Formula.Rel (rname, tup)) tups ) terms ) neg_path_subterms in let negonly_conjs_4b = Aux.unique_sorted negonly_conjs_4b in (* the mixed part *) let mixed_conjs_4b = - Aux.concat_map neg_conjs_4b neg_state_terml in + Aux.concat_map (neg_conjs_4b pos_path_subterms) + neg_state_terml in let nconjs_4b = negonly_conjs_4b @ mixed_conjs_4b in let disjs = Aux.concat_map (fun (rel, args as fact) -> @@ -2056,7 +2159,8 @@ | v, t as v_sb -> let rname = term_to_name (subst_one v_sb mask) in Some (Formula.Rel (rname, [|svar|]))) sb in - let conjs_4b = neg_conjs_4b true_arg in + let conjs_4b = + neg_conjs_4b pos_path_subterms true_arg in let conjs_5 = List.map (fun (v,t as v_sb) -> if t = Const "_BLANK_" then @@ -2073,14 +2177,15 @@ else if List.mem rel static_rnames then (* 7i-4a-2-3 *) let conjs_4a_2 = - match pos_conjs_4a fact with + match pos_conjs_4a pos_state_subterms fact with | [] -> [] | [rel_conseq] -> [rel_conseq] | rel_conseqs -> (* negation turns it into a conjunction *) [Formula.Or rel_conseqs] in let conjs_4a_3 = - neg_conjs_4a neg_state_terms neg_state_subterms fact in + neg_conjs_4a pos_state_subterms + neg_state_terms neg_state_subterms fact in conjs_4a_2 @ conjs_4a_3 else if rel = "distinct" then (* 7i0 *) @@ -2105,7 +2210,7 @@ let all_conjs = !static_conjs @ dyn_conjs @ neg_conjs in (rhs_pos_preds, !static_conjs, all_conjs), (next_arg, body, neg_body)) brs in - pos_conjs_4b, brs + pconjs_4b, brs let translate_game player_term game_descr = @@ -2355,8 +2460,8 @@ | mask, (sb,_)::_ -> List.map (fun (v,_)->mask, v) sb) elements in (* 4a *) let static_rels = - List.map (fun (rname,args) -> - rname, List.map (fun _ -> ()) args) static_rules in + Aux.unique_sorted (List.map (fun (rname,args) -> + rname, List.map (fun _ -> ()) args) static_rules) in let static_rels = List.map (fun (rel,args) -> rel, List.length args, @@ -2678,6 +2783,9 @@ let rules_brs = List.map (fun ((lead_head, lead_body, lead_neg_body), branches) -> + let lead_does = + "_DOES_PLACEHOLDER_", [loc_players.(loc); lead_head] in + let lead_body = lead_does::lead_body in let fixed_vars = term_vars lead_head in let fixed_brs, other_brs = List.partition (function @@ -2698,7 +2806,7 @@ ) frame_brs in let unfixed_brs = to_expand @ more_to_expand in - (* 7g1 *) + (* 7g *) let expanded_brs = expand_branch_vars masks element_terms ~freshen_unfixed:(Aux.Right (Aux.Strings.elements fixed_vars)) @@ -2726,7 +2834,7 @@ | _ -> assert false) l)) frames)) ); (* }}} *) - (* collect and rename multi-bodies *) + (* collect and rename multi-bodies, i.e. form disjunctions *) let frames = List.map (function | [] -> assert false | [head, body, neg_body] -> head, [body, neg_body] @@ -2754,7 +2862,7 @@ (* 7f3 *) (* TODO: minimize the number of branches by keeping negations over conjunctions like in (6b1) *) - let erasure_brs : lit_def_branch list = Aux.concat_map + let erasure_brs = Aux.concat_map (function | [next_arg] as next_args,multi_body -> let mask, _, _, blank_arg = term_to_blank masks next_arg in @@ -2824,7 +2932,7 @@ (subst_rels sb neg_body) in let head = subst sb blank_arg in if - (* TODO: (7g) instead *) + (* TODO: what about expanding as in (7g)? *) Aux.Strings.subset (term_vars head) fixed_vars && (* (7f4) *) @@ -2833,9 +2941,27 @@ List.mem pos neg_conjs) lead_neg_body ) body) && not (List.exists (fun (_,neg) -> - List.mem neg lead_body + List.mem neg lead_body ) neg_body) - then Some ([head], body, neg_body) + then ( + (* {{{ log entry *) + if !debug_level > 4 then ( + Printf.printf "erasure:\n%s\n%s\n%!" + (lit_def_str ("erasure", [ + [head], body, neg_body])) + (exp_def_str ("lead", [ + [lead_head], lead_body, lead_neg_body])) + ); + (* }}} *) + let neg_body = + List.map (fun (vs,lit)->vs,[lit]) + neg_body in + (* we could add "pruning" conditions:*) + Some ([head], lead_body @ body, + lead_neg_body @ neg_body) + (*or not + Some ([head], body, neg_body)*) + ) else None with Not_found -> None) erasures in let erasures = Aux.unique_sorted @@ -2843,13 +2969,12 @@ head, Aux.unique_sorted body, Aux.unique_sorted neg_body) erasures) in erasures - (* TODO: (7g2) *) | _ -> assert false) frames in (* TODO: (7f5) we ignore the possibility that "lead" is instantiated by some of erasure substitutions, since we already ignore non-maximal "legal" classes *) - lead_head, fixed_brs @ expanded_brs @ - exp_brs_of_lit_brs erasure_brs + let nonframe_brs = fixed_brs @ expanded_brs in + lead_head, nonframe_brs @ erasure_brs ) rules_brs in (* let rules_inds = Array.of_list rules_brs in *) rules_brs @@ -2912,7 +3037,7 @@ let body = List.filter ( function "_DOES_PLACEHOLDER_",_ -> false | _ -> true) body in lead, (head, body, neg_body)) brs in - let table = List.map (fun atom -> + let table = Aux.map_some (fun atom -> let positives = Array.mapi (fun i (_,(_,body,_)) -> if List.mem atom body then Some i else None) brs in let positives = Aux.map_some (fun x->x) @@ -2932,9 +3057,15 @@ (String.concat ", "(List.map string_of_int negatives)) ); (* }}} *) + (* since artificial branches were introduced for all atoms, + if some case isn't specifically selected for, it means + that the corresponding literal is not satisfiable *) + if negatives = [] || positives = [] + then None + else (* first those that allow "P" then those that allow "not P" *) - [Aux.Ints.diff full_set (Aux.ints_of_list negatives); - Aux.Ints.diff full_set (Aux.ints_of_list positives)] + Some [Aux.Ints.diff full_set (Aux.ints_of_list negatives); + Aux.Ints.diff full_set (Aux.ints_of_list positives)] ) atoms in let cases = Aux.product table in let cases = @@ -2957,7 +3088,6 @@ Aux.array_existsi (fun ply states -> if ply mod loc_n = loc then ( (* {{{ log entry *) - if !debug_level > 4 then ( let posi = Aux.map_some (function @@ -2967,7 +3097,6 @@ "Checking branch at states:\n%s\npositives:\n%s\n" (terms_str states) (terms_str posi) ); - (* }}} *) let res = List.for_all (function @@ -3018,11 +3147,11 @@ Aux.unique_sorted rhs_pos, static_phis, phis)) cases in let cases = - Aux.map_some ( - fun (var_elems,struc_elems,rhs_pos,static_phis,phis) -> - let rphi = Formula.And static_phis in + Aux.map_some ( + fun (var_elems,struc_elems,rhs_pos,static_phis,phis) -> + let rphi = Formula.And static_phis in (* {{{ log entry *) - if !debug_level > 4 then ( + if !debug_level > 4 then ( (* do not print, because it generates too many answers -- too little constraints per number of variables when considering a single branch *) @@ -3033,21 +3162,21 @@ let atups = AssignmentSet.tuples struc.Structure.elements avars assgn in *) - Printf.printf "evaluating: %s\n%!" - (Formula.str rphi) + Printf.printf "evaluating: %s\n%!" + (Formula.str rphi) (* (List.length atups) *) - ); + ); (* }}} *) - let res = Solver.M.check struc rphi in + let res = Solver.M.check struc rphi in (* {{{ log entry *) - if !debug_level > 4 && res then ( - Printf.printf "holds\n%!" - ); + if !debug_level > 4 && res then ( + Printf.printf "holds\n%!" + ); (* }}} *) - if res then - let precond = Formula.And phis in - Some (var_elems, struc_elems, rhs_pos, precond) - else None) cases in + if res then + let precond = Formula.And phis in + Some (var_elems, struc_elems, rhs_pos, precond) + else None) cases in List.map (fun (var_elems, struc_elems, rhs_pos, precond) -> lead, (var_elems, struc_elems, rhs_pos, precond)) cases ) rules_brs @@ -3134,11 +3263,10 @@ ) goals in (* 8c *) let sized = - List.map (fun (score,phi) -> FormulaOps.size phi, score) payoff in - let cmp (s1,v1) (s2,v2) = - if s2-s1 = 0 then Pervasives.compare v1 v2 else s2-s1 in + List.map (fun (score,phi) -> GameSimpl.niceness phi, score) payoff in + (* Sort in increasing niceness. *) let base_score = - match List.sort cmp sized with [] -> 0. + match List.sort Pervasives.compare sized with [] -> 0. | (_, score)::_ -> score in let payoff = match payoff with | [score, guard] -> @@ -3155,8 +3283,11 @@ ); (* }}} *) sum) - else Formula.Plus (sum, Formula.Times ( - Formula.Const (score -. base_score), Formula.Char guard))) + else + let guarded = Formula.Times ( + Formula.Const (score -. base_score), Formula.Char guard) in + if sum = Formula.Const 0. then guarded + else Formula.Plus (sum, guarded)) (Formula.Const base_score) scores in player, payoff ) player_goals in @@ -3251,9 +3382,11 @@ rname ); (* }}} *) + let signat rel = + Structure.StringMap.find rel struc.Structure.rel_signature in let discrete = DiscreteRule.translate_from_precond ~precond - ~add:rhs_pos ~embed:fluents ~struc_elems in + ~add:rhs_pos ~emb_rels:fluents ~signat ~struc_elems in (* {{{ log entry *) if !debug_level > 2 then ( Printf.printf "Making rule %s of:\n%s\n%!" rname @@ -3297,6 +3430,18 @@ time = 0.; cur_loc = 0; } in + (* {{{ log entry *) + (* * + let file = open_out "./GGP/tests/connect5-raw.toss" in + output_string file (Arena.state_str result); + close_out file; + * *) + if !debug_level > 1 then ( + Printf.printf "\n\nGDL.translate_game: before simplification --\n%s\n%!" + (Arena.sprint_state result) + ); + (* }}} *) + let result = GameSimpl.simplify result in let playing_as = find_player player_term in let noop_actions = Array.mapi (fun loc noops-> @@ -3305,9 +3450,14 @@ | Some ([_; lead_term], _, _) -> Some lead_term | _ -> None ) loc_noop_legal in - (* {{{ log entry *) + (* {{{ log entry *) + (* * + let file = open_out "./GGP/tests/connect5-simpl.toss" in + output_string file (Arena.state_str result); + close_out file; + * *) if !debug_level > 1 then ( - Printf.printf "\n\nGDL.translate_game:\n%s\n%!" + Printf.printf "\n\nGDL.translate_game: after simplification --\n%s\n%!" (Arena.sprint_state result) ); (* }}} *) @@ -3400,9 +3550,11 @@ (Formula.sprint precond) ); (* }}} *) + let signat rel = + Structure.StringMap.find rel struc.Structure.rel_signature in let rule = DiscreteRule.translate_from_precond ~precond ~add - ~embed:gdl.fluents ~struc_elems in + ~emb_rels:gdl.fluents ~signat ~struc_elems in let lhs_struc = rule.DiscreteRule.lhs_struc in let rule = DiscreteRule.compile_rule (Structure.rel_signature struc) [] rule in Modified: trunk/Toss/GGP/GDLTest.ml =================================================================== --- trunk/Toss/GGP/GDLTest.ml 2011-03-12 17:51:51 UTC (rev 1354) +++ trunk/Toss/GGP/GDLTest.ml 2011-03-12 19:24:32 UTC (rev 1355) @@ -75,22 +75,40 @@ (String.concat "\n" (List.map GDL.exp_def_str res)); ); +] +let bigtests = "GDLBig" >::: [ + "connect5" >:: (fun () -> - todo "soon"; - (* GDL.debug_level := 3; *) let connect5 = load_rules "./GGP/examples/connect5.gdl" in - let gtransl, gdef = GDL.translate_game (Const "x") connect5 in - ignore (gtransl, gdef) + let _, res = GDL.translate_game (Const "x") connect5 in + let goalf = open_in "./GGP/tests/connect5-simpl.toss" in + let resf = open_out "./GGP/tests/connect5-temp.toss" in + let goal_str = Aux.input_file goalf in + let res_str = Arena.state_str res in + output_string resf res_str; + close_in goalf; close_out resf; + assert_equal + ~msg:"GGP/examples/connect5.gdl to GGP/tests/connect5-simpl.toss, see GGP/tests/connect5-temp.toss" + goal_str res_str; + Sys.remove "./GGP/tests/connect5-temp.toss" ); "breakthrough" >:: (fun () -> - todo "soon"; let breakthrough = load_rules "./GGP/examples/breakthrough.gdl" in - let gdef = GDL.translate_game (Const "white") breakthrough in - ignore gdef; + let _, res = GDL.translate_game (Const "white") breakthrough in + let goalf = open_in "./GGP/tests/breakthrough-simpl.toss" in + let resf = open_out "./GGP/tests/breakthrough-temp.toss" in + let goal_str = Aux.input_file goalf in + let res_str = Arena.state_str res in + output_string resf res_str; + close_in goalf; close_out resf; + assert_equal + ~msg:"GGP/examples/breakthrough.gdl to GGP/tests/breakthrough-simpl.toss, see GGP/tests/breakthrough-temp.toss" + goal_str res_str; + Sys.remove "./GGP/tests/breakthrough-temp.toss" ); @@ -100,6 +118,9 @@ let a = Aux.run_test_if_target "GDLTest" tests +let a = + Aux.run_test_if_target "GDLTest" bigtests + let a () = match test_filter ["GDL:2:masks"] @@ -110,9 +131,10 @@ let a () = GDL.debug_level := 4; + GameSimpl.debug_level := 4; DiscreteRule.debug_level := 4; let breakthrough = load_rules "./GGP/examples/breakthrough.gdl" in let connect5 = load_rules "./GGP/examples/connect5.gdl" in let tictactoe = load_rules "./GGP/examples/tictactoe.gdl" in - let gdef = GDL.translate_game (Const "x") connect5 in - ignore gdef; ignore connect5; ignore breakthrough; ignore tictactoe + let gdl_def, toss_def = GDL.translate_game (Const "x") connect5 in + ignore gdl_def; ignore connect5; ignore breakthrough; ignore tictactoe Added: trunk/Toss/GGP/GameSimpl.ml =================================================================== --- trunk/Toss/GGP/GameSimpl.ml (rev 0) +++ trunk/Toss/GGP/GameSimpl.ml 2011-03-12 19:24:32 UTC (rev 1355) @@ -0,0 +1,292 @@ +(** {2 Simplification of Toss Games.} + + Whole-game simplifications and helper functions that consider both + a structure and a formula. + + The simplification of structures, associated formulas and Toss + rules is specified by transformations described below. Rules can + be refined or new rules added to each stage. + + (1) Identify relations in the structure that are not fluents nor + defined relations and that are equal to or are complements of + other relations in the structure. Select a single relation / a + predicate (called "the original" below), that is smaller than its + complement (if the complement is in the signature), and replace + all selected relations with it (or its negation), in all formulas + of the definition. Remove the other relations from the structure. + + (1a) We need to update LHS structures of rules (for presentation + and game modification purposes, since the simple transformation + above of the "embedding formula" suffices for the "compiled" rule + representation). Replace the identified relations in the "embedded + set" with their originals, and add to the embedded set relations + that occur positively in the LHS and are complements of their + original. Derive all the tuples of embedded relations that are + required to be absent for a match (not present, even optionally, + in the LHS). Remove the non-optional tuples for relations that are + complements of their originals and add tuples of originals that + are complements of relations that are required to be + absent. Rename relations equivalent to their originals. + + (2) Locate relations that subsume, or are subsumed by others (in + terms of inclusion relations between their graphs). Simplify + conjunctions and disjunctions of literals by removing literals + that are weaker/stronger than another present over the same tuple + in the given conjunction/disjunction. + + (3) For each pair of static unary predicates with nonempty + intersection, introduce new predicate for their conjunction. For + each pair of static binary predicates, introduce two new + predicates: one for their conjunction and the other for + conjunction of one of the predicates and the inverse of the other. + + (3a) Replace each conjunction of pair of unary/binary predicates + over the same variables, with one of introduced predicates. For + several possibilities of replacement pick one arbitrarily + (currently, in the order of occurrence in the formula). +*) + +open Formula +open Aux.BasicOperators + +let debug_level = ref 0 + + + +(* Collect universally quantified subformulas and compute the size of + the "existential" trunk (counting only atomic formulas). *) +let separate_univ phi = + let rec aux neg = function + | Or js | And js -> + List.fold_left (fun (a,b) (c,d) -> a+c,b@d) (0,[]) + (List.map (aux neg) js) + | All (_, phi) -> + if neg then aux neg phi + else 0, [phi] + | Ex (_, phi) -> + if not neg then aux neg phi + else 0, [phi] + | Not phi -> aux (not neg) phi + | Rel _ | Eq _ | In _ | RealExpr _ -> 1, [] in + aux false phi + + +(* A heuristic measure of how easy a formula is to solve or provide a + good heuristic. Very crude for now, not using the structure yet. *) +let niceness phi = + let trunk, univs = separate_univ phi in + trunk - List.fold_left (+) 0 (List.map FormulaOps.size univs) + + +let simplify ?(join_rel_names=fun x _ -> x) (game, state) = + let struc = state.Arena.struc in + let signat = Structure.rel_signature struc in + let nelems = Structure.Elems.cardinal struc.Structure.elements in + let tcard tups = Structure.Tuples.cardinal tups in + let fluents = + Aux.unique_sorted + (Aux.concat_map (fun (_,r) -> + DiscreteRule.fluents r.ContinuousRule.compiled) + game.Arena.rules) in + (* {{{ log entry *) + if !debug_level > 0 then ( + Printf.printf "GameSimpl: fluents = %s\n%!" + (String.concat ", " fluents) + ); + (* }}} *) + (* prepare for (3) and (1) *) + let subset_table = + List.fold_left (fun table (rel,arity) -> + let rel_tups = + Structure.StringMap.find rel struc.Structure.relations in + let row = + List.fold_left (fun row (rel2,arity2) -> + if arity2 = arity && + Structure.Tuples.subset rel_tups + (Structure.StringMap.find rel2 struc.Structure.relations) + then Aux.Strings.add rel2 row + else row + ) Aux.Str... [truncated message content] |
From: <luk...@us...> - 2011-03-12 17:52:00
|
Revision: 1354 http://toss.svn.sourceforge.net/toss/?rev=1354&view=rev Author: lukaszkaiser Date: 2011-03-12 17:51:51 +0000 (Sat, 12 Mar 2011) Log Message: ----------- Website corrections, debug ocamldoc. Modified Paths: -------------- trunk/Toss/Arena/Term.mli trunk/Toss/Formula/Formula.mli trunk/Toss/Makefile trunk/Toss/Play/GameTree.mli trunk/Toss/Play/Play.mli trunk/Toss/Toss.odocl trunk/Toss/www/.cvsignore trunk/Toss/www/Makefile trunk/Toss/www/contact.xml trunk/Toss/www/create.xml trunk/Toss/www/docs.xml trunk/Toss/www/gui_interface.xml trunk/Toss/www/ideas.xml trunk/Toss/www/index.xml trunk/Toss/www/navigation.xml trunk/Toss/www/play.xml trunk/Toss/www/xsl/include/common.xsl Added Paths: ----------- trunk/Toss/www/reference/ trunk/Toss/www/reference/.cvsignore trunk/Toss/www/reference/Makefile trunk/Toss/www/reference/reference.bib trunk/Toss/www/reference/reference.tex Removed Paths: ------------- trunk/Toss/www/reference.bib trunk/Toss/www/reference.tex Property Changed: ---------------- trunk/Toss/www/ Modified: trunk/Toss/Arena/Term.mli =================================================================== --- trunk/Toss/Arena/Term.mli 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/Arena/Term.mli 2011-03-12 17:51:51 UTC (rev 1354) @@ -76,7 +76,7 @@ eq_sys -> eq_sys -(** {2 Runge-Kutta Method for Term Equations *) +(** {2 Runge-Kutta Method for Term Equations} *) (** Perform a Runge-Kutta (RK4) step for [vars] with [vals_init] and right-hand Modified: trunk/Toss/Formula/Formula.mli =================================================================== --- trunk/Toss/Formula/Formula.mli 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/Formula/Formula.mli 2011-03-12 17:51:51 UTC (rev 1354) @@ -52,6 +52,8 @@ | Or of formula list | Ex of var list * formula | All of var list * formula + +(** Real-valued terms allow counting, characteristic functions and arithmetic. *) and real_expr = RVar of string | Const of float @@ -61,6 +63,7 @@ | Char of formula | Sum of fo_var list * formula * real_expr + val pow : real_expr -> int -> real_expr val size : ?acc : int -> formula -> int Modified: trunk/Toss/Makefile =================================================================== --- trunk/Toss/Makefile 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/Makefile 2011-03-12 17:51:51 UTC (rev 1354) @@ -46,10 +46,12 @@ OCB_CFLAG=-cflags -I,+oUnit,-g OCB_LIB=-libs str,nums,unix,oUnit OCB_PP=-pp "camlp4o ../caml_extensions/pa_let_try.cmo ../caml_extensions/pa_backtrace.cmo" -OCAMLBUILD=ocamlbuild -j 8 -menhir ../menhir_conf $(OCB_PP) \ +OCAMLBUILD=ocamlbuild -log build.log -j 8 -menhir ../menhir_conf $(OCB_PP) \ $(OCB_LIB) $(OCB_CFLAG) $(OCB_LFLAG) -OCAMLBUILDBT=ocamlbuild -j 8 menhir ../menhir_conf $(OCB_PP) \ +OCAMLBUILDBT=ocamlbuild -log build.log -j 8 menhir ../menhir_conf $(OCB_PP) \ $(OCB_LIB) $(OCB_CFLAG) $(OCB_LFLAGBT) +OCAMLBUILDNOPP=ocamlbuild -log build.log -j 8 -menhir ../menhir_conf \ + $(OCB_LIB) $(OCB_CFLAG) $(OCB_LFLAG) FormulaINC=Formula/Sat SolverINC=Formula,Formula/Sat,Solver/RealQuantElim @@ -76,7 +78,8 @@ doc: Formula/Sat/minisat/SatSolver.o Formula/Sat/minisat/MiniSATWrap.o \ caml_extensions/pa_let_try.cmo caml_extensions/pa_backtrace.cmo - $(OCAMLBUILD) -Is $(.INC) Toss.docdir/index.html + $(OCAMLBUILDNOPP) -Is +oUnit,$(.INC) Toss.docdir/index.html + make -C www code_doc_link # ---------- TESTS -------- Modified: trunk/Toss/Play/GameTree.mli =================================================================== --- trunk/Toss/Play/GameTree.mli 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/Play/GameTree.mli 2011-03-12 17:51:51 UTC (rev 1354) @@ -2,6 +2,8 @@ val set_debug_level : int -> unit +(** {2 Abstract Game Trees} *) + (** Abstract game tree, just stores state and move information. *) type ('a, 'b) abstract_game_tree = | Terminal of Arena.game_state * int * 'b (** terminal state with player *) @@ -42,7 +44,7 @@ -(** -------------- TREES WITH PAYOFF AND HEURISTIC DATA --------------- *) +(** {2 Trees with Payoff and Heuristic Data} *) (** How to exchange payoffs for heuristics. *) val cPAYOFF_AS_HEUR : float ref Modified: trunk/Toss/Play/Play.mli =================================================================== --- trunk/Toss/Play/Play.mli 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/Play/Play.mli 2011-03-12 17:51:51 UTC (rev 1354) @@ -6,7 +6,7 @@ val cancel_timeout : unit -> unit -(** ------------ MAXIMAX BY DEPTH ------------- *) +(** {2 Maximax by depth} *) (** Maximax by depth unfolding function. Throws Not_found if ready. *) val unfold_maximax : ?ab:bool -> Arena.game -> Formula.real_expr array array -> Modified: trunk/Toss/Toss.odocl =================================================================== --- trunk/Toss/Toss.odocl 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/Toss.odocl 2011-03-12 17:51:51 UTC (rev 1354) @@ -1,16 +1,27 @@ Formula/Formula +Formula/FormulaParser Formula/BoolFormula Formula/FFTNF Formula/FormulaOps Solver/Structure +Solver/StructureParser Solver/AssignmentSet Solver/Assignments -Solver/FFSolver Solver/Solver Solver/Class +Solver/ClassParser Arena/Term +Arena/TermParser Arena/DiscreteRule +Arena/DiscreteRuleParser Arena/ContinuousRule +Arena/ContinuousRuleParser Arena/Arena +Arena/ArenaParser Play/Heuristic +Play/Move +Play/GameTree +Play/Play Play/Game +GGP/GDL +GGP/GDLParser \ No newline at end of file Property changes on: trunk/Toss/www ___________________________________________________________________ Modified: svn:ignore - # We are still using .cvsignore files as we find them easier to manage # than svn properties. Therefore if you change .cvsignore do the following. # svn propset svn:ignore -F .cvsignore . *.html *.html.de *.html.en *.texml *.xml.de *.xml.en reference.xml reference.pdf *.ps *.dvi *.aux *.out *.log *.bbl *.blg *.idx *.thm *.snm *.nav *.toc *.flc *~ + # We are still using .cvsignore files as we find them easier to manage # than svn properties. Therefore if you change .cvsignore do the following. # svn propset svn:ignore -F .cvsignore . *.html *.html.de *.html.en *.texml *.xml.de *.xml.en reference.xml code_doc *.ps *.dvi *.aux *.out *.log *.bbl *.blg *.idx *.thm *.snm *.nav *.toc *.flc *~ Modified: trunk/Toss/www/.cvsignore =================================================================== --- trunk/Toss/www/.cvsignore 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/www/.cvsignore 2011-03-12 17:51:51 UTC (rev 1354) @@ -9,7 +9,7 @@ *.xml.de *.xml.en reference.xml -reference.pdf +code_doc *.ps *.dvi *.aux Modified: trunk/Toss/www/Makefile =================================================================== --- trunk/Toss/www/Makefile 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/www/Makefile 2011-03-12 17:51:51 UTC (rev 1354) @@ -1,3 +1,8 @@ TOPDIR = . include $(TOPDIR)/default.mak + +code_doc_link: + ln -fs ../Toss.docdir code_doc + cp code_doc/index.html code_doc/index.html.en + cp code_doc/index.html code_doc/index.html.de Modified: trunk/Toss/www/contact.xml =================================================================== --- trunk/Toss/www/contact.xml 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/www/contact.xml 2011-03-12 17:51:51 UTC (rev 1354) @@ -15,7 +15,7 @@ <section title="Email"> <par>Toss is an open source project hosted by <a href="http://sourceforge.net">SourceForge</a> - and distributed under the BSD licence.</par> + and distributed under the BSD licence.<br/></par> <par>Contact us by writing to: <mailto address="tos...@li..."/> </par> Modified: trunk/Toss/www/create.xml =================================================================== --- trunk/Toss/www/create.xml 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/www/create.xml 2011-03-12 17:51:51 UTC (rev 1354) @@ -10,22 +10,53 @@ <link id="create" href="/create.html">Create</link> </history> - <section title="Create New Games" lang="en"> - <par>The <a href="http://vimeo.com/10110495">Toss Tutorial</a> below + <section title="Two Ways to Create a New Game"> + <par>When you are done playing the games already defined in Toss, it's + time to start the real fun – create your own game! + There are two ways to create a game in Toss.</par> + <itemize> + <item>You can use the GUI to edit and create games</item> + <item>You can edit the .toss files directly</item> + </itemize> + If you plan to make small changes or an easy experiment, the GUI might + be the better option. For larger or completely new games, it is more + convenient to edit the files in your favourite text editor. + </section> + + <section title="Creating Games in Toss GUI"> + <par>To start the Toss GUI do the following.</par> + <itemize> + <item><em>Download</em> Toss from the + <a href="http://sourceforge.net/project/showfiles.php?group_id=115606"> + Sourceforge Download Page</a>.</item> + <item><em>Run Toss</em> by clicking <em>Toss.py</em>. + You can start by opening a file from the <em>examples</em> + directory.</item> + </itemize> + <par>When you have the GUI running, we recommend that you watch the + <a href="http://vimeo.com/10110495">Toss Tutorial</a> below, which shows all the steps needed to define a simple game in Toss and explains - several other features. Alternatively, you can just take a look at our - <a href="interface.php">Interface</a> page and play with the examples. - </par> - <toss-video/> + several other features. Alternatively, you can take a look at our + <a href="gui_interface.html">GUI interface</a> description page + and play with the examples.<br/></par> + <par><br/><toss-video/></par> </section> - <section title="Neue Spiele Erzeugen" lang="de"> - <par>The <a href="http://vimeo.com/10110495">Toss Tutorial</a> below - shows all the steps needed to define a simple game in Toss and explains - several other features. Alternatively, you can just take a look at our - <a href="interface.php">Interface</a> page and play with the examples. + <section title="Creating Games in Text Editor" lang="en"> + <par>For larger games, we find it easier to edit them in text + form than from the GUI. To understand the meaning of the fields + in the text file, you should probably first be acquainted with + Toss (e.g. go through the tutorial above) and at least skim through + the <a href="reference/reference.pdf">referece.pdf</a> file, look + at our <a href="docs.html">documentation</a>. After this, you can + simply edit the .toss file, maybe starting with one of these. </par> - <toss-video/> + <itemize> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Breakthrough.toss?revision=1349">Breakthrough</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Chess.toss?revision=1349">Chess</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Tic-Tac-Toe.toss?revision=1349">Tic-Tac-Toe</a></item> + </itemize> </section> + </personal> Modified: trunk/Toss/www/docs.xml =================================================================== --- trunk/Toss/www/docs.xml 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/www/docs.xml 2011-03-12 17:51:51 UTC (rev 1354) @@ -10,24 +10,48 @@ <link id="docs" href="/docs.html">Documentation</link> </history> - <section title="Background"> + <section title="Using Toss"> + <par>If you want to learn how to use Toss to create games, + go to the <a href="create.html">Create Games</a> page + or just watch the video tutorial below to get started.<br/></par> + <par><br/><toss-video/></par> + </section> + + <section title="Reference"> + <par>The Toss Design and Specification reference is an evolving document + in which we try to describe the high-level mathematical model of Toss + and the main ideas used in the implementation. The document is best + viewed as <a href="reference/reference.pdf">reference.pdf</a> but + a <a href="reference/">html version</a> is available as well + for fast fact-checking.</par> + </section> + + <section title="Code Documentation"> + We generate <a href="code_doc/">documentation from code comments</a> using + <a href="http://caml.inria.fr/pub/docs/manual-ocaml/manual029.html"> + ocamldoc</a>. It gives the most up-to date information on our code, + modules and their interfaces. + </section> + + <section title="Scientific Background"> <par>To learn more about the mathematical background and - the design of Toss, use the following links.</par> + the design of Toss, go to the <a href="Publications/">Papers + and Talks</a> page or use the following links.</par> <itemize> -<item><em>Compact description</em> of the mathematical model behind Toss and -our game playing algorithm can be found in the paper -<a href="http://logic.rwth-aachen.de/~kaiser/playing_structure_rewriting_games.pdf">Playing Structure Rewriting Games</a>.</item> - -<item><em>Design and specification</em> of Toss are described in - the <a href="reference.pdf">reference.pdf</a> document.</item> - -<item> <em>Complexity</em> of a syntactic fragment of Toss was analyzed in - the paper <a href="http://logic.rwth-aachen.de/~kaiser/graph_games_short.pdf"> - Synthesis for Structure Rewriting Systems</a>.</item> -<item><em>Presentation</em> on the mathematics behind Toss was given at - <em>IIT Kanpur</em> and can be - <a href="http://www2.cse.iitk.ac.in/~fsttcs/2009/videos/star/LukaszKaiser.avi"> - watched</a> online.</item> + <item><em>Compact description</em> of the mathematical model behind + Toss and our game playing algorithm can be found in the paper + <a href="pub/playing_structure_rewriting_games.pdf">Playing + Structure Rewriting Games</a>. + </item> + <item> <em>Complexity</em> of a syntactic fragment of Toss was + analyzed in the paper <a href="pub/graph_games_short.pdf"> + Synthesis for Structure Rewriting Systems</a>. + </item> + <item><em>Presentation</em> on the mathematics behind Toss was given at + <em>IIT Kanpur</em> and can be + <a href="http://www2.cse.iitk.ac.in/~fsttcs/2009/videos/star/LukaszKaiser.avi"> + watched</a> online. + </item> </itemize> </section> Modified: trunk/Toss/www/gui_interface.xml =================================================================== --- trunk/Toss/www/gui_interface.xml 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/www/gui_interface.xml 2011-03-12 17:51:51 UTC (rev 1354) @@ -11,19 +11,8 @@ <link id="examples" href="/examples.html">Examples</link> </history> - <section title="Running the Toss GUI"> - <itemize> - <item><em>Download</em> Toss from the - <a href="http://sourceforge.net/project/showfiles.php?group_id=115606"> - Sourceforge Download Page</a>.</item> - <item><em>Run Toss</em> by clicking <em>Toss.py</em>. - You can start by opening a file from the <em>examples</em> - directory.</item> - <item><em>Screenshots</em> of a few example games are - given on the <a href="/examples.html">Examples</a> page.</item> - </itemize> - </section> + <section title="Changing Elements"> <itemize> <item> Modified: trunk/Toss/www/ideas.xml =================================================================== --- trunk/Toss/www/ideas.xml 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/www/ideas.xml 2011-03-12 17:51:51 UTC (rev 1354) @@ -71,14 +71,14 @@ <item>Go definition in Toss without Ko (medium)</item> <item>Toss extension to handle repeated positions (medium)</item> <item>Go definition with Ko (easy after 3)</item> - <item>Adapting Heuristics, Minimax, UCT to play somehow (medium)</item> + <item>Adapting Minimax and UCT to play somehow (medium)</item> <item>Optimizing the algorithms to play well (unknown)</item> </enumerate> <br/></par> <par><em>Needed Skills and Difficulty.</em> Good OCaml programming skills are required, and some general knowledge - of game playing algorithms will be necessary. Between easy and medium, - but can become very interesting and challenging in the last phase! + of game playing algorithms will be necessary. This is a medium difficulty + project, but it can become very interesting in the last phase! <br/><br/></par> <par><em>Possible Mentors (in order of preference):</em> Łukasz Stafiniak, Łukasz Kaiser, @@ -155,7 +155,7 @@ interface design is necessary, and a lot of testing to make it right. <br/><br/></par> <par><em>Possible Mentors (in order of preference):</em> - Dietmar Berwanger, Michał Wójcik, Tobias Ganzow + Dietmar Berwanger, Michał Wójcik, Diana Fischer </par> </section> @@ -189,8 +189,8 @@ <par><em>Needed Skills and Difficulty.</em> This project is technical and requires very good understanding of OCaml, the interface between OCaml and C, and the various factors - which can influence performance. Some knowledge of databases and - their optimization techniques can be helpful. + which can influence performance. Some knowledge of either databases and + their optimization techniques or constraint solving will be helpful. <br/><br/></par> <par><em>Possible Mentors (in order of preference):</em> Tobias Ganzow, Łukasz Kaiser, Łukasz Stafiniak @@ -226,10 +226,11 @@ </enumerate> <br/></par> <par><em>Needed Skills and Difficulty.</em> - The GDL translation is not that hard in principle, but turns out to be - quite tricky in practice. Good knowlede of OCaml is necessary, and some - previous knowledge of GGP/GDL or Prolog would be good. But passsion - for GGP is the best recommendation for this project! + Due to different design choices behind the GDL and Toss formalisms, + the translation is a complex task and it requires acquaintance with + concepts from logic programming. Good knowledge of OCaml is necessary of + course, but some previous knowledge of GGP/GDL or Prolog would be helpful. + Still, passion for GGP is the best recommendation for this project! <br/><br/></par> <par><em>Possible Mentors (in order of preference):</em> Łukasz Stafiniak, Łukasz Kaiser, maybe someone from GGP Galaxy Modified: trunk/Toss/www/index.xml =================================================================== --- trunk/Toss/www/index.xml 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/www/index.xml 2011-03-12 17:51:51 UTC (rev 1354) @@ -43,8 +43,8 @@ shows all the steps needed to define a simple game in Toss and explains several other features. Alternatively, you can just take a look at our <a href="interface.php">Interface</a> page and play with the examples. - </par> - <toss-video/> + <br/></par> + <par><br/><toss-video/></par> </section> <section title="Neue Spiele Erzeugen" lang="de"> @@ -52,8 +52,8 @@ shows all the steps needed to define a simple game in Toss and explains several other features. Alternatively, you can just take a look at our <a href="interface.php">Interface</a> page and play with the examples. - </par> - <toss-video/> + <br/></par> + <par><br/><toss-video/></par> </section> <section title="Features"> @@ -74,7 +74,7 @@ <item><em>Solver</em> in Toss is optimized: it does quantifier elimination and formula decomposition (with <a href="http://minisat.se/">MiniSat</a>).</item> <item><em>Move hints</em> are given in all games using our general - game playing algorithm based on UCT.</item> + game playing algorithm based on UCT or Maximax.</item> </itemize> </section> Modified: trunk/Toss/www/navigation.xml =================================================================== --- trunk/Toss/www/navigation.xml 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/www/navigation.xml 2011-03-12 17:51:51 UTC (rev 1354) @@ -15,7 +15,9 @@ </menu> <item href="/play.html" id="play">Watch Toss Play</item> <menu title="Documentation" href="/docs.html" id="docs"> - <item href="/background.html" id="background">Background</item> + <item href="/reference/reference.pdf" id="refpdf">Reference (pdf)</item> + <item href="/reference/" id="refhtml">Reference (html)</item> + <item href="/code_doc/" id="code">Code Documentation</item> </menu> <item href="/Publications/" id="Publications">Papers and Talks</item> <item href="/contact.html" id="contact">Contact and Links</item> Modified: trunk/Toss/www/play.xml =================================================================== --- trunk/Toss/www/play.xml 2011-03-12 04:23:27 UTC (rev 1353) +++ trunk/Toss/www/play.xml 2011-03-12 17:51:51 UTC (rev 1354) @@ -10,8 +10,157 @@ <link id="play" href="/play.html">Toss Play</link> </history> - <section title="Watch Toss Play"> - <par>Here you can watch Toss play. Beware of Heuristics!</par> + <section title="General Game Playing"> + <a href="http://en.wikipedia.org/wiki/General_Game_Playing">General + Game Playing</a>, GGP in short, is a name for the task of playing + a previously unknown game. GGP is currently a popular field of AI, + with people at <a href="http://games.stanford.edu/">Stanford</a> + and in <a href="http://www.general-game-playing.de/">Germany</a> + doing great work. Players which accept games in the GDL format can + play on the <a href="http://euklid.inf.tu-dresden.de:8180/ggpserver/"> + Dresden GGP Server</a> and Toss recently started competing there as well. + Games in GDL format are not directly suited for online presentation, but + the <a href="http://code.google.com/p/ggp-galaxy/">GGP Galaxy Project</a> + has recently started to work on bringing them online – something + we already have for games in the Toss format. Below we show a few of + the games played by Toss against Fluxplayer on the Dresden Server. </section> + + <section title="Breakthrough Games"> + <itemize> + <item><ggp-game match_id="breakthrough.1297045579170" + name="Breakthrough 1"/></item> + <item><ggp-game match_id="breakthrough.1297045589259" + name="Breakthrough 2"/></item> + <item><ggp-game match_id="breakthrough.1297173861071" + name="Breakthrough 3"/></item> + <item><ggp-game match_id="breakthrough.1297173869694" + name="Breakthrough 4"/></item> + <item><ggp-game match_id="breakthrough.1297173874334" + name="Breakthrough 5"/></item> + <item><ggp-game match_id="breakthrough.1297173876674" + name="Breakthrough 6"/></item> + <item><ggp-game match_id="breakthrough.1297173880713" + name="Breakthrough 7"/></item> + <item><ggp-game match_id="breakthrough.1297173884736" + name="Breakthrough 8"/></item> + <item><ggp-game match_id="breakthrough.1297173889956" + name="Breakthrough 9"/></item> + <item><ggp-game match_id="breakthrough.1297173895209" + name="Breakthrough 10"/></item> + <item><ggp-game match_id="breakthrough.1297190115986" + name="Breakthrough 11"/></item> + <item><ggp-game match_id="breakthrough.1297190121191" + name="Breakthrough 12"/></item> + <item><ggp-game match_id="breakthrough.1297190129741" + name="Breakthrough 13"/></item> + <item><ggp-game match_id="breakthrough.1297190137203" + name="Breakthrough 14"/></item> + <item><ggp-game match_id="breakthrough.1297190149280" + name="Breakthrough 15"/></item> + <item><ggp-game match_id="breakthrough.1297190159057" + name="Breakthrough 16"/></item> + <item><ggp-game match_id="breakthrough.1297190171807" + name="Breakthrough 17"/></item> + <item><ggp-game match_id="breakthrough.1297190182797" + name="Breakthrough 18"/></item> + <item><ggp-game match_id="breakthrough.1297204058168" + name="Breakthrough 19"/></item> + <item><ggp-game match_id="breakthrough.1297204063753" + name="Breakthrough 20"/></item> + </itemize> + </section> + + <section title="Gomoku Games"> + <itemize> + <item><ggp-game match_id="connect5.1297281103161" + name="Gomoku 1"/></item> + <item><ggp-game match_id="connect5.1297281122315" + name="Gomoku 2"/></item> + <item><ggp-game match_id="connect5.1297281150565" + name="Gomoku 3"/></item> + <item><ggp-game match_id="connect5.1297281152908" + name="Gomoku 4"/></item> + <item><ggp-game match_id="connect5.1297281195920" + name="Gomoku 5"/></item> + <item><ggp-game match_id="connect5.1297281206285" + name="Gomoku 6"/></item> + <item><ggp-game match_id="connect5.1297281221465" + name="Gomoku 7"/></item> + <item><ggp-game match_id="connect5.1297281224813" + name="Gomoku 8"/></item> + <item><ggp-game match_id="connect5.1297281227319" + name="Gomoku 9"/></item> + <item><ggp-game match_id="connect5.1297281243181" + name="Gomoku 10"/></item> + <item><ggp-game match_id="connect5.1297281310683" + name="Gomoku 11"/></item> + <item><ggp-game match_id="connect5.1297281313978" + name="Gomoku 12"/></item> + <item><ggp-game match_id="connect5.1297281334093" + name="Gomoku 13"/></item> + <item><ggp-game match_id="connect5.1297281339581" + name="Gomoku 14"/></item> + <item><ggp-game match_id="connect5.1297290598634" + name="Gomoku 15"/></item> + <item><ggp-game match_id="connect5.1297290600817" + name="Gomoku 16"/></item> + <item><ggp-game match_id="connect5.1297290603544" + name="Gomoku 17"/></item> + <item><ggp-game match_id="connect5.1297290606415" + name="Gomoku 18"/></item> + <item><ggp-game match_id="connect5.1297335418504" + name="Gomoku 19"/></item> + <item><ggp-game match_id="connect5.1297339843897" + name="Gomoku 20"/></item> + </itemize> + </section> + + + <section title="Pawn Whopping Games"> + <itemize> + <item><ggp-game match_id="pawn_whopping_corrected.1297079331820" + name="Pawn Whopping 1"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297079335327" + name="Pawn Whopping 2"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297079338617" + name="Pawn Whopping 3"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297079342087" + name="Pawn Whopping 4"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297079344774" + name="Pawn Whopping 5"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297079349729" + name="Pawn Whopping 6"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297079352247" + name="Pawn Whopping 7"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297079356298" + name="Pawn Whopping 8"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297079360056" + name="Pawn Whopping 9"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297079363440" + name="Pawn Whopping 10"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297111697272" + name="Pawn Whopping 11"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297111700788" + name="Pawn Whopping 12"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297111705440" + name="Pawn Whopping 13"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297111708081" + name="Pawn Whopping 14"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297111712776" + name="Pawn Whopping 15"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297111715521" + name="Pawn Whopping 16"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297111730245" + name="Pawn Whopping 17"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297111733976" + name="Pawn Whopping 18"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297173802992" + name="Pawn Whopping 19"/></item> + <item><ggp-game match_id="pawn_whopping_corrected.1297173805830" + name="Pawn Whopping 20"/></item> + </itemize> + </section> + </personal> Property changes on: trunk/Toss/www/reference ___________________________________________________________________ Added: svn:ignore + # We are still using .cvsignore files as we find them easier to manage # than svn properties. Therefore if you change .cvsignore do the following. # svn propset svn:ignore -F .cvsignore . *.html *.html.de *.html.en *.png *.css reference.pdf *.ps *.dvi *.aux *.out *.log *.bbl *.blg *.idx *.thm *.snm *.nav *.toc *.flc *~ Added: trunk/Toss/www/reference/.cvsignore =================================================================== --- trunk/Toss/www/reference/.cvsignore (rev 0) +++ trunk/Toss/www/reference/.cvsignore 2011-03-12 17:51:51 UTC (rev 1354) @@ -0,0 +1,24 @@ +# We are still using .cvsignore files as we find them easier to manage +# than svn properties. Therefore if you change .cvsignore do the following. +# svn propset svn:ignore -F .cvsignore . + +*.html +*.html.de +*.html.en +*.png +*.css +reference.pdf +*.ps +*.dvi +*.aux +*.out +*.log +*.bbl +*.blg +*.idx +*.thm +*.snm +*.nav +*.toc +*.flc +*~ Added: trunk/Toss/www/reference/Makefile =================================================================== --- trunk/Toss/www/reference/Makefile (rev 0) +++ trunk/Toss/www/reference/Makefile 2011-03-12 17:51:51 UTC (rev 1354) @@ -0,0 +1,23 @@ +all: reference.pdf index.html + +reference.pdf: reference.tex reference.bib + pdflatex reference.tex + bibtex reference + pdflatex reference.tex + pdflatex reference.tex + rm -f *.aux *.out *.log *.bbl *.blg *.idx *.thm *.snm *.nav \ + *.toc *.lof *.flc + +reference.html: reference.tex reference.bib + htlatex reference.tex + rm -r reference.dvi *.log *.aux *.4ct *.4tc *.tmp *.idv *.lg *.xref + +index.html: reference.html + cp reference.html index.html + cp reference.html index.html.en + cp reference.html index.html.de + +.PHONY: + +clean: + rm -f *~ *.html *.png *.css reference.dvi reference.pdf Copied: trunk/Toss/www/reference/reference.bib (from rev 1353, trunk/Toss/www/reference.bib) =================================================================== --- trunk/Toss/www/reference/reference.bib (rev 0) +++ trunk/Toss/www/reference/reference.bib 2011-03-12 17:51:51 UTC (rev 1354) @@ -0,0 +1,189 @@ +@article{SUB96, + author = {Marcos Salganicoff and Lyle H. Ungar and Ruzena Bajcsy}, + title = {Active Learning for Vision-Based Robot Grasping}, + journal = {Machine Learning}, + volume = {23}, + year = {1996}, + pages = {251--278}, + publisher = {Kluwer Academic Publishers}, + url = {http://www.springerlink.com/index/L738U7026765L077.pdf} +} + +@book{PLN, + author = {Ben Goertzel and Matthew Ikle and Izabela Lyon Freire Goertzel}, + title = {Probabilistic Logic Networks: A Comprehensive Framework + for Uncertain Inference}, + publisher = {Springer}, + year = {2008}, + isbn = {0-387-76871-8} +} + + +@inproceedings{LG09, + author = {Moshe Looks and Ben Goertzel}, + title = {Program Representation for General Intelligence}, + booktitle = {Proceedings of AGI'09}, + year = {2009}, + url = {http://agi-conf.org/2009/papers/paper_69.pdf} +} + +@inproceedings{K09, + author = {{\L}ukasz Kaiser}, + title = {Synthesis for Structure Rewriting Systems}, + booktitle = {Proceedings of the 34th International Symposium on Mathematical Foundations of Computer Science, MFCS '09}, + publisher = {Springer}, + series = {LNCS}, + volume = {5734}, + year = {2009}, + pages = {415--427}, + url = {http://logic.rwth-aachen.de/~kaiser/graph_games_short.pdf}, +} + +@misc{toss, + title={Toss}, + howpublished={\url{http://toss.sourceforge.net}} +} + +@inproceedings{AS94, + author = {Rakesh Agrawal and + Ramakrishnan Srikant}, + title = {Fast Algorithms for Mining Association Rules in Large Databases}, + booktitle = {VLDB'94, Proceedings of 20th International Conference on Very + Large Data Bases}, + publisher = {Morgan Kaufmann}, + year = {1994}, + pages = {487--499}, + url = {http://ifsc.ualr.edu/xwxu/Teaching/SciDB/vldb94Apriori.pdf} +} + +@phdthesis{Gel07, + author = {Sylvain Gelly}, + title = {A Contribution to Reinforcement Learning; Application to Computer-Go}, + school = {University of Paris Sud}, + type = {Dissertation}, + year = {2007}, + url = {http://www.lri.fr/~gelly/paper/SylvainGellyThesis.pdf} +} + +@inproceedings{HP09, + author = {Joseph Y. Halpern and Rafeal Pass}, + title = {Iterated regret minimization: A new solution concept}, + booktitle = {Proceedings of the 21st International Joint Conference on + Artificial Intelligence (IJCAI 2009)}, + year = {2009}, + pages = {153--158}, + url = {http://www.cs.cornell.edu/~rafael/papers/regret.pdf} +} + +@incollection{T97, + author = {Wolfgang Thomas}, + title = {Ehrenfeucht Games, the Composition Method, and the Monadic + Theory of Ordinal Words}, + booktitle = {Structures in Logic and Computer Science}, + series = {LNCS}, + year = {1997}, + publisher = {Springer}, + pages = {118--143}, + volume = {1261}, + url = {http://automata.rwth-aachen.de/download/papers/thomas/ehrfeu.pdf} +} + +@inproceedings{FB08, + author = {Hilmar Finnsson and Yngvi Bj{\"o}rnsson}, + title = {Simulation-based Approach to General Game Playing}, + booktitle = {Proc.~of AAAI'08}, + publisher = {{AAAI} Press}, + year = {2008}, + url = {http://ru.is/faculty/hif/papers/cadiaplayer_aaai08.pdf} +} + +@article{GLP05, + author = {Michael R. Genesereth and Nathaniel Love and Barney Pell}, + title = {General Game Playing: Overview of the {AAAI} Competition}, + journal = {AI Magazine}, + year = {2005}, + volume = {26}, + number = {2}, + pages = {62--72}, + url = {http://games.stanford.edu/competition/misc/aaai.pdf} +} + +@article{GH06D_ag, + author = {Holger Giese and Stefan Henkler}, + title = {A Survey of Approaches for the Visual Model-Driven Development + of Next Generation Software-Intensive Systems}, + journal = {Journal of Visual Languages and Computing}, + year = {2006}, + volume = {17}, + number = {6}, + pages = {528--550}, + month = {12} +} + +@article{BGMOKS06_ag, + author = {Sven Burmester and Holger Giese and Eckehard M{\"u}nch and + Oliver Oberschelp and Florian Klein and Peter Scheideler }, + title = {Tool Support for the Design of Self-Optimizing Mechatronic + Multi-Agent Systems}, + journal = {International Journal on Software Tools for Technology Transfer}, + year = {2008}, + volume = {10}, + number = {3}, + pages = {207--222}, + month = {6}, + publisher = {Springer}, +} + +@inproceedings{G06, + author = {Ben Goertzel}, + title = {Patterns, Hypergraphs and Embodied General Intelligence}, + booktitle = {Proceedings of the International Joint Conference on Neural + Networks, IJCNN 2006, part of the IEEE World Congress on + Computational Intelligence, WCCI 2006, Vancouver, BC, Canada, + 16-21 July 2006}, + year = {2006}, + pages = {451--458}, + url = {http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.99.2741&rep=rep1&type=pdf} +} + +@inproceedings{DRDM03, + author = {Mehdi Dastani and + Birna van Riemsdijk and + Frank Dignum and + John-Jules Ch. Meyer}, + title = {A Programming Language for Cognitive Agents: Goal Directed 3APL}, + booktitle = {Proceedings of Programming Multi-Agent Systems, First + International Workshop, ProMAS 2003, Melbourne, Australia, + July 15, 2003, Selected Revised and Invited Papers}, + pages = {111--130}, + publisher = {Springer}, + series = {LNCS}, + volume = {3067}, + year = {2003} +} + +@inproceedings{AFHMS03, + author = {Luca de Alfaro and + Marco Faella and + Thomas A. Henzinger and + Rupak Majumdar and + Mari{\"e}lle Stoelinga}, + title = {The Element of Surprise in Timed Games}, + booktitle = {Proceedings of CONCUR 2003, France, 2003}, + pages = {142--156}, + publisher = {Springer}, + series = {LNCS}, + volume = {2761}, + year = {2003}, + url = {http://mtc.epfl.ch/~tah/Publications/the_element_of_surprise_in_timed_games.pdf} +} + +@article{GrGu98, + author = {Erich Gr{\"a}del and Yuri Gurevich}, + title = {Metafinite Model Theory}, + journal = {Information and Computation}, + volume = {140}, + year = {1998}, + pages = {26--81}, + url = {http://www.logic.rwth-aachen.de/pub/graedel/infcomp.ps}, +} Copied: trunk/Toss/www/reference/reference.tex (from rev 1353, trunk/Toss/www/reference.tex) =================================================================== --- trunk/Toss/www/reference/reference.tex (rev 0) +++ trunk/Toss/www/reference/reference.tex 2011-03-12 17:51:51 UTC (rev 1354) @@ -0,0 +1,729 @@ +\documentclass{scrbook} + +% Font choice +\usepackage[sc]{mathpazo} +\usepackage{bera} + +% Abbreviations for \calX, \frakX, \bbX etc. in math mode +\makeatletter +\newcommand{\@abbrev}[3]{ + \def\c@a@def##1{ + \if ##1. + \relax + \else + \@ifdefinable{\@nameuse{#1##1}}{\@namedef{#1##1}{#2##1}} + \expandafter\c@a@def + \fi + } + \c@a@def #3. +} +\@abbrev{bb}{\mathbb}{ABCDEFGHIJKLMNOPQRSTUVWXYZ} +\@abbrev{bf}{\mathbf}{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz} +\@abbrev{bit}{\boldsymbol}{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz} +\@abbrev{cal}{\mathcal}{ABCDEFGHIJKLMNOPQRSTUVWXYZ} +\@abbrev{frak}{\mathfrak}{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz} +\@abbrev{rm}{\mathrm}{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz} +\@abbrev{scr}{\mathscr}{ABCDEFGHIJKLMNOPQRSTUVWXYZ} +\@abbrev{sf}{\mathsf}{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz} +\makeatother + +% Simple item labels +\renewcommand{\labelitemi}{--} +\renewcommand{\labelitemii}{--} +\renewcommand{\labelitemiii}{--} + +% Packages +\usepackage{amsmath,amssymb,amsthm} +\usepackage{enumerate} +\usepackage{xspace} +\usepackage{tikz} +\usetikzlibrary{shapes,snakes,arrows} +\usepackage[draft]{fixme} + +% Additional commands +\newcommand{\cf}{cf.\xspace} +\newcommand{\ea}{\& al.\xspace} +\newcommand{\eg}{e.g.\xspace} +\newcommand{\ie}{i.e.\xspace} +\newcommand{\mr}[1]{\mathrm{#1}} +\newcommand{\ol}[1]{\overline{#1}} +\renewcommand{\phi}{\varphi} + + +% Start +\newcommand\thetitle{Toss Design and Specification} +\title{\thetitle} +\date{} +\author{Toss Team} + +\begin{document} + +\maketitle + +\setcounter{tocdepth}{1} + +\tableofcontents +\clearpage +\listoffigures + +\cleardoublepage + + +\chapter{Specification} + +\section{Discrete Structure Rewriting} + +To represent a state of our model in a fixed moment of time +we use finite relational structures, \ie labelled directed hypergraphs. +A relational structure $\frakA = (A, R_1, \ldots, R_k)$ is composed of +a universe $A$ and a number of relations $R_1, \ldots, R_k$. +We denote the arity of $R_i$ by $r_i$, so $R_i \subseteq A^{r_i}$. +The \emph{signature} of $\frakA$ is the set of symbols $\{R_1, \ldots, R_k\}$. + +The dynamics of the model, \ie the way the structure can change, +is described by \emph{structure rewriting rules}, a generalized form of +term and graph rewriting. Extended graph rewriting is recently viewed as +the programming model of choice for complex multi-agent systems, +especially ones with real-valued components \cite{BGMOKS06_ag}. +%Practical utility of such models was verified in a german project developing +%automomous railway vehicle control, the Collaborative Research Center 614. +Moreover, this form of rewriting is well suited for visual programming and +helps to make the systems understandable. %(see \cite{GH06D_ag} for a survey). + +In the most basic setting, a rule $\frakL \to_s \frakR$ consists of +two finite relational structures $\frakL$ and $\frakR$ over the same +signature and a partial function $s : \frakR \to \frakL$ specifying which +elements of $\frakL$ will be substituted by which elements of $\frakR$. + +Let $\frakA, \frakB$ be two structures, $\tau_{\mr{e}}$ a set of relations +symbols to be matched exactly and $\tau_{\mr{h}}$ a set of relations to +be matched only positively. In practice, we also allow some +tuples in $\frakL$ to be optional; this is a shorthand +for multiple rules with the same right-hand side. Optional tuples can +also appear in $\frakR$ if all elements in the tuple have corresponding +elements in $\frakL$. In such case, the tuple is included in $\frakR$ if +and only if a corresponding optional tuple appeared in $\frakL$. +A function $f : \frakA \hookrightarrow \frakB$ is +a $(\tau_{\mr{e}}, \tau_{\mr{h}})$-\emph{embedding} if $f$ is injective, +for each $R_i \in \tau_{\mr{e}}$ it holds that + $(a_1, \ldots, a_{r_i}) \in R^\frakA_i \Leftrightarrow + (f(a_1), \ldots, f(a_{r_i})) \in R^\frakB_i$, +and for $R_j \in \tau_{\mr{h}}$ it holds that + $(a_1, \ldots, a_{r_i}) \in R^\frakA_j \Rightarrow + (f(a_1), \ldots, f(a_{r_i})) \in R^\frakB_j$. +A $(\tau_{\mr{e}}, \tau_{\mr{h}})$-\emph{match} of the rule $\frakL \to_s \frakR$ +in another structure $\frakA$ is an $(\tau_{\mr{e}}, \tau_{\mr{h}})$-embedding +$\sigma : \frakL \hookrightarrow \frakA$. +We define the result of an application of $\frakL \to_s \frakR$ to $\frakA$ +on the match $\sigma$ as $\frakB = \frakA[\frakL \to_s \frakR / \sigma]$, +such that the universe of $\frakB$ is given by +$(A \setminus \sigma(L)) \dot\cup R$, and the relations as follows. +A tuple $(b_1, \ldots, b_{r_i})$ is in the new relation $R^\frakB_i$ +if and only if either it is in the relation in $\frakR$ already, +$(b_1, \ldots, b_{r_i}) \in R^\frakR_i$, or there exists a tuple in +the previous structure, $(a_1, \ldots, a_{r_i}) \in R^\frakA_i$, +such that for each $i$ either $a_i = b_i$ or $a_i = \sigma(s(b_i))$, +\ie either the element was there before or it was matched and $b_i$ +is the replacement as specified by the rule. Moreover, +if $R_i \in \tau_{\mr{e}}$ then we require in the second case that +at least one $b_i$ was already in the original structure, \ie $b_i = a_i$. +To understand this definition it is best to consider an example, +and one is given in Figure~\ref{fig-rewriting}. + +\begin{figure} +$\phantom{ll}$ +\begin{tikzpicture}[scale=0.7] +\node (a) at (-6, 1) {Rewriting Rule:}; +\node[draw, circle] (lhs1) at (-2.6, 1) {\tiny $a$}; +\node[draw, circle] (lhs2) at (-1.5, 1) {\tiny $b$}; +\path (lhs1) edge[->] node[above] {\tiny $R$} (lhs2); + +\node (t) at (-0.5, 1) {$\leadsto$}; + +\node[draw, circle, fill=black!15] (rhs1) at (0.6, 1.5) {\tiny $a$}; +\node[draw, circle, fill=black!15] (rhs2) at (1.8, 1.5) {\tiny $b$}; +\node[draw, circle, fill=black!15] (rhs3) at (3, 1.5) {\tiny $b$}; +\node[draw, circle, fill=black!15] (rhs4) at (1.8, 0.5) {\tiny $\phantom{a}$}; +\draw[->] (rhs2) -- (rhs1); +\draw[->] (rhs2) -- (rhs3); +\draw[->] (rhs2) -- (rhs4); +\end{tikzpicture} +\begin{center} +\vskip -1em +\begin{tikzpicture}[scale=0.59] +\scriptsize + +% Graph to be rewritten. +\node[draw, circle] (v) at (-7, 0) {$a$}; +\node[draw, circle] (v1) at (-6, 2) {}; +\node[draw, circle] (v2) at (-6, -2) {}; +\node[draw, circle] (w) at (-4, 0) {$b$}; +\node[draw, circle] (w1) at (-5, 2) {}; +\node[draw, circle] (w2) at (-5, -2) {}; +\node[draw, circle] (vu) at (-8, 2) {}; +\node[draw, circle] (vd) at (-8, -2) {}; +\node[draw, circle] (wu) at (-3, 2) {}; +\node[draw, circle] (wd) at (-3, -2) {}; + +\path (v) edge[thick,->] node[midway,above] {$R$} (w); +\draw[->] (v) -- (v1); +\draw[->] (v) -- (v2); +\draw[->] (w1) -- (w); +\draw[->] (w2) -- (w); +\draw[->] (vu) -- (v); +\draw[->] (vd) -- (v); +\draw[->] (w) -- (wu); +\draw[->] (w) -- (wd); + +\node (lto) at (-2.5, 0) {\normalsize $\leadsto$}; + +% Resulting graph +\node[draw, circle, fill=black!15] (rr1) at (-1.2, 0) {}; +\node[draw, circle, fill=black!15] (rr2) at (0.8, 0) {}; +\node[draw, circle, fill=black!15] (rr3) at (2.8, 0) {}; +\node[draw, circle, fill=black!15] (rr4) at (0.8, -1) {}; + +\node[draw, circle] (rv1u) at (-1.9, 2) {}; +\node[draw, circle] (rv1d) at (-1.9, -2) {}; +\node[draw, circle] (rv2u) at (-0.5, 2) {}; +\node[draw, circle] (rv2d) at (-0.5, -2) {}; +\node[draw, circle] (rw1u) at (2.1, 2) {}; +\node[draw, circle] (rw1d) at (2.1, -2) {}; +\node[draw, circle] (rw2u) at (3.5, 2) {}; +\node[draw, circle] (rw2d) at (3.5, -2) {}; + +\draw[thick,->] (rr2) -- (rr1); +\draw[thick,->] (rr2) -- (rr3); +\draw[thick,->] (rr2) -- (rr4); + +\draw[->] (rv1u) -- (rr1); +\draw[->] (rv1d) -- (rr1); +\draw[->] (rr1) -- (rv2u); +\draw[->] (rr1) -- (rv2d); + +%\draw[->] (rr2) -- (rv2u); +%\draw[->] (rr2) -- (rv2d); +\draw[->] (rr2) .. controls (1.8, 2.5) .. (rw2u); +\draw[->] (rr2) .. controls (1.8, -2.5) .. (rw2d); +\draw[->] (rw1u) -- (rr2); +\draw[->] (rw1d) -- (rr2); +%\path (rv1u) edge[->,bend left=60] (rr2); +%\draw[->] (rv1d) .. controls (0.5, -2.5) .. (rr2); + +\draw[->] (rw1u) -- (rr3); +\draw[->] (rw1d) -- (rr3); +\draw[->] (rr3) -- (rw2u); +\draw[->] (rr3) -- (rw2d); +\end{tikzpicture} +\end{center} +\caption{Rewriting rule and its application to a structure.} +\label{fig-rewriting} +\end{figure} + + +\section{Continuous Evolution} + +To model continuous dynamics in our system, we supplement relational +structures with a number of labeling functions $f_1, \ldots, f_l$, +each $f_i : A \to \bbR$ ($A$ is the universe).\footnote{In fact $f_i(a)$ is not +in $\bbR$; it is a function $\epsilon \to (x,x+\delta), \delta < \epsilon$.} +Accordingly, each rewriting rule is extended by a system of ordinary +differential equations (ODEs) and a set of right-hand update equations. +We use a standard form of ODEs: +$f^k_{i,l} = t(f^0_{i,l}, \ldots, f^{k-1}_{i,l})$, where $f_i$ are +the above-mentioned functions, $l$ can be any element of the left-hand +side structure and $f^k$ denotes the $k$-th derivative of $f$. +The term $t(\ol{x})$ is constructed using standard arithmetic functions +$+, -, \cdot, /$, natural roots $\sqrt[n]{\phantom{a}}$ for $n > 1$ +and rational numbers $r \in \bbQ$ in addition to the variables $\ol{x}$ and +a set of parameters $\ol{p}$ fixed for each rule. +%This form is enough to express most ODEs used in physics and economics. +The set of right-hand side update equations contains one equation of +the form $f_{i, r} = t(\ol{f_{i,l}})$ for each function $f_i$ and +each $r$ from the right-hand side structure. + +Let $\calR = \{ (\frakL_i \to_{s_i} \frakR_i, \calD_i, \calT_i) \mid i < n \}$ +be a set of rules extended with ODEs $\calD_i$ and update equations $\calT_i$ +as described above. +Given, for each rule in $\calR$, a match $\sigma_i$ of the rule in a structure +$\frakA$, the required parameters $\ol{p_i}$ and a time bound $t_i$, we define +the result of a \emph{simultaneous application} of $\calR$ to $\frakA$, +denoted $\frakA[\calR/\{\sigma_i, t_i\}]$, as follows. +We assume that no two intersecting rules have identical time bounds. + +First, the structure $\frakA$ evolves in a continuous way as given by +the \emph{sum} of all equations $\calD_i$. More precisely, let $\calD$ be +a system of differential equations where for each $a \in \frakA$ there +exists an equation defining $f^k_{i,a}$ if and only if there exists an +equation in some $\calD_j$ for $f^k_{i,l}$ for some $l$ with $\sigma_j(l) = a$. +In such case, the term for $f^k_{i,a}$ is the sum of all terms for such $l$, +with each $f^m_{i, l}$ replaced by the appropriate $f^m_{i, \sigma_j(l)}$. +Assuming that all functions $f_i$ and all their derivatives are given at +the beginning, there is a unique solution for these variables which satisfies +$\calD$ and has all other, undefined derivatives set by the starting condition +from $\frakA$. This solution defines the value of $f_{i,a}(t)$ for +each $a \in \frakA$ at any time moment $t$. + +Let $t^0 = \min_{i<n} t_i$ be the lowest chosen time bound and let +$i_0, \ldots, i_k$ be all rules with this bound, \ie each $t_{i_m} = t^0$. +We apply each of these rules independently$^1$ to the structure $\frakA$ +at time $t^0$. Formally, the relational part of +$\frakA[\calR/\{\sigma_i, t_i\}]$ is equal to +$\frakA[\frakL_{i_0} \to_{s_{i_0}} \frakR_{i_0}/\sigma_{i_0}] \cdots + [\frakL_{i_k} \to_{s_{i_k}} \frakR_{i_k}/\sigma_{i_k}]$ and the function values +$f_i(a)$ are defined as follows. If the element $a$ was not changed, +$a \in \frakA$, then we keep the function value from the solution of $\calD$, +\ie $f_i(a) = f_{i,a}(t^0)$. In the other case $a$ was on the right-hand side +of some rule, $a \in \frakR_m$. Let $f_{i,a} = t(\ol{f_{j,l}})$ be the +equation in $\calT_m$ defining $f_{i,a}$. The new value of $f_i(a)$ is then +computed by inserting the appropriate values for $f_{j,l}$ from the solution +of $\calD$ into $t(\ol{f_{j,l}})$, \ie $f_i(a) = t(\ol{y_{j,l}})$ where +each $y_{j,l} = f_{j,\sigma_m(l)}(t^0)$. %with $\ol{p_j}$ used as parameters. + +\emph{Example.} +Let us define a simple two-dimensional model of a cat chasing a mouse. +The structure we use, $\frakA = (\{c, m\}, C, M, x, y)$, has two elements +$c$ and $m$, unary relations $C = \{c\}$ and $M = \{m\}$ used to identify +which element is which and two real-valued functions $x$ and $y$. +Both rewriting rules have only one element, both on the left-hand side and +on the right-hand side, and the element is in $C$ for the cat rule and +in $M$ for the mouse rule. The ODEs for both rules are of the form +$x' = p_x, y' = p_y$, where $p_x, p_y$ are parameters. The update +equations just keep the left-hand side values, $x_r = x_l, y_r = y_l$. +In this setting, simultaneous application of the cat rule with parameters +$p^c_x, p^c_y$ for time $t^c$ and the mouse rule with parameters $p^m_x, p^m_y$ +for time $t^m$ will have the following effect: The cat will move with +speed $p^c_x$ along the $x$-axis and $p^c_y$ along the $y$-axis and the mouse +analogously with $p^m_x$ and $p^m_y$, both for time $t^0 = \min(t^c, t^m)$. + + +\section{Logic and Constraints} + +The logic we use for specifying properties of states is an extension of +monadic second-order logic with real-valued terms and counting operators. +%(\cf \cite{GrGu98}). +The main motivation for the choice of such logic is \emph{compositionality}: +To evaluate a formula on a large structure $\frakA$ which is composed in +a regular way from substructures $\frakB$ and $\frakC$ it is enough +to evaluate certain formulas on $\frakB$ and $\frakC$ independently. +Monadic second-order logic is one of the most expressive logics +with this property and allows to define various useful patterns such as stars, +connected components or acyclic subgraphs. (Additional syntactic +shorthands can be provided for useful patterns.) + +In the syntax of our logic, we use first-order variables +($x_1, x_2, \ldots$) ranging over elements of the structure, second-order +variables ($X_1, X_2, \ldots$) ranging over \emph{sets} of elements, +and real-valued variables $(\alpha_1, \alpha_2, \ldots)$ ranging over $\bbR$, +and we distinguish boolean formulas $\phi$ and real-valued terms $\rho$: +\begin{eqnarray*} + \phi := & \!\!\!\!\! R_i(x_1, \ldots, x_{r_i}) \, |\, x_i=x_j \, |\, + x_i \in X_j \, | \, \rho <_\epsilon \rho \, | \, \phi \land \phi \ | \\ + & \!\!\! \phi \lor \phi \, | \, \neg \phi \, | \, + \exists x_i \phi \, | \, \forall x_i \phi \, | \, + \exists X_i \phi \, | \, \forall X_i \phi \, | \, + \exists \alpha_i \phi \, | \, \forall \alpha_i \phi, +\end{eqnarray*} +\vskip -1.1em +\begin{eqnarray*} +\rho := & \!\!\!\! \alpha_i \: | \: f_i(x_j) \: | \: %\rho + \rho \ | \ + \rho \dotplus \rho \: | \: \chi[\phi] \: | \: \min_{\alpha_i}\!\phi \: | \: + \sum_{\ol{x} \mid \phi} \rho \: | \: \prod_{\ol{x} \mid \phi} \rho. +\end{eqnarray*} + +Semantics of most of the above operators is defined in the well known way, \eg +$\rho+\rho$ is the sum and $\rho \cdot \rho$ the product of real-valued terms, +and $\exists X \phi(X)$ means that there exists a set of elements $S$ such +that $\phi(S)$ holds. Among less known operators, +the term $\chi[\phi]$ denotes the characteristic function of $\phi$, \ie +the real-valued term which is $1$ for all assignments for which $\phi$ holds +and $0$ for all other. To evaluate $\min_{\alpha_i}\phi$ we take the minimal +$\alpha_i$ for which $\phi$ holds (we allow $\pm \infty$ as values +of terms as well). The terms $\sum_{\ol{x} \mid \phi} \rho$ and +$\prod_{\ol{x} \mid \phi} \rho$ denote the sum and product of the values of +$\rho(\ol{x})$ for all assignments of elements of the structure to $\ol{x}$ +for which $\phi(\ol{x})$ holds. Note that both these terms can have free +variables, \eg the set of free variables of $\sum_{\ol{x} \mid \phi} \rho$ +is the union of free variables of $\phi$ and free variables of $\rho$, minus +the set $\{\ol{x}\}$. Observe also the $\epsilon$ in $<_\epsilon$: +the values $f(a)$ are given with arbitrary small but non-zero error +and $\rho_1 <_\epsilon \rho_2$ holds only if the upper +bound of $\rho_1$ lies below the lower bound of $\rho_2$. +%both terms queried with error bound $\epsilon$. + +The logic defined above is used in structure rewriting rules in two ways. +First, it is possible to define a new relation $R(\ol{x})$ using a formula +$\phi(\ol{x})$ with free variables contained in~$\ol{x}$. +Defined relations can be used on left-hand sides of structure +rewriting rules, but are not allowed on right-hand sides. +The second way is to add \emph{constraints} to a rule. +A rule $\frakL \to_s \frakR$ can be constrained using +three sentences (\ie formulas without free variables): +$\phi_{\mr{pre}}$, $\phi_{\mr{inv}}$ and $\phi_{\mr{post}}$. +In both $\phi_{\mr{pre}}$ and $\phi_{\mr{inv}}$ we allow additional constants $l$ +for each $l \in \frakL$ and in $\phi_{\mr{post}}$ special constants for each +$r \in \frakR$ can be used. A rule $\frakL \to_s \frakR$ with such constraints +can be applied on a match $\sigma$ in $\frakA$ only if the following holds: +At the beginning, the formula $\phi_{\mr{pre}}$ must hold in $\frakA$ with +the constants $l$ interpreted as $\sigma(l)$. Later, during the whole +continuous evolution, the formula $\phi_{\mr{inv}}$ must hold in the structure +$\frakA$ with continuous values changed as prescribed by the solution of +the system $\calD$ (defined above). +Finally, the formula $\phi_{\mr{post}}$ must hold in the resulting +structure after rewriting. During simultaneous execution of a few rules with +constraints and with given time bounds $t_i$, one of the invariants +$\phi_{\mr{inv}}$ may cease to hold. In such case, the rule is applied at +that moment of time, even before $t^0 = \min t_i$ is reached --- but of +course only if $\phi_{\mr{post}}$ holds afterwards. If $\phi_{\mr{post}}$ +does not hold, the rule is ignored and time goes on for the remaining rules. + + +\section{Structure Rewriting Games} + +As you could judge from the cat and mouse example, one can describe +a structure rewriting game simply by providing a set of allowed rules for +each player. Still, in many cases it is necessary to have more control +over the flow of the game and to model probabilistic events. +For this reason, we use labelled directed graphs with probabilities +in the definition of the games. The labels for each player are of the form: +\[ \lambda = (\frakL \to_s \frakR, \calD, \calT, + \phi_{\mr{pre}}, \phi_{\mr{inv}}, \phi_{\mr{post}}, + I_t, \ol{I_p}, \mr{m}, \tau_{\mr{e}}). \] +Except for a rewriting rule with invariants, the label $\lambda$ specifies +a time interval $I_t \subseteq [0, \infty)$ from which the player can +choose the time bound for the rule and, if there are other continuous +parameters $p_1, \ldots, p_n$, also an interval $I_{p_j} \subseteq \bbR$ +for each parameter. The element $\mr{m} \in \{1, \ast, \infty\}$ +specifies if the player must choose a single match of the rule ($\mr{m} = 1$), +apply it simultaneously to all possible matches ($\mr{m} = \infty$, useful for +modeling nature) or if any number of non-intersecting matches might be chosen +($\mr{m} = \ast$); $\tau_{\mr{e}}$ tells which relations must be matched +exactly (all other are in $\tau_{\mr{h}}$). + +We define a \emph{general structure rewriting game} with $k$ players as +a directed graph in which each vertex is labelled by $k$ sets of labels +denoting possible actions of the players. +For each $k$-tuple of labels, one from each set, there must be an outgoing edge +labelled by this tuple, pointing to the next location of the game if these +actions are chosen by the players. There can be more than one outgoing edge +with the same label in a vertex: In such case, all edges with this label must +be assigned probabilities (\ie positive real numbers which sum up to~$1$). +Moreover, an end-point of an interval $I_t$ or $I_p$ in a label can be given +by a parameter, \eg $x$. Then, each outgoing edge with this label must +be marked by $x \! \sim \! \calN(\mu,\sigma)$, $x \! \sim \! \calU(a,b)$ or +$x \! \sim \! \calE(\lambda)$, meaning that $x$ will be drawn from the normal, +uniform or exponential distribution (these $3$ chosen for convenience). +Additionally, in each vertex there are $k$ real-valued terms of the logic +presented above which denote the payoff for each player if the game +ends at this vertex. + +A play of a structure rewriting game starts in a fixed first vertex of +the game graph and in a state represented by a given starting structure. +All players choose rules, matches and time bounds allowed by the labels of +the current vertex such that the tuple of rules can be applied simultaneously. +The play proceeds to the next vertex (given by the labeling of the edges) +in the changed state (after the application of the rules). +If in some vertex and state it is not possible to apply any tuple of rules, +either because no match is found or because of the constraints, then the play +ends and payoff terms are evaluated giving the outcome for each player. + +\begin{figure} +\begin{center} +\begin{tikzpicture}[scale=0.71] \tiny +% Game Graph +\node (gg) at (-6.2, 2) {\small Game Graph:}; +\node[draw, circle, fill=black!15] (p0) at (-4, 2) {}; +\node[draw, circle, fill=black!15] (p1) at (-4, 0) {}; +\draw[->] (-4, 2.5) -- (p0); +\path (p0) edge[bend right=30,->] (p1); +\path (p1) edge[bend right=30,->] (p0); + +\node[draw,circle] (r0l) at (-5.8, 1) {$\phantom{a}$}; +\node (r0m) at (-5.3, 0.98) {$\leadsto$}; +\node[draw,circle] (r0r) at (-4.8, 1) {$P$}; + +\node[draw,circle] (r1l) at (-3.2, 1) {$\phantom{a}$}; +\node (r0m) at (-2.7, 0.98) {$\leadsto$}; +\node[draw,circle] (r0r) at (-2.2, 1) {$Q$}; + +% Starting Structure +\node (ss) at (-1.5, 2) {\small Starting Structure:}; +\foreach \x in {1, ..., 3} \foreach \y in {0, ..., 2} { + \node[draw, circle] (n\x\y) at (\x, \y) {$\phantom{a}$}; +} + +\foreach \x in {1, ..., 3} \foreach \y / \n in {0/1, 1/2} { + \path (n\x\n) edge[->] node[right] {$C$} (n\x\y); +} + +\foreach \y in {0, ..., 2} \foreach \x / \n in {1/2, 2/3} { + \path (n\x\y) edge[->] node[above] {$R$} (n\n\y); +} +\end{tikzpicture} +\end{center} +\caption{Tic-tac-toe as a structure rewriting game.} +\label{fig-tic-tac-toe} +\end{figure} + +\emph{Example.} Let us define tic-tac-toe in our framework. +The state of the game is represented by a structure with $9$ elements +connected by binary row and column relations, $R$ and $C$, as depicted +on the right in Figure~\ref{fig-tic-tac-toe}. To mark the moves of the players +we use unary relations $P$ and $Q$. The allowed move of the first player +is to m... [truncated message content] |
From: <luk...@us...> - 2011-03-12 04:23:34
|
Revision: 1353 http://toss.svn.sourceforge.net/toss/?rev=1353&view=rev Author: lukaszkaiser Date: 2011-03-12 04:23:27 +0000 (Sat, 12 Mar 2011) Log Message: ----------- Ideas page, some first www corrections. Modified Paths: -------------- trunk/Toss/www/.cvsignore trunk/Toss/www/contact.xml trunk/Toss/www/navigation.xml Added Paths: ----------- trunk/Toss/www/ideas.xml Removed Paths: ------------- trunk/Toss/WebClient/pics/Checkers.html Property Changed: ---------------- trunk/Toss/www/ trunk/Toss/www/Publications/ Deleted: trunk/Toss/WebClient/pics/Checkers.html =================================================================== --- trunk/Toss/WebClient/pics/Checkers.html 2011-03-11 18:41:40 UTC (rev 1352) +++ trunk/Toss/WebClient/pics/Checkers.html 2011-03-12 04:23:27 UTC (rev 1353) @@ -1,16 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xml:lang="en" lang="en"> -<head> - <meta http-equiv="Content-Type" content="text/xhtml+xml; charset=UTF-8" /> - <title>tPlay</title> - <meta name="Description" - content="Play the best strategic games online with a nice interface." /> - <meta http-equiv="X-UA-Compatible" content="chrome=1" /> - <link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico" /> - <link href="fontstyle.css" media="screen" rel="stylesheet" type="text/css" /> - <link rel="stylesheet" type="text/css" href="Style.css" media="screen" title="Default"/> -</head> -<body> -<svg id="svg" class="Game-Checkers" viewBox="0 0 580 580"><rect class="model-elem-0" x="4.285714285714285" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_a1" ></rect><rect class="model-elem-1" x="75.71428571428572" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_b1" ></rect><rect class="model-elem-0" x="147.14285714285714" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_c1" ></rect><rect class="model-elem-1" x="218.57142857142856" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_d1" ></rect><rect class="model-elem-0" x="290" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_e1" ></rect><rect class="model-elem-1" x="361.42857142857144" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_f1" ></rect><rect class="model-elem-0" x="432.85714285714283" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_g1" ></rect><rect class="model-elem-1" x="504.2857142857143" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_h1" ></rect><rect class="model-elem-1" x="4.285714285714285" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_a2" ></rect><rect class="model-elem-0" x="75.71428571428572" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_b2" ></rect><rect class="model-elem-1" x="147.14285714285714" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_c2" ></rect><rect class="model-elem-0" x="218.57142857142856" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_d2" ></rect><rect class="model-elem-1" x="290" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_e2" ></rect><rect class="model-elem-0" x="361.42857142857144" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_f2" ></rect><rect class="model-elem-1" x="432.85714285714283" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_g2" ></rect><rect class="model-elem-0" x="504.2857142857143" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_h2" ></rect><rect class="model-elem-0" x="4.285714285714285" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_a3" ></rect><rect class="model-elem-1" x="75.71428571428572" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_b3" ></rect><rect class="model-elem-0" x="147.14285714285714" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_c3" ></rect><rect class="model-elem-1" x="218.57142857142856" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_d3" ></rect><rect class="model-elem-0" x="290" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_e3" ></rect><rect class="model-elem-1" x="361.42857142857144" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_f3" ></rect><rect class="model-elem-0" x="432.85714285714283" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_g3" ></rect><rect class="model-elem-1" x="504.2857142857143" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_h3" ></rect><rect class="model-elem-1" x="4.285714285714285" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_a4" ></rect><rect class="model-elem-0" x="75.71428571428572" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_b4" ></rect><rect class="model-elem-1" x="147.14285714285714" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_c4" ></rect><rect class="model-elem-0" x="218.57142857142856" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_d4" ></rect><rect class="model-elem-1" x="290" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_e4" ></rect><rect class="model-elem-0" x="361.42857142857144" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_f4" ></rect><rect class="model-elem-1" x="432.85714285714283" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_g4" ></rect><rect class="model-elem-0" x="504.2857142857143" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_h4" ></rect><rect class="model-elem-0" x="4.285714285714285" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_a5" ></rect><rect class="model-elem-1" x="75.71428571428572" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_b5" ></rect><rect class="model-elem-0" x="147.14285714285714" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_c5" ></rect><rect class="model-elem-1" x="218.57142857142856" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_d5" ></rect><rect class="model-elem-0" x="290" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_e5" ></rect><rect class="model-elem-1" x="361.42857142857144" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_f5" ></rect><rect class="model-elem-0" x="432.85714285714283" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_g5" ></rect><rect class="model-elem-1" x="504.2857142857143" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_h5" ></rect><rect class="model-elem-1" x="4.285714285714285" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_a6" ></rect><rect class="model-elem-0" x="75.71428571428572" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_b6" ></rect><rect class="model-elem-1" x="147.14285714285714" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_c6" ></rect><rect class="model-elem-0" x="218.57142857142856" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_d6" ></rect><rect class="model-elem-1" x="290" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_e6" ></rect><rect class="model-elem-0" x="361.42857142857144" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_f6" ></rect><rect class="model-elem-1" x="432.85714285714283" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_g6" ></rect><rect class="model-elem-0" x="504.2857142857143" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_h6" ></rect><rect class="model-elem-0" x="4.285714285714285" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_a7" ></rect><rect class="model-elem-1" x="75.71428571428572" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_b7" ></rect><rect class="model-elem-0" x="147.14285714285714" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_c7" ></rect><rect class="model-elem-1" x="218.57142857142856" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_d7" ></rect><rect class="model-elem-0" x="290" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_e7" ></rect><rect class="model-elem-1" x="361.42857142857144" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_f7" ></rect><rect class="model-elem-0" x="432.85714285714283" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_g7" ></rect><rect class="model-elem-1" x="504.2857142857143" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_h7" ></rect><rect class="model-elem-1" x="4.285714285714285" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_a8" ></rect><rect class="model-elem-0" x="75.71428571428572" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_b8" ></rect><rect class="model-elem-1" x="147.14285714285714" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_c8" ></rect><rect class="model-elem-0" x="218.57142857142856" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_d8" ></rect><rect class="model-elem-1" x="290" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_e8" ></rect><rect class="model-elem-0" x="361.42857142857144" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_f8" ></rect><rect class="model-elem-1" x="432.85714285714283" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_g8" ></rect><rect class="model-elem-0" x="504.2857142857143" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_h8" ></rect><circle class="model-pred-W" cx="40" cy="540" r="23.714285714285715" id="pred_a1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="182.85714285714286" cy="540" r="23.714285714285715" id="pred_c1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="325.7142857142857" cy="540" r="23.714285714285715" id="pred_e1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="468.57142857142856" cy="540" r="23.714285714285715" id="pred_g1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="111.42857142857143" cy="468.57142857142856" r="23.714285714285715" id="pred_b2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="254.28571428571428" cy="468.57142857142856" r="23.714285714285715" id="pred_d2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="397.14285714285717" cy="468.57142857142856" r="23.714285714285715" id="pred_f2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="540" cy="468.57142857142856" r="23.714285714285715" id="pred_h2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="40" cy="397.14285714285717" r="23.714285714285715" id="pred_a3_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="182.85714285714286" cy="397.14285714285717" r="23.714285714285715" id="pred_c3_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="325.7142857142857" cy="397.14285714285717" r="23.714285714285715" id="pred_e3_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="468.57142857142856" cy="397.14285714285717" r="23.714285714285715" id="pred_g3_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="111.42857142857143" cy="182.85714285714286" r="23.714285714285715" id="pred_b6_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="254.28571428571428" cy="182.85714285714286" r="23.714285714285715" id="pred_d6_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="397.14285714285717" cy="182.85714285714286" r="23.714285714285715" id="pred_f6_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="540" cy="182.85714285714286" r="23.714285714285715" id="pred_h6_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="40" cy="111.42857142857143" r="23.714285714285715" id="pred_a7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="182.85714285714286" cy="111.42857142857143" r="23.714285714285715" id="pred_c7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="325.7142857142857" cy="111.42857142857143" r="23.714285714285715" id="pred_e7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="468.57142857142856" cy="111.42857142857143" r="23.714285714285715" id="pred_g7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="111.42857142857143" cy="40" r="23.714285714285715" id="pred_b8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="254.28571428571428" cy="40" r="23.714285714285715" id="pred_d8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="397.14285714285717" cy="40" r="23.714285714285715" id="pred_f8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="540" cy="40" r="23.714285714285715" id="pred_h8_B" stroke-width="5.571428571428571" ></circle></svg> -</body> -</html> Property changes on: trunk/Toss/www ___________________________________________________________________ Modified: svn:ignore - # We are still using .cvsignore files as we find them easier to manage # than svn properties. Therefore if you change .cvsignore do the following. # svn propset svn:ignore -F .cvsignore . *.html reference.pdf *.ps *.dvi *.aux *.out *.log *.bbl *.blg *.idx *.thm *.snm *.nav *.toc *.flc *~ + # We are still using .cvsignore files as we find them easier to manage # than svn properties. Therefore if you change .cvsignore do the following. # svn propset svn:ignore -F .cvsignore . *.html *.html.de *.html.en *.texml *.xml.de *.xml.en reference.xml reference.pdf *.ps *.dvi *.aux *.out *.log *.bbl *.blg *.idx *.thm *.snm *.nav *.toc *.flc *~ Modified: trunk/Toss/www/.cvsignore =================================================================== --- trunk/Toss/www/.cvsignore 2011-03-11 18:41:40 UTC (rev 1352) +++ trunk/Toss/www/.cvsignore 2011-03-12 04:23:27 UTC (rev 1353) @@ -3,6 +3,12 @@ # svn propset svn:ignore -F .cvsignore . *.html +*.html.de +*.html.en +*.texml +*.xml.de +*.xml.en +reference.xml reference.pdf *.ps *.dvi Property changes on: trunk/Toss/www/Publications ___________________________________________________________________ Added: svn:ignore + # We are still using .cvsignore files as we find them easier to manage # than svn properties. Therefore if you change .cvsignore do the following. # svn propset svn:ignore -F .cvsignore . *.xml.de *.xml.en *.html *.html.de *.html.en all.texml all.xml *~ Modified: trunk/Toss/www/contact.xml =================================================================== --- trunk/Toss/www/contact.xml 2011-03-11 18:41:40 UTC (rev 1352) +++ trunk/Toss/www/contact.xml 2011-03-12 04:23:27 UTC (rev 1353) @@ -36,19 +36,19 @@ Gridlock is a collection of open-source board games. It is nice to play but is does not allow you to change the game in any easy way.</par> - <par><a href="http://www.zillions-of-games.com/">Zillions of Games</a><br/> + <par><br/><a href="http://www.zillions-of-games.com/">Zillions of Games</a><br/> Zillions of Games is a language for defining games together with a simulator and a large library of games. It is very nice but unluckily not open source.</par> - <par><a href="http://www.kurnik.pl/">Kurnik</a><br/> + <par><br/><a href="http://www.kurnik.pl/">Kurnik</a><br/> Kurnik is a polish site on which you can play various games.</par> - <par><a href="http://abstractstrategy.com/main.html">Abstract Strategy + <par><br/><a href="http://abstractstrategy.com/main.html">Abstract Strategy Games</a><br/> Abstract Strategy Games site allows you to learn and play such games.</par> - <par><a href="http://www.yourturnmyturn.com/">Your Turn My Turn</a><br/> + <par><br/><a href="http://www.yourturnmyturn.com/">Your Turn My Turn</a><br/> On Your-Turn-My-Turn you can play various board games online.</par> </section> @@ -59,17 +59,17 @@ Project. It can be used for simulation of systems with continuous dynamics.</par> - <par><a href="http://www.iseesystems.com/softwares/Education/StellaSoftware.aspx">STELLA</a><br/> + <par><br/><a href="http://www.iseesystems.com/softwares/Education/StellaSoftware.aspx">STELLA</a><br/> STELLA is a commercial simulator allowing both continuous and discrete dynamics.</par> - <par><a href="http://ptolemy.eecs.berkeley.edu/">Ptolemy</a><br/> + <par><br/><a href="http://ptolemy.eecs.berkeley.edu/">Ptolemy</a><br/> The Ptolemy project studies modelling, simulation, and design of concurrent, real-time, embedded systems. This advanced project allows to use various models of computation that govern the interactions between components.</par> - <par><a href="http://www.microsoft.com/esp/about_esp/overview.htm" + <par><br/><a href="http://www.microsoft.com/esp/about_esp/overview.htm" >Microsoft ESP</a><br/>ESP is a visual simulation platform that applies game-based technology to some more complex problems.</par> </section> @@ -79,20 +79,20 @@ <a href="http://www.algosyn.rwth-aachen.de/">AlgoSyn</a> research group. Many people contributed, here we name just a few. Current leaders:</par> <itemize> - <item>Łukasz Kaiser (<mailto address="ka...@li..."/>)</item> + <item>Łukasz Kaiser (<mailto address="luk...@gm..."/>)</item> <item>Tobias Ganzow</item> <item>Łukasz Stafiniak</item> + <item>Michał Wójcik</item> </itemize> - <par>Friends who helped us a lot with dicussion and code at some point.</par> + <par>Friends who helped us a lot with dicussion and code.</par> <itemize> <item>Dietmar Berwanger</item> <item>Matko Botincan</item> <item>Diana Fischer</item> - <item>Michał Wójcik</item> </itemize> - <par>Yet another group of people worked on the oldest version of Toss - (around 2004).</par> + <par>Yet another group of people, who worked on the oldest version of Toss + (around 2004), was lead by:</par> <itemize> <item>Alexander Kharitonov</item> <item>Peter Cholewinski</item> Added: trunk/Toss/www/ideas.xml =================================================================== --- trunk/Toss/www/ideas.xml (rev 0) +++ trunk/Toss/www/ideas.xml 2011-03-12 04:23:27 UTC (rev 1353) @@ -0,0 +1,240 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE lecture SYSTEM "xsl/xhtml1-lat1.ent"> + +<?xml-stylesheet type="text/xsl" href="xsl/main.xsl" charset="UTF-8"?> + +<personal> + <title lang="en">GSoC Ideas</title> + <title lang="de">GSoC Ideen</title> + <history> + <link id="ideas" href="/ideas.html">GSoC Ideas</link> + </history> + + <section title="Google Summer of Code 2011"> + <par>Toss is applying to participate in <em>Google Summer of Code</em> + in 2011. This page contains a few ideas for students who wish to work + on Toss this summer. But, most importantly, we welcome new ideas from + students who wish to participate! We are very positive about suggestions + and we think that best proposals (and code) come from students who are + simply passionate about realizing their own ideas!<br/></par> + </section> + + <section title="Your Project Proposal"> + <par>If you decide to present your own idea, here are a few questions + we would like to ask you. You can see a similar pattern in the ideas + presented below – please, use it!</par> + <itemize> + <item>Provide a concise and precise description of your idea.</item> + <item>What is the goal, what do you want to create at the end?</item> + <item>There must be something usable by mid-term. What will it be?</item> + <item>Make a list of smaller pieces you wish to construct and sketch + their dependencies.</item> + <item>Which pieces can you skip if it turns out to be necessary?</item> + <item>How will your code enrich Toss and help people create and play + games?</item> + </itemize> + </section> + + <section title="Contact"> + <par>If you have an idea, or just want to talk, contact us! + We will respond to all of the emails below, but <em>toss-devel</em> + is the place we prefer.</par> + <itemize> + <item>Toss Mailing List: + <mailto address="tos...@li..."/></item> + <item>Łukasz Kaiser (GSoC admin): + <mailto address="luk...@gm..."/></item> + <item>Łukasz Stafiniak (GSoC backup admin): + <mailto address="luk...@gm..."/></item> + <item>Michał Wójcik: + <mailto address="mic...@gm..."/></item> + </itemize> + </section> + + <section title="Idea: Go and Arimaa"> + <par><em>Description and Goals.</em> The ancient game + of <a href="http://en.wikipedia.org/wiki/Go_(game)">Go</a> and the modern + <a href="http://en.wikipedia.org/wiki/Arimaa">Arimaa</a> are known to be + hard for computer AI algorithms. The goal of this project is to define + these games in Toss, compare how current Toss algorithms fare on these + two hard games, and possibly extend the algorithms to play well! + <br/><br/></par> + <par><em>Deliverables.</em> + By mid-term both games will be defined in Toss, ready for non-automatic + play. By the end, both the current minimax with alpha-beta playout + method and the Monte-Carlo with UTC method will be compared on these + games with different generated and hand-crafted heuristics. + <br/><br/></par> + <par><em>Modules (in planned construction order).</em> + <enumerate> + <item>Arimaa definition in Toss (easy)</item> + <item>Go definition in Toss without Ko (medium)</item> + <item>Toss extension to handle repeated positions (medium)</item> + <item>Go definition with Ko (easy after 3)</item> + <item>Adapting Heuristics, Minimax, UCT to play somehow (medium)</item> + <item>Optimizing the algorithms to play well (unknown)</item> + </enumerate> + <br/></par> + <par><em>Needed Skills and Difficulty.</em> + Good OCaml programming skills are required, and some general knowledge + of game playing algorithms will be necessary. Between easy and medium, + but can become very interesting and challenging in the last phase! + <br/><br/></par> + <par><em>Possible Mentors (in order of preference):</em> + Łukasz Stafiniak, Łukasz Kaiser, + Michał Wójcik, Tobias Ganzow + </par> + </section> + + + <section title="Idea: Pac-Man in Toss"> + <par><em>Description and Goals.</em> + While there is support for continuous dynamics and some concurrency + in current Toss code and GUI, these are not fully developed, tested, + and not supported in the web interface. The good old + <a href="http://en.wikipedia.org/wiki/Pac-Man">Pac-Man</a> is an ideal + test candidate for these features. + <br/><br/></par> + <par><em>Deliverables.</em> + By mid-term it will be possible to play Pac-Man in Toss in command + line mode and in the GUI. By the end, it will be supported in the web + interface as well. + <br/><br/></par> + <par><em>Modules (in planned construction order).</em> + <enumerate> + <item>Allow multiple players in one location in Toss (easy)</item> + <item>Test, debug and implement missing timing features (easy)</item> + <item>Relate Toss-internal time with real time (medium)</item> + <item>Pac-Man in command line and GUI (easy after 1, 2)</item> + <item>Make Toss web interface fully asynchronous (medium)</item> + <item>Pac-Man in the web interface (easy after 5)</item> + </enumerate> + <br/></par> + <par><em>Needed Skills and Difficulty.</em> + This idea is straight-forward and does not contain any hard bits. + But it requires the student to know both OCaml and AJAX with JavaScript, + and to be able to use and debug them in parallel. + <br/><br/></par> + <par><em>Possible Mentors (in order of preference):</em> + Łukasz Kaiser, Tobias Ganzow, Łukasz Stafiniak + </par> + </section> + + + <section title="Idea: Game Design made Comfortable"> + <par><em>Description and Goals.</em> + If you are passionate for interfaces, you see clearly that there + is work for you in Toss. The stand-alone GUI, made in python and Qt4, + differs significantly from the web interface. And more complex games + are written in a text editor anyway, in a syntax which could also see + some improvements. The goal is to make one interface to take the best + of these all and make it the preferred choice for Toss. + <br/><br/></par> + <par><em>Deliverables.</em> + The web interface will be extended to allow textual definitions of + new games by mid-term, including a possibility to test the game + before publishing it to friends or to everyone. Before the end, + basic functions of the GUI such as separate editing of rules and + changing relations, elements and positions will work online. + <br/><br/></par> + <par><em>Modules (in planned construction order).</em> + <enumerate> + <item>Make game list dynamic in the web interface</item> + <item>Allow users to add new games by uploading .toss files</item> + <item>Separate tab or page for game editing, simple text form</item> + <item>Handling of errors and basic sanity checks for new games</item> + <item>Extend game editing tab, separate rules, definitions</item> + <item>Tab for model editing, allow to view defined relations</item> + <item>Define a new game with the created interface, is it usable?</item> + </enumerate> + <br/></par> + <par><em>Needed Skills and Difficulty.</em> + OCaml skills are not required for this project, as it concerns mostly + web programming and interface design. But being easy from technical + point of view does not make it really easy – a good feeling for + interface design is necessary, and a lot of testing to make it right. + <br/><br/></par> + <par><em>Possible Mentors (in order of preference):</em> + Dietmar Berwanger, Michał Wójcik, Tobias Ganzow + </par> + </section> + + + <section title="Idea: Fast Optimizing Solver"> + <par><em>Description and Goals.</em> + The solver in Toss is no slouch, but it could be better. + Formulas should be compiled to a more optimized form, + possibly using relation size statistics. Structures should + be optimized for memory footprint and these together for + cache coherency – maybe with some parts rewritten in C. + Dynamics calculations should be moved nearer to the structure. + <br/><br/></par> + <par><em>Deliverables.</em> + By mid-term, the compilation of formulas for the solver will be optimized + and cleaned-up, with a separate module not using the current TNF. By the + end, the structure module will be optimized and dynamics calculations + moved there from the current Term module. + <br/><br/></par> + <par><em>Modules (in planned construction order).</em> + <enumerate> + <item>Written detailed design of new compilation module</item> + <item>New formula compilation functions and unit tests</item> + <item>Testing full Toss with the new module, quantify gains</item> + <item>Detailed design of new structure module with dynamics</item> + <item>Implementation of the new module, possibly in C</item> + <item>Interfacing the new module and testing it</item> + <item>Testing and optimizing performance of both modules</item> + </enumerate> + <br/></par> + <par><em>Needed Skills and Difficulty.</em> + This project is technical and requires very good understanding + of OCaml, the interface between OCaml and C, and the various factors + which can influence performance. Some knowledge of databases and + their optimization techniques can be helpful. + <br/><br/></par> + <par><em>Possible Mentors (in order of preference):</em> + Tobias Ganzow, Łukasz Kaiser, Łukasz Stafiniak + </par> + </section> + + <section title="Idea: GGP Competition and Cooperation"> + <par><em>Description and Goals.</em> + General Game Playing, GGP, is a name for the task of playing a game + given as input. Recently, Toss gained a module to translate games + defined in GDL, the Game Description Language used in GGP Competitions, + to the Toss format. This allows to compete against GGP players, and we + even won quite a few games already! But the GGP translation is not + complete and some games are translated to very inefficient variants, + on which it is almost impossible to play well. The idea is to improve + this, but also to cooperate with the GGP guys, especially with the + <a href="http://code.google.com/p/ggp-galaxy/">GGP Galaxy Project</a>, + to make General Game Playing truly accessible for everyone! + <br/><br/></par> + <par><em>Deliverables.</em> + Toss GGP translation module will be improved by mid-term to handle + standard Toss games well enough so that the manual translation code + can be removed. By the end, the majority of games in GDL will translate + well and will be made usable from the web interface. + <br/><br/></par> + <par><em>Modules (in planned construction order).</em> + <enumerate> + <item>Enrich Toss formulas with fixed-points (medium, needed)</item> + <item>Generalize GGP translation using fixed-points (medium)</item> + <item>Improve readability of translated games, test, debug</item> + <item>Add some position detection or layouting to the translation</item> + <item>Adapt web interface to be usable with translated games</item> + </enumerate> + <br/></par> + <par><em>Needed Skills and Difficulty.</em> + The GDL translation is not that hard in principle, but turns out to be + quite tricky in practice. Good knowlede of OCaml is necessary, and some + previous knowledge of GGP/GDL or Prolog would be good. But passsion + for GGP is the best recommendation for this project! + <br/><br/></par> + <par><em>Possible Mentors (in order of preference):</em> + Łukasz Stafiniak, Łukasz Kaiser, maybe someone from GGP Galaxy + </par> + </section> + + +</personal> Modified: trunk/Toss/www/navigation.xml =================================================================== --- trunk/Toss/www/navigation.xml 2011-03-11 18:41:40 UTC (rev 1352) +++ trunk/Toss/www/navigation.xml 2011-03-12 04:23:27 UTC (rev 1353) @@ -4,6 +4,7 @@ <navigation> <menu lang="en"> <item href="/" id="Home">Home</item> + <item href="/ideas.html" id="ideas">GSoC Ideas</item> <item href="http://tplay.org">Play Online</item> <item href="http://sourceforge.net/project/showfiles.php?group_id=115606" >Download Toss</item> @@ -23,6 +24,7 @@ <menu lang="de"> <item href="/" id="Home">Home</item> + <item href="/ideas.html" id="ideas">GSoC Ideen</item> <item href="http://tplay.org">Online Spielen</item> <item href="http://sourceforge.net/project/showfiles.php?group_id=115606" >Toss Runterladen</item> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-11 18:41:54
|
Revision: 1352 http://toss.svn.sourceforge.net/toss/?rev=1352&view=rev Author: lukaszkaiser Date: 2011-03-11 18:41:40 +0000 (Fri, 11 Mar 2011) Log Message: ----------- Redoing Toss Webpage, first commit. Modified Paths: -------------- trunk/Toss/www/Makefile Added Paths: ----------- trunk/Toss/www/Publications/ trunk/Toss/www/Publications/.cvsignore trunk/Toss/www/Publications/Makefile trunk/Toss/www/Publications/all.bib trunk/Toss/www/Publications/index.xml trunk/Toss/www/bin/ trunk/Toss/www/bin/.cvsignore trunk/Toss/www/bin/bib2xml trunk/Toss/www/bin/clean-xml-bib trunk/Toss/www/bin/cleanbib trunk/Toss/www/bin/hrefprocess trunk/Toss/www/bin/tex2html trunk/Toss/www/bin/unflatten.py trunk/Toss/www/contact.xml trunk/Toss/www/create.xml trunk/Toss/www/default.mak trunk/Toss/www/docs.xml trunk/Toss/www/examples.xml trunk/Toss/www/gui_interface.xml trunk/Toss/www/img/Breakthrough.png trunk/Toss/www/img/Checkers.png trunk/Toss/www/img/Chess.png trunk/Toss/www/img/Connect4.png trunk/Toss/www/img/Entanglement.png trunk/Toss/www/img/Gomoku.png trunk/Toss/www/img/Pawn-Whopping.png trunk/Toss/www/img/Tic-Tac-Toe.png trunk/Toss/www/img/childnav-bottom.png trunk/Toss/www/img/childnav-top.png trunk/Toss/www/img/flags/ trunk/Toss/www/img/flags/austria.gif trunk/Toss/www/img/flags/belgium.gif trunk/Toss/www/img/flags/finland.gif trunk/Toss/www/img/flags/france.gif trunk/Toss/www/img/flags/germany.gif trunk/Toss/www/img/flags/great-britain.gif trunk/Toss/www/img/flags/italy.gif trunk/Toss/www/img/flags/luxembourg.gif trunk/Toss/www/img/flags/netherlands.gif trunk/Toss/www/img/flags/poland.gif trunk/Toss/www/img/flags/sweden.gif trunk/Toss/www/img/flags/switzerland.gif trunk/Toss/www/img/flags/usa.gif trunk/Toss/www/img/footer.png trunk/Toss/www/img/header.png trunk/Toss/www/img/tabhov1.png trunk/Toss/www/img/tabhov2.png trunk/Toss/www/img/taboff1.png trunk/Toss/www/img/taboff2.png trunk/Toss/www/img/tabon1.png trunk/Toss/www/img/tabon2.png trunk/Toss/www/index.xml trunk/Toss/www/navigation.xml trunk/Toss/www/people.xml trunk/Toss/www/play.xml trunk/Toss/www/pub/ trunk/Toss/www/pub/games_with_structured_states.pdf trunk/Toss/www/pub/graph_games_short.pdf trunk/Toss/www/pub/hypergraph_games_warsaw.pdf trunk/Toss/www/pub/hypergraph_rewriting_systems.pdf trunk/Toss/www/pub/playing_games_formulas.pdf trunk/Toss/www/pub/playing_games_rich_structure.pdf trunk/Toss/www/pub/playing_games_rich_structure_short.pdf trunk/Toss/www/pub/playing_general_games.pdf trunk/Toss/www/pub/playing_structure_rewriting_games.pdf trunk/Toss/www/pub/structure_rewriting.pdf trunk/Toss/www/pub/structure_rewriting_games.pdf trunk/Toss/www/pub/structure_rewriting_mfcs.pdf trunk/Toss/www/pub/weak_mso_composition.pdf trunk/Toss/www/pub/wmso_composition_alg.pdf trunk/Toss/www/scripts/ trunk/Toss/www/scripts/main.js trunk/Toss/www/scripts/map.js trunk/Toss/www/scripts/nomap.js trunk/Toss/www/scripts/portal.js trunk/Toss/www/styles/ trunk/Toss/www/styles/common.css trunk/Toss/www/styles/portal.css trunk/Toss/www/styles/print.css trunk/Toss/www/styles/screen.css trunk/Toss/www/xsl/ trunk/Toss/www/xsl/authors-person-extract.xsl trunk/Toss/www/xsl/books.xsl trunk/Toss/www/xsl/games.xsl trunk/Toss/www/xsl/include/ trunk/Toss/www/xsl/include/bibtex.xsl trunk/Toss/www/xsl/include/common.xsl trunk/Toss/www/xsl/include/layout-games.xsl trunk/Toss/www/xsl/include/layout.xsl trunk/Toss/www/xsl/language.xsl trunk/Toss/www/xsl/main.csl trunk/Toss/www/xsl/main.xsl trunk/Toss/www/xsl/main.xsl~ trunk/Toss/www/xsl/person-bibtex-extract.xsl trunk/Toss/www/xsl/publications-games-past.xsl trunk/Toss/www/xsl/publications.xsl trunk/Toss/www/xsl/xhtml1-lat1.ent Removed Paths: ------------- trunk/Toss/www/contact.php trunk/Toss/www/examples.php trunk/Toss/www/index.php trunk/Toss/www/interface.php trunk/Toss/www/links.php trunk/Toss/www/site_template.php Modified: trunk/Toss/www/Makefile =================================================================== --- trunk/Toss/www/Makefile 2011-03-11 18:32:46 UTC (rev 1351) +++ trunk/Toss/www/Makefile 2011-03-11 18:41:40 UTC (rev 1352) @@ -1,19 +1,3 @@ -all: index.html contact.html links.html interface.html examples.html \ - reference.pdf +TOPDIR = . -%.html: %.php site_template.php - php $(addsuffix .php, $(basename $@)) | sed "s/.php/.html/g" |\ - sed "s/.html?/.php?/g" > $@ - -reference.pdf: reference.tex - pdflatex reference.tex - bibtex reference - pdflatex reference.tex - pdflatex reference.tex - rm -f *.aux *.out *.log *.bbl *.blg *.idx *.thm *.snm *.nav \ - *.toc *.lof *.flc - -.PHONY: - -clean: - rm -f *~ *.html reference.pdf +include $(TOPDIR)/default.mak Added: trunk/Toss/www/Publications/.cvsignore =================================================================== --- trunk/Toss/www/Publications/.cvsignore (rev 0) +++ trunk/Toss/www/Publications/.cvsignore 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,13 @@ +# We are still using .cvsignore files as we find them easier to manage +# than svn properties. Therefore if you change .cvsignore do the following. +# svn propset svn:ignore -F .cvsignore . + +*.xml.de +*.xml.en +*.html +*.html.de +*.html.en + +all.texml +all.xml +*~ Added: trunk/Toss/www/Publications/Makefile =================================================================== --- trunk/Toss/www/Publications/Makefile (rev 0) +++ trunk/Toss/www/Publications/Makefile 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,58 @@ +TOPDIR = .. +BINDIR = $(TOPDIR)/bin +LANGS = de en + +BIB_FILES = $(wildcard ./*.bib) +BIBTEXML_TEX_FILES = $(patsubst %.bib,%.texml,$(BIB_FILES)) +BIBTEXML_FILES = $(patsubst %.bib,%.xml,$(BIB_FILES)) + +SUPPLEMENTARY_FILES = $(TOPDIR)/navigation.xml $(TOPDIR)/people.xml + +XML_FILES = $(filter-out $(SUPPLEMENTARY_FILES),$(wildcard ./*.xml)) + +AUTHORS = all kaiser + +HTML_FILES = $(patsubst %,%.html,$(AUTHORS)) +HTML_LANG_FILES = $(foreach lang,$(LANGS),$(patsubst %.html,%.html.$(lang),$(HTML_FILES))) + + +XSL_FILES = $(wildcard ./$(TOPDIR)/xsl/*.xsl) $(wildcard ./$(TOPDIR)/xsl/include/*.xsl) + +# special parameter for html-title on publication pages!!! +XSLTPROC_PARAM = --stringparam "year" "`date -r all.bib +"%Y"`" --stringparam "last-mod" "`date -r all.bib +"%d. %B %Y"`" --stringparam "topdir" "$(TOPDIR)" --stringparam "title" "Publications" + +all: index bib $(HTML_LANG_FILES) + +index: $(foreach lang,$(LANGS),all.html.$(lang)) + for lang in $(LANGS); do \ + cp all.html.$$lang index.html.$$lang ;\ + chmod 664 index.html.$$lang ;\ + done + +bib: $(BIBTEXML_FILES) $(BIBTEXML_TEX_FILES) + +%.texml: %.bib + $(BINDIR)/bib2xml $< | $(BINDIR)/unflatten.py --unflatten -\ + | sed 's/<?xml version="1.0" ?>/<?xml version="1.0" ?>\n/' > $@ + +%.xml: %.bib $(BINDIR)/tex2html + $(BINDIR)/bib2xml $< | $(BINDIR)/unflatten.py --unflatten -\ + | sed 's/<?xml version="1.0" ?>/<?xml version="1.0" ?>\n/'\ + | $(BINDIR)/tex2html $(TOPDIR) | $(BINDIR)/clean-xml-bib > $@ + +HTML_LANG_PATTERN = $(foreach lang,$(LANGS),%.html.$(lang)) +$(HTML_LANG_PATTERN) : index.xml $(SUPPLEMENTARY_FILES) $(XSL_FILES) $(BIBTEXML_TEX_FILES) $(BIBTEXML_FILES) + for lang in $(LANGS); do \ + xsltproc $(XSLTPROC_PARAM) --stringparam "author" "$(basename $(basename $@))"\ + --stringparam "lang" "$$lang" --stringparam "uri" "$*.xml" index.xml \ + | $(BINDIR)/hrefprocess "$(TOPDIR)" "$$lang" > $*.html.$$lang ;\ + chmod 664 $*.html.$$lang ;\ + done + +clean: + rm -f $(HTML_LANG_FILES) + for lang in $(LANGS); do \ + rm -f index.html.$$lang ;\ + done + rm -f $(BIBTEXML_FILES) + rm -f $(BIBTEXML_TEX_FILES) Added: trunk/Toss/www/Publications/all.bib =================================================================== --- trunk/Toss/www/Publications/all.bib (rev 0) +++ trunk/Toss/www/Publications/all.bib 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,198 @@ +@String{lnai = {LNAI}} +@String{lncs = {LNCS}} +@String{springer = {Springer}} + +# TALKS + +@inproceedings{KGTJ10, + author={Toss}, + title={Playing Games when States have Rich Structure}, + url = {/pub/playing_games_rich_structure_short.pdf}, + booktitle= {GT Jeux Meeting, Paris}, + year={2010 Talk} +} + + +@inproceedings{KCSL10, + author={Toss}, + title={New Algorithm + for Weak Monadic Second-Order Logic on Inductive Structures}, + url = {/pub/wmso_composition_alg.pdf}, + booktitle= {CSL, Brno, and similar at Games Meeting, Oxford}, + year={2010 Talk} +} + +@inproceedings{KLIAFA10, + author={Toss}, + title={Games with Structured States}, + url = {/pub/games_with_structured_states.pdf}, + booktitle= {LIAFA Seminar, Paris}, + year={2010 Talk} +} + + +@inproceedings{KAGI10, + author={Toss}, + title={Playing General Structure Rewriting Games}, + url = {/pub/playing_general_games.pdf}, + booktitle= {AGI, Lugano}, + year={2010 Talk} +} + +@inproceedings{KSTAR09, + author={Toss}, + title={Playing Games when States have Rich Structure}, + url = {/pub/playing_games_rich_structure.pdf}, + booktitle= {Invited talk at STAR Workshop, Kanpur IIT, India}, + year={2009 Talk} +} + +@inproceedings{KALGO09, + author={Toss}, + title={Playing Structure Rewriting Games with Formulas on States}, + url = {/pub/playing_games_formulas.pdf}, + booktitle= {AlgoSyn Seminar, Aachen}, + year={2009 Talk} +} + +@inproceedings{KMFCS09, + author={Toss}, + title={Synthesis for Structure Rewriting Systems}, + url = {/pub/structure_rewriting_mfcs.pdf}, + booktitle= {MFCS, High Tatras}, + year={2009 Talk} +} + +@inproceedings{KLSV09, + author={Toss}, + title={Structure Rewriting Games}, + url = {/pub/structure_rewriting_games.pdf}, + booktitle= {LSV Seminar (Cachan), and similar at AAL Workshop (Stuttgart)}, + year={2009 Talk} +} + +@inproceedings{KAUTO09, + author={Toss}, + title={Analyzing Structure Rewriting Systems}, + url = {/pub/structure_rewriting.pdf}, + booktitle= {AlgoSyn Seminar (Aachen), and similar at Automat (Warsaw)}, + year={2009 Talk} +} + +@inproceedings{KGAMES08, + author={Toss}, + title={Games Played with Hypergraphs}, + url = {/pub/hypergraph_games_warsaw.pdf}, + booktitle= {Games Meeting, Warsaw}, + year={2008 Talk} +} + +@inproceedings{KZJP08, + author={Toss}, + title={Analysis of Hypergraph Rewriting Systems}, + url = {/pub/hypergraph_rewriting_systems.pdf}, + booktitle= {ZJP Seminar, Wroc{\l}aw}, + year={2008 Talk} +} + +# ARTICLES + + +@InProceedings{GK10, + author = {Tobias Ganzow and {\L}ukasz Kaiser}, + title = {New Algorithm for Weak Monadic Second-Order Logic on + Inductive Structures}, + booktitle = {Proceedings of the 19th Annual Conference of the + European Association for Computer Science Logic, + CSL~2010}, + editor = {Anuj Dawar and Helmut Veith}, + volume = 6247, + year = 2010, + series = {Lecture Notes in Computer Science}, + publisher = {Springer}, + pages = {366--380}, + url = + {http://www.liafa.jussieu.fr/~kaiser/pub/weak_mso_composition.pdf}, + abstract = { Weak monadic second-order logic is a very + expressive logic which has been used successfully + for verification of software and hardware systems. + Moreover, structures of bounded clique width have a + decidable weak MSO theory which allows to specify + and verify detailed correctness properties. + However, one obstacle to a wide application of WMSO + verification techniques in practice is that the + prevalent model-checking algorithms are based on + tree automata, and hence require to encode the + structure of interest in the binary tree which is + often a cause of inefficiency. We present a new + algorithm for model-checking weak MSO on inductive + structures, a certain kind of structures of bounded + clique width, together with a proof of its + decidability which follows from Shelah's composition + method. Our algorithm directly manipulates formulas + and checks them on the structure of interest without + the need to encode it in the binary tree. In fact, + the model-checking problem is reduced to solving a + finite reachability game. In addition to the new + algorithm, we also show that our method can be + extended to obtain decidability of weak MSO extended + with the unbounding quantifier on the binary tree, + which was open before.} +} + +@inproceedings{KS10, + author = {\L{}ukasz Kaiser and \L{}ukasz Stafiniak}, + title = {Playing Structure Rewriting Games}, + booktitle = {Proceedings of AGI~'10}, + publisher = {Atlantis Press}, + year = {2010}, + url = {http://www.liafa.jussieu.fr/~kaiser/pub/playing_structure_rewriting_games.pdf}, + abstract = { +Achieving goals in a complex environment in which many players +interact is a general task demanded from an AI agent. When goals of +the players are given explicitly, such setting can be described as +a multi-player game with complete information. We introduce a general +model of such games in which states are represented by relational structures +(hypergraphs), possibly with real-valued labels, and actions %are given +by structure rewriting rules. For this model, we develop an algorithm which +computes rational strategies for the players. Our algorithm can be +parametrized by a probabilistic evaluation function and we devise +a general procedure for learning such evaluations. First tests on a few +classical examples substantiate the chosen game model and our algorithm. + } +} + + +@inproceedings{K09, + author = {\L{}ukasz Kaiser}, + title = {Synthesis for Structure Rewriting Systems}, + booktitle = {Proceedings of the 34th International Symposium on Mathematical Foundations of Computer Science, MFCS~'09}, + publisher = springer, + series = lncs, + volume = {5734}, + year = {2009}, + pages = {415--427}, + url = {http://www.liafa.jussieu.fr/~kaiser/pub/graph_games_short.pdf}, + abstract = { +The description of a single state of a modelled system is often complex +in practice, but few procedures for synthesis address this problem in depth. +We study systems in which a state is described by an arbitrary +finite structure, and changes of the state are represented by structure +rewriting rules, a generalisation of term and graph rewriting. +Both the environment and the controller are allowed to change the structure +in this way, and the question we ask is how a strategy for the controller +that ensures a given property can be synthesised. + +We focus on one particular class of structure rewriting rules, namely on +separated structure rewriting, a limited syntactic class of rules. +To counter this restrictiveness, we allow the property to be ensured +by the controller to be specified in a very expressive logic: +a combination of monadic second-order logic evaluated on states and +the modal $\mu$-calculus for the temporal evolution of the whole system. +We show that for the considered class of rules and this logic, it can +be decided whether the controller has a strategy ensuring a given property, +and in such case a finite-memory strategy can be synthesised. Additionally, +we prove that the same holds if the property is given by a monadic second-order +formula to be evaluated on the limit of the evolution of the system. + } +} Added: trunk/Toss/www/Publications/index.xml =================================================================== --- trunk/Toss/www/Publications/index.xml (rev 0) +++ trunk/Toss/www/Publications/index.xml 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE course SYSTEM "../xsl/xhtml1-lat1.ent"> + +<?xml-stylesheet type="text/xsl" href="../xsl/publications.xsl" charset="UTF-8"?> + +<publications> + <history> + <link href="/Publications/" id="Publications">Publications</link> + </history> +</publications> \ No newline at end of file Added: trunk/Toss/www/bin/.cvsignore =================================================================== --- trunk/Toss/www/bin/.cvsignore (rev 0) +++ trunk/Toss/www/bin/.cvsignore 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,6 @@ +# We are still using .cvsignore files as we find them easier to manage +# than svn properties. Therefore if you change .cvsignore do the following. +# svn propset svn:ignore -F .cvsignore . + +hrefprocess +hrefprocess-games Added: trunk/Toss/www/bin/bib2xml =================================================================== (Binary files differ) Property changes on: trunk/Toss/www/bin/bib2xml ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Added: trunk/Toss/www/bin/clean-xml-bib =================================================================== --- trunk/Toss/www/bin/clean-xml-bib (rev 0) +++ trunk/Toss/www/bin/clean-xml-bib 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,7 @@ +#!/bin/bash + +# correct person's names with non-breaking-tildes inside +# this should maybe done a bit more carefully... ;-) + +sed 's/<bibtex:last>\([^&]*\) \([^<]*\)<\/bibtex:last>/<bibtex:first>\1<\/bibtex:first>\n\t<bibtex:last>\2<\/bibtex:last>/' + Property changes on: trunk/Toss/www/bin/clean-xml-bib ___________________________________________________________________ Added: svn:executable + * Added: trunk/Toss/www/bin/cleanbib =================================================================== --- trunk/Toss/www/bin/cleanbib (rev 0) +++ trunk/Toss/www/bin/cleanbib 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,10 @@ +#!/bin/bash + +sed 's/\xE4/{\\"a}/g' |\ +sed 's/\xF6/{\\"o}/g' |\ +sed 's/\xFC/{\\"u}/g' |\ +sed 's/\xC4/{\\"A}/g' |\ +sed 's/\xD6/{\\"O}/g' |\ +sed 's/\xDC/{\\"U}/g' |\ +sed 's/\([^{]\)\(\\[\\'`echo "'"`'\"][aou]\)\([^}]\)/\1{\2}\3/g' |\ +sed 's/\([^{]\)\(\\[\\'`echo "'"`'\"][aou]\)\([^}]\)/\1{\2}\3/g' Property changes on: trunk/Toss/www/bin/cleanbib ___________________________________________________________________ Added: svn:executable + * Added: trunk/Toss/www/bin/hrefprocess =================================================================== --- trunk/Toss/www/bin/hrefprocess (rev 0) +++ trunk/Toss/www/bin/hrefprocess 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,16 @@ +#!/bin/bash + +sed 's&src="/\([^"]*\)"&src="'$1'/\1"&g' |\ +sed 's&href="/\([^"]*\)"&href="'$1'/\1"&g' |\ +sed '/href="http/!s&href="\([^"]*\)/"&href="\1/index.html.'$2'"&g' |\ +sed '/href="http/!s&href="\([^"]*\)\.html"&href="\1.html.'$2'"&g' |\ +# +# delete xmlns-attributes +# +# COMMENTING THIS OUT FOR NOW - I DO NOT UNDERSTAND WHY WE DID THIS? +# +#sed 's/<html xmlns/<html xmlnamespace/' |\ +#sed 's& xmlns\(:[^=]*\)\?="[^"]*"&&g' |\ +#sed 's/<html xmlnamespace/<html xmlns/' |\ +#sed 's/<script \([^>]*\)\/>/<script \1><\/script>/g' +sed '' Property changes on: trunk/Toss/www/bin/hrefprocess ___________________________________________________________________ Added: svn:executable + * Added: trunk/Toss/www/bin/tex2html =================================================================== --- trunk/Toss/www/bin/tex2html (rev 0) +++ trunk/Toss/www/bin/tex2html 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,87 @@ +#!/bin/bash + +sed '2i<!DOCTYPE bibtex:file SYSTEM "'$1'/xsl/xhtml1-lat1.ent">' |\ +#sed '3i<?xml-stylesheet type="text/xsl" href="'$1'/xsl/html-mgi.xsl" charset="UTF-8"?>' |\ +# +# non-breaking space + sed "/bibtex:url/!s/~/\ /g" | \ +# m-dash + sed "s/---/\—/g" | \ +# n-dash + sed "s/--/\–/g" | \ +# LEFT DOUBLE QUOTATION MARK + sed "s/\`\`/\“/g" | \ +# RIGHT DOUBLE QUOTATION MARK + sed "s/\x27\x27</\”</g" | \ +# LATIN CAPITAL LETTER A WITH DIAERESIS + sed 's/\\\"\({A}\|A\)/\Ä/g' | \ +# LATIN CAPITAL LETTER O WITH DIAERESIS + sed 's/\\\"\({O}\|O\)/\Ö/g' | \ +# LATIN CAPITAL LETTER U WITH DIAERESIS + sed 's/\\\"\({U}\|U\)/\Ü/g' | \ +# LATIN SMALL LETTER a WITH DIAERESIS + sed 's/\\\"\({a}\|a\)/\ä/g' | \ +# LATIN SMALL LETTER o WITH DIAERESIS + sed 's/\\\"\({o}\|o\)/\ö/g' | \ +# LATIN SMALL LETTER u WITH DIAERESIS + sed 's/\\\"\({u}\|u\)/\ü/g' | \ +# LATIN SMALL LETTER a WITH GRAVE + sed "s/\\x60\({a}\|a\)/\à/g;s/\\\à/\à/g" | \ +# LATIN SMALL LETTER a WITH ACUTE + sed "s/\\\'\({a}\|a\)/\á/g" | \ +# LATIN SMALL LETTER a WITH CIRCUMFLEX + sed "s/\\\^\({a}\|a\)/\â/g" | \ +# LATIN SMALL LETTER C WITH CEDILLA + sed 's/\\c{c}/\ç/g' | \ +# LATIN SMALL LETTER e WITH GRAVE + sed "s/\\x60\({e}\|e\)/\è/g;s/\\\è/\è/g" | \ +# LATIN SMALL LETTER e WITH ACUTE + sed "s/\\\'\({e}\|e\)/\é/g" | \ +# LATIN CAPITAL LETTER E WITH ACUTE + sed "s/\\\'\({E}\|E\)/\É/g" | \ +# LATIN SMALL LETTER e WITH CIRCUMFLEX + sed "s/\\\^\({e}\|e\)/\ê/g" | \ +# LATIN SMALL LETTER e WITH TWO DOTS + sed "s/\\\"\({e}\|e\)/\ë/g" | \ +# LATIN SMALL LETTER e WITH TWO DOTS AGAIN (HTML) + sed "s/\\\"\({e}\|e\)/\ë/g" | \ +# LATIN SMALL LETTER i WITH ACUTE + sed "s/\\\'\({\\\?i}\|\\\?i\)/\í/g" | \ +# LATIN SMALL LETTER i WITH TWO DOTS + sed "s/\\\"\({i}\|i\)/\ï/g" | \ +# LATIN SMALL LETTER i WITH TWO DOTS AGAIN (HTML) + sed "s/\\\"{i}/\ï/g" | \ +# LATIN SMALL LETTER i WITH ACCENT RIGHT + sed "s/\\\'{\\\i}/\í/g" | \ +# LATIN SMALL LETTER n WITH ACUTE + sed "s/\\\'\({n}\|n\)/\ń/g" | \ +# LATIN SMALL LETTER c WITH CARON + sed 's/\\v{c}/\č/g' | \ +# LATIN SMALL LETTER e WITH CARON + sed 's/\\v{e}/\ě/g' | \ +# LATIN SMALL LETTER r WITH CARON + sed 's/\\v{r}/\ř/g' | \ +# LATIN SMALL LETTER s WITH CARON + sed 's/\\v{s}/\š/g' | \ +# LATIN SMALL LETTER z WITH CARON + sed 's/\\v{z}/\ž/g' | \ +#0141 LATIN CAPITAL LETTER L WITH STROKE + sed 's/\\L{}/\Ł/g' | \ +#0141 LATIN CAPITAL LETTER L WITH STROKE + sed 's/\\\({L}\|L\)/\Ł/g' | \ +#0142 LATIN SMALL LETTER l WITH STROKE + sed 's/\\\({l}\|l\)/\ł/g' | \ +#0142 LATIN SMALL LETTER l WITH STROKE + sed 's/\\l{}/\ł/g' | \ +sed 's/\\emph{\([^}]*\)}/<em>\1<\/em>/g' | \ +# abstract modifications +#sed 's/\\\\/<br\/>/g' | \ +sed 's/<bibtex:abstract>/<bibtex:abstract><p>/g' |\ +sed 's&</bibtex:abstract>&</p></bibtex:abstract>&g' |\ +sed 's/\\\\/<\/p><p>/g' | \ +sed 's/{\([^}]*\)}/\1/g' | \ +sed 's/^~/\ /g' | \ +sed 's/^~/\ /g' + + + Property changes on: trunk/Toss/www/bin/tex2html ___________________________________________________________________ Added: svn:executable + * Added: trunk/Toss/www/bin/unflatten.py =================================================================== --- trunk/Toss/www/bin/unflatten.py (rev 0) +++ trunk/Toss/www/bin/unflatten.py 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,407 @@ +#!/usr/bin/python + + +# author: Johannes Henkel jh...@jh... +# License: GNU GPL (see http://www.gnu.org/copyleft/gpl.html) + +import xml.dom.minidom +import sys +import string + +bibtexml_user = ["bibtex:abstract", "bibtex:affiliation", + "bibtex:contents", "bibtex:copyright", + "bibtex:isbn","bibtex:issn", + "bibtex:keyword", "bibtex:language", "bibtex:lccn", + "bibtex:location", "bibtex:mrnumber", "bibtex:price", + "bibtex:size", "bibtex:url", "bibtex:category"] + +bibtexml_common = ["bibtex:key", "bibtex:annotate", "bibtex:crossref"] +bibtexml_common = bibtexml_common + bibtexml_user +bibtexml_dtd = { +"bibtex:article": ["bibtex:author", "bibtex:title", "bibtex:journal", + "bibtex:year", "bibtex:volume", "bibtex:number", "bibtex:pages", + "bibtex:month", "bibtex:note"] + bibtexml_common , +"bibtex:book" : ["bibtex:author","bibtex:editor","bibtex:title", + "bibtex:publisher", "bibtex:year", "bibtex:volume", "bibtex:number", + "bibtex:series", "bibtex:address", "bibtex:edition", "bibtex:month", + "bibtex:note"] + bibtexml_common, +"bibtex:booklet" : ["bibtex:author", "bibtex:title", + "bibtex:howpublished", "bibtex:address", "bibtex:month", + "bibtex:year", "bibtex:note"] + bibtexml_common, +"bibtex:manual" : ["bibtex:author", "bibtex:title", + "bibtex:organization", "bibtex:address", "bibtex:edition", + "bibtex:month", "bibtex:year", "bibtex:note"] + bibtexml_common, +"bibtex:techreport" : ["bibtex:author", "bibtex:title", + "bibtex:institution", "bibtex:year", "bibtex:type", "bibtex:number", + "bibtex:address", "bibtex:month", "bibtex:note"] + bibtexml_common , +"bibtex:mastersthesis" : ["bibtex:author", "bibtex:title", "bibtex:school", + "bibtex:year", "bibtex:type", "bibtex:address", "bibtex:month", + "bibtex:note"] + bibtexml_common, +"bibtex:phdthesis" : ["bibtex:author", "bibtex:title", "bibtex:school", + "bibtex:year", "bibtex:type", "bibtex:address", "bibtex:month", + "bibtex:note"] + bibtexml_common, +"bibtex:inbook": ["bibtex:author","bibtex:editor","bibtex:title", + "bibtex:chapter", "bibtex:pages", + "bibtex:publisher", "bibtex:year", "bibtex:volume", + "bibtex:number", "bibtex:series", "bibtex:type", + "bibtex:address", "bibtex:edition", "bibtex:month", + "bibtex:note"] + bibtexml_common, +"bibtex:incollection" : ["bibtex:author","bibtex:title", + "bibtex:booktitle", "bibtex:publisher", "bibtex:year", + "bibtex:editor", "bibtex:volume", "bibtex:number", + "bibtex:series", "bibtex:type", "bibtex:chapter", + "bibtex:pages", "bibtex:address", "bibtex:edition", + "bibtex:month", "bibtex:note"] + bibtexml_common, +"bibtex:proceedings" : ["bibtex:editor","bibtex:title", "bibtex:year", + "bibtex:volume", "bibtex:number", "bibtex:series", + "bibtex:address", "bibtex:month", "bibtex:organization", + "bibtex:publisher", "bibtex:note"] + bibtexml_common, +"bibtex:inproceedings" : ["bibtex:author", "bibtex:title", "bibtex:booktitle", + "bibtex:year", "bibtex:editor", + "bibtex:volume", "bibtex:number", + "bibtex:series", "bibtex:pages", "bibtex:address", + "bibtex:month", "bibtex:organization", "bibtex:publisher", + "bibtex:note"] + bibtexml_common, +"bibtex:conference" : ["bibtex:author", "bibtex:title", "bibtex:booktitle", + "bibtex:year", "bibtex:editor", + "bibtex:volume", "bibtex:number", + "bibtex:series", "bibtex:pages", "bibtex:address", + "bibtex:month", "bibtex:organization", "bibtex:publisher", + "bibtex:note"] + bibtexml_common, +"bibtex:unpublished" : ["bibtex:author", "bibtex:title", "bibtex:note", + "bibtex:month", "bibtex:year"] + bibtexml_common, +"bibtex:misc": ["bibtex:author", "bibtex:title", + "bibtex:howpublished", "bibtex:month", "bibtex:year", "bibtex:note", + ] + bibtexml_common +} + +def parsePersons(str): + "returns a list of name objects." + lexed = namelex(str) + ast1 = [] + while lexed.count("and")>0: + andIndex = lexed.index("and") + ast1.append(lexed[0:andIndex]) + del lexed[0:andIndex+1] + ast1.append(lexed) + ast = [] + for name in ast1: + namelist = [] + while name.count(",")>0: + commaIndex = name.index(",") + namelist.append(name[0:commaIndex]) + del name[0:commaIndex+1] + namelist.append(name) + ast.append(namelist) + result = [] + for name in ast: + assert len(name)>0 and len(name)<=3 + first=von=last=junior="" + + partlist = name[0] + lastitem = partlist.pop() + if len(name)<3 and (lastitem=="Jr." or lastitem=="Jr"): + junior=lastitem + lastitem = partlist.pop() + last=lastitem + vonBegin=len(partlist) + while vonBegin>0 and partlist[vonBegin-1][0] in string.lowercase: + vonBegin = vonBegin - 1 + von = string.join(partlist[vonBegin:len(partlist)]) + del partlist[vonBegin: len(partlist)] + if len(name)==1: first = string.join(partlist) + if len(name)==3: von = name[1] + if len(name)==2: + partlist = name[1] + if len(name)==3: + partlist = name[2] + if len(name)==2 or len(name)==3: + vonBegin = len(partlist) + while vonBegin>0 and partlist[vonBegin-1][0] in string.lowercase: + vonBegin = vonBegin-1 + von = string.join(partlist[vonBegin:len(partlist)])+von + del partlist[vonBegin: len(partlist)] + first = string.join(partlist) + + result.append(Person(first,von,last,junior)) + + return result + +def namelex(str): + "A lexer for the parsePersons method." + result = [] + pos=0; + while pos<len(str): + if str[pos] in string.whitespace: + pos = pos + 1 + elif str[pos]==',': + result.append(',') + pos = pos + 1 + else: + part = "" + brackets = 0 + while 1: + assert(brackets>=0) + if pos >= len(str): + break + elif str[pos]=='{': + part = part + "{" + brackets = brackets + 1 + pos = pos + 1 + elif str[pos]=='}': + part = part + "}" + brackets = brackets - 1 + pos = pos + 1 + elif pos+1<len(str) and str[pos:pos+1]=="\{": + part = part + "\{" + pos = pos+2 + elif pos+1<len(str) and str[pos:pos+1]=="\}": + part = part + "\}" + pos = pos+2 + elif str[pos]==',': + if brackets>0: + part = part + "," + pos = pos + 1 + else: + break + elif str[pos] in string.whitespace: + if brackets>0: + part = part + " " + pos = pos + 1 + else: + break + else: + part = part + str[pos] + pos = pos + 1 + if string.lower(part)=="and": + result.append("and") + elif string.lower(part)=="others": + result.append("Others") # so this will be detecetd as a last name ... ;-) + else: result.append(part) + return result + +def getText(nodelist): + rc = "" + for node in nodelist: + if node.nodeType == node.TEXT_NODE: + rc = rc + node.data + return rc + + +class Person: + "Models a bibtex name" + + def __init__(self, first, von, last, junior): + self.first=first; + self.von=von; + self.last=last; + self.junior=junior; + + def getFirst(self): + return self.first; + + def getVon(self): + return self.von; + + def getLast(self): + return self.last; + + def getJunior(self): + return self.junior; + + def __repr__(self): + return "(first: "+self.first+", von: "+self.von+", last: "+self.last+", junior: "+self.junior+")" + + + +def handleFile(bibtexFile): + for entry in bibtexFile.getElementsByTagName("bibtex:entry"): + handleEntry(entry) + +def handleEntry(bibtexEntry): + for child in bibtexEntry.childNodes: + if child.nodeType==child.ELEMENT_NODE: + if not(child.nodeName in bibtexml_dtd) and OPT_drop: + if not OPT_silent: + message = "WARNING: Dropping entry \"" + message = message + bibtexEntry.getAttribute("id") + message = message + "\" - " + message = message + child.nodeName + message = message + " not supported by bibtexml.\n" + sys.stderr.write(message) + else: + handleNamedEntry(child,bibtexEntry.getAttribute("id")) + +def handleNamedEntry(entry,citationid): + factory = entry.ownerDocument + if entry.nodeName in bibtexml_dtd and OPT_reorder: + mapkids = {} + for child in entry.childNodes[:]: + if child.nodeType==child.ELEMENT_NODE: + mapkids[child.nodeName]=child + entry.removeChild(child) + fieldlist = bibtexml_dtd[entry.nodeName] + for field in fieldlist: + if field in mapkids: + entry.appendChild(factory.createTextNode("\n ")) + entry.appendChild(mapkids[field]) + del mapkids[field] + if OPT_drop and not OPT_silent: + for kid in mapkids.values(): + message = "WARNING: Dropping field \"" + message = message + kid.nodeName + message = message + "\" in entry \"" + message = message + citationid + message = message + "\" - not supported by bibtexml.\n" + sys.stderr.write(message) + elif not OPT_drop and len(mapkids.values())>0: + entry.appendChild(factory.createTextNode("\n ")) + entry.appendChild( + factory.createComment( + "begin fields not supported by bibtexml")) + for kid in mapkids.values(): + entry.appendChild(factory.createTextNode("\n ")) + entry.appendChild(kid) + if not OPT_silent: + message = "WARNING: Field \"" + message = message + kid.nodeName + message = message + "\" in entry \"" + message = message + citationid + message = message + "\" not supported by bibtexml.\n" + sys.stderr.write(message) + entry.appendChild(factory.createTextNode("\n ")) + entry.appendChild( + factory.createComment( + "end fields not supported by bibtexml")) + entry.appendChild(factory.createTextNode("\n ")) + if OPT_unflatten: + mapkids = {} + for child in entry.childNodes: + if child.nodeName=="bibtex:author": + xmlauthors = factory.createElement("bibtex:authors") + entry.replaceChild(xmlauthors,child) + unflatten(xmlauthors,getText(child.childNodes)) + if child.nodeName=="bibtex:editor": + xmleditors = factory.createElement("bibtex:editors") + entry.replaceChild(xmleditors,child) + unflatten(xmleditors,getText(child.childNodes)) + +def unflatten(targetNode, strval): + factory = targetNode.ownerDocument + persons = parsePersons(strval) + for person in persons: + targetNode.appendChild(factory.createTextNode("\n ")) + xmlperson = factory.createElement("bibtex:person") + targetNode.appendChild(xmlperson) + + if person.getFirst(): + xmlperson.appendChild(factory.createTextNode("\n ")) + realfirst = string.split(person.getFirst())[0] + xmlfirst = factory.createElement("bibtex:first") + xmlperson.appendChild(xmlfirst) + xmlfirst.appendChild(factory.createTextNode(realfirst)) + + if person.getFirst() and ' ' in person.getFirst(): + xmlperson.appendChild(factory.createTextNode("\n ")) + tailfirst = string.split(person.getFirst()) + middle = string.join(tailfirst[1:len(tailfirst)]) + xmlmiddle = factory.createElement("bibtex:middle") + xmlperson.appendChild(xmlmiddle) + xmlmiddle.appendChild(factory.createTextNode(middle)) + + if person.getVon(): + xmlperson.appendChild(factory.createTextNode("\n ")) + xmlprelast = factory.createElement("bibtex:prelast") + xmlperson.appendChild(xmlprelast) + xmlprelast.appendChild(factory.createTextNode(person.getVon())) + + if person.getLast(): + xmlperson.appendChild(factory.createTextNode("\n ")) + xmllast = factory.createElement("bibtex:last") + xmlperson.appendChild(xmllast) + xmllast.appendChild(factory.createTextNode(person.getLast())) + + if person.getJunior(): + xmlperson.appendChild(factory.createTextNode("\n ")) + xmllineage = factory.createElement("bibtex:lineage") + xmlperson.appendChild(xmllineage) + xmllast.appendChild(factory.createTextNode(person.getJunior())) + xmlperson.appendChild(factory.createTextNode("\n ")) + targetNode.appendChild(factory.createTextNode("\n ")) + +if "--help" in sys.argv or len(sys.argv) <2: + print """ + +usage: unflatten.py [options] file + +where the options are: + +--unflatten +=========== +This will convert <bibtex:author>Donald E. Knuth</bibtex:author> +into <bibtex:authors> + <bibtex:person> + <bibtex:first>Donald</bibtex:first> + <bibtex:middle>E.</bibtex:middle> + <bibtex:last>Knuth</bibtex:last> + </bibtex:person> + <bibtex:authors> +Similar conversions will be applied to editor. +title and keywords will not be converted. + +--reorder +========= +This reorders the fields of an entry so that the format conforms +to the bibtexml DTD. If a field appears in the document that is not +supported by bibtexml, a warning message is printed. + +--drop +====== +Same as --reorder, but additionally drops all fields and entries +that are not supported by the bibtexml DTD. Displays a warning message for +each field it drops. + +--silent +======== +No warning messages for dropped or unsupported fields. + +""" +else: + + infilename = sys.argv.pop() + if infilename=='-': + infile=sys.stdin + else: + infile=open(infilename) + + OPT_unflatten=0 + OPT_reorder=0 + OPT_drop=0 + OPT_silent=0 + + if "--unflatten" in sys.argv: + OPT_unflatten=1 + sys.argv.remove("--unflatten") + if "--reorder" in sys.argv: + OPT_reorder=1 + sys.argv.remove("--reorder") + elif "--drop" in sys.argv: + OPT_drop=1 + OPT_reorder=1 + sys.argv.remove("--drop") + if "--silent" in sys.argv: + OPT_silent=1 + sys.argv.remove("--silent") + + if len(sys.argv)>1: + print "Unknown or redundant arguments:" + for arg in sys.argv[1:len(sys.argv)]: + print "\t", arg + print "type unflatten.py --help for more information." + elif not OPT_unflatten and not OPT_reorder: + print "Nothing can be done here. Read --help for more information." + else: + bibxmldoc = xml.dom.minidom.parse(infile) + handleFile(bibxmldoc) + bibxmldoc.writexml(sys.stdout) + print "" Property changes on: trunk/Toss/www/bin/unflatten.py ___________________________________________________________________ Added: svn:executable + * Deleted: trunk/Toss/www/contact.php =================================================================== --- trunk/Toss/www/contact.php 2011-03-11 18:32:46 UTC (rev 1351) +++ trunk/Toss/www/contact.php 2011-03-11 18:41:40 UTC (rev 1352) @@ -1,62 +0,0 @@ -<?php @include "site_template.php"; -// echo html_page ($prefix, $url, $title, $style, $body); - -$prefix = ""; -$url = "contact.php"; -$title = "Toss Contact Page"; -$body = ' -<div class="main"> - -<h1>CONTACT</h1> - - -<p>Contact us by writing to: -<script type="text/javascript">begin_mailto("toss-devel", "lists.sourceforge.net");</script>toss-devel [AT] lists.sourceforge.net<script type="text/javascript">end_mailto();</script></p> - - -<p>Toss is an open source project hosted by <a href="http://sourceforge.net"> -SourceForge</a> and distributed under the BSD licence.</p> - -<div style="text-align: right; float: right;"> -<a href="http://sourceforge.net/projects/toss"><img -src="http://sflogo.sourceforge.net/sflogo.php?group_id=115606&type=15" -width="150" height="40" style="border:0px" alt="Get TOSS at SourceForge.net. -Fast, secure and Free Open Source software downloads"/></a> -</div> - -<ul> -<li><a href="http://sourceforge.net/projects/toss/">Toss Project at - SourceForge.net</a></li> -<li><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/"> - Toss Subversion Repository</a></li> -</ul> - - -<p>Toss originates from our work in the -<a href="http://www.algosyn.rwth-aachen.de/">AlgoSyn</a> research group. -The current version of Toss is developed by</p> -<ul> -<li>Łukasz Kaiser (<script type="text/javascript">begin_mailto("kaiser", "logic.rwth-aachen.de");</script>kaiser [AT] logic.rwth-aachen.de<script type="text/javascript">end_mailto();</script>)</li> -<li>Tobias Ganzow</li> -<li>Łukasz Stafiniak</li> -</ul> -<p>Many other friends helped us with dicussion and code at some point.</p> -<ul> -<li>Dietmar Berwanger</li> -<li>Matko Botincan</li> -<li>Diana Fischer</li> -<li>Michał Wójcik</li> -</ul> -<p>Yet another group of people worked on the oldest version of Toss - (around 2004).</p> -<ul> -<li>Alexander Kharitonov</li> -<li>Peter Cholewinski</li> -</ul> - -</div> <!-- end of main --> -'; - -echo html_page ($prefix, $url, $title, $style, $body); - -?> Added: trunk/Toss/www/contact.xml =================================================================== --- trunk/Toss/www/contact.xml (rev 0) +++ trunk/Toss/www/contact.xml 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE lecture SYSTEM "xsl/xhtml1-lat1.ent"> + +<?xml-stylesheet type="text/xsl" href="xsl/main.xsl" charset="UTF-8"?> + +<personal> + <title lang="en">Contact and Links</title> + <title lang="de">Kontakt und Links</title> + <history> + <link id="contact" href="/contact.html">Contact</link> + </history> + + <portrait src="http://sflogo.sourceforge.net/sflogo.php?group_id=115606&type=15"/> + + <section title="Email"> + <par>Toss is an open source project hosted by + <a href="http://sourceforge.net">SourceForge</a> + and distributed under the BSD licence.</par> + <par>Contact us by writing to: + <mailto address="tos...@li..."/> + </par> + </section> + + <section title="Toss Links"> + <itemize> + <item><a href="http://sourceforge.net/projects/toss/">Toss Project at + SourceForge.net</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/"> + Toss Subversion Repository</a></item> + </itemize> + </section> + + + <section title="Game Playing Links"> + <par><a href="http://www.dozingcatsoftware.com/Gridlock/">Gridlock</a><br/> + Gridlock is a collection of open-source board games. It is nice to play + but is does not allow you to change the game in any easy way.</par> + + <par><a href="http://www.zillions-of-games.com/">Zillions of Games</a><br/> + Zillions of Games is a language for defining games together with a + simulator and a large library of games. It is very nice but unluckily + not open source.</par> + + <par><a href="http://www.kurnik.pl/">Kurnik</a><br/> + Kurnik is a polish site on which you can play various games.</par> + + <par><a href="http://abstractstrategy.com/main.html">Abstract Strategy + Games</a><br/> Abstract Strategy Games site allows you to learn and + play such games.</par> + + <par><a href="http://www.yourturnmyturn.com/">Your Turn My Turn</a><br/> + On Your-Turn-My-Turn you can play various board games online.</par> + </section> + + + <section title="Modelling Links"> + <par><a href="http://edu.kde.org/step/">Step</a><br/> + Step is an open-source physics simulator, a part of the KDE Education + Project. It can be used for simulation of systems with continuous + dynamics.</par> + + <par><a href="http://www.iseesystems.com/softwares/Education/StellaSoftware.aspx">STELLA</a><br/> + STELLA is a commercial simulator allowing both continuous and discrete + dynamics.</par> + + <par><a href="http://ptolemy.eecs.berkeley.edu/">Ptolemy</a><br/> + The Ptolemy project studies modelling, simulation, and design of + concurrent, real-time, embedded systems. This advanced project + allows to use various models of computation that govern + the interactions between components.</par> + + <par><a href="http://www.microsoft.com/esp/about_esp/overview.htm" + >Microsoft ESP</a><br/>ESP is a visual simulation platform + that applies game-based technology to some more complex problems.</par> + </section> + + <section title="Team"> + <par>Toss originates from our work in the + <a href="http://www.algosyn.rwth-aachen.de/">AlgoSyn</a> research group. + Many people contributed, here we name just a few. Current leaders:</par> + <itemize> + <item>Łukasz Kaiser (<mailto address="ka...@li..."/>)</item> + <item>Tobias Ganzow</item> + <item>Łukasz Stafiniak</item> + </itemize> + + <par>Friends who helped us a lot with dicussion and code at some point.</par> + <itemize> + <item>Dietmar Berwanger</item> + <item>Matko Botincan</item> + <item>Diana Fischer</item> + <item>Michał Wójcik</item> + </itemize> + <par>Yet another group of people worked on the oldest version of Toss + (around 2004).</par> + <itemize> + <item>Alexander Kharitonov</item> + <item>Peter Cholewinski</item> + </itemize> + </section> + +</personal> Added: trunk/Toss/www/create.xml =================================================================== --- trunk/Toss/www/create.xml (rev 0) +++ trunk/Toss/www/create.xml 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE lecture SYSTEM "xsl/xhtml1-lat1.ent"> + +<?xml-stylesheet type="text/xsl" href="xsl/main.xsl" charset="UTF-8"?> + +<personal> + <title lang="en">Create New Games</title> + <title lang="de">Neue Spiele Erzeugen</title> + <history> + <link id="create" href="/create.html">Create</link> + </history> + + <section title="Create New Games" lang="en"> + <par>The <a href="http://vimeo.com/10110495">Toss Tutorial</a> below + shows all the steps needed to define a simple game in Toss and explains + several other features. Alternatively, you can just take a look at our + <a href="interface.php">Interface</a> page and play with the examples. + </par> + <toss-video/> + </section> + + <section title="Neue Spiele Erzeugen" lang="de"> + <par>The <a href="http://vimeo.com/10110495">Toss Tutorial</a> below + shows all the steps needed to define a simple game in Toss and explains + several other features. Alternatively, you can just take a look at our + <a href="interface.php">Interface</a> page and play with the examples. + </par> + <toss-video/> + </section> + +</personal> Added: trunk/Toss/www/default.mak =================================================================== --- trunk/Toss/www/default.mak (rev 0) +++ trunk/Toss/www/default.mak 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,88 @@ +BINDIR = $(TOPDIR)/bin +LANGS = de en + +BIB_FILES = $(wildcard ./*.bib) +BIBTEXML_TEX_FILES = $(patsubst %.bib,%.texml,$(BIB_FILES)) +BIBTEXML_FILES = $(patsubst %.bib,%.xml,$(BIB_FILES)) + +AUXILIARY_FILES = $(TOPDIR)/navigation.xml $(TOPDIR)/people.xml $(TOPDIR)/Publications/all.bib + +XML_FILES = $(filter-out $(AUXILIARY_FILES) $(foreach lang,$(LANGS),$(wildcard ./*.$(lang).xml)) $(BIBTEXML_FILES),$(wildcard ./*.xml)) +XML_LANG_FILES = $(foreach lang,$(LANGS),$(patsubst %.xml,%.xml.$(lang),$(XML_FILES))) + +ALL_HTML_FILES = $(patsubst %.xml,%.html,$(XML_FILES)) +HTML_FILES = $(filter-out $(patsubst %.xml,%.html,$(BIBTEXML_FILES)),$(ALL_HTML_FILES)) +HTML_LANG_FILES = $(foreach lang,$(LANGS),$(patsubst %.html,%.html.$(lang),$(HTML_FILES))) + +XSL_FILES = $(wildcard ./$(TOPDIR)/xsl/*.xsl) $(wildcard ./$(TOPDIR)/xsl/include/*.xsl) + + +XSLTPROC_PARAM = --stringparam "year" "`date -r $< +"%Y"`" \ + --stringparam "last-mod" "`date -r $< +"%d %B %Y"`" \ + --stringparam "topdir" "$(TOPDIR)" \ + --stringparam "title" "" + +# create a list of all subdirs and move Publications (if it exists) to the first +# position +ALLSUBDIRS = $(shell find . -maxdepth 1 -mindepth 1 -path './.svn*'\ + -prune -o -type d -path './[A-Z]*' -printf '%P ') +SUBDIRS = $(findstring Publications, $(ALLSUBDIRS)) \ + $(filter-out Publications,$(ALLSUBDIRS)) + + +all: allsubdirs $(XML_LANG_FILES) $(HTML_FILES) $(HTML_LANG_FILES) bib + +allsubdirs: + for d in $(SUBDIRS); do (make -C $$d) done + + +bib: $(BIBTEXML_FILES) $(BIBTEXML_TEX_FILES) + + +%.texml: %.bib + $(BINDIR)/bib2xml $< | $(BINDIR)/unflatten.py --unflatten -\ + | sed 's/<?xml version="1.0" ?>/<?xml version="1.0" ?>\n/' > $@ + +%.xml: %.bib $(BINDIR)/tex2html + $(BINDIR)/bib2xml $< | $(BINDIR)/unflatten.py --unflatten -\ + | sed 's/<?xml version="1.0" ?>/<?xml version="1.0" ?>\n/'\ + | $(BINDIR)/tex2html $(TOPDIR) > $@ + + +XML_LANG_PATTERN = $(foreach lang,$(LANGS),%.xml.$(lang)) + +$(XML_LANG_PATTERN) : %.xml $(AUXILIARY_FILES) $(XSL_FILES) + for lang in $(LANGS); do \ + xsltproc --stringparam "lang" "$$lang" $(TOPDIR)/xsl/language.xsl $< \ + > $*.xml.$$lang ;\ + chmod 664 $*.xml.$$lang ;\ + done + + +%.html.de : LANG=de +%.html.de : %.xml.de $(AUXILIARY_FILES) $(XSL_FILES) $(BIBTEXML_FILES) + lang=$(LANG) ; if [ -n "$$lang" ] ; then \ + xsltproc $(XSLTPROC_PARAM) --stringparam "lang" "$(LANG)" --stringparam "uri" "$<" $< \ + | $(BINDIR)/hrefprocess "$(TOPDIR)" "$(LANG)" > $@ ;\ + chmod 664 $@ ;\ + fi + +%.html.en : LANG=en +%.html.en : %.xml.en $(AUXILIARY_FILES) $(XSL_FILES) $(BIBTEXML_FILES) + lang=$(LANG) ; if [ -n "$$lang" ] ; then \ + xsltproc $(XSLTPROC_PARAM) --stringparam "lang" "$(LANG)" --stringparam "uri" "$<" $< \ + | $(BINDIR)/hrefprocess "$(TOPDIR)" "$(LANG)" > $@ ;\ + chmod 664 $@ ;\ + fi + +%.html : %.html.en + @echo + +clean: + rm -f $(HTML_FILES) + rm -f $(HTML_LANG_FILES) + rm -f $(XML_LANG_FILES) + rm -f $(BIBTEXML_FILES) + rm -f $(BIBTEXML_TEX_FILES) + for d in $(SUBDIRS); do (make -C $$d clean) done + rm -f *~ Added: trunk/Toss/www/docs.xml =================================================================== --- trunk/Toss/www/docs.xml (rev 0) +++ trunk/Toss/www/docs.xml 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE lecture SYSTEM "xsl/xhtml1-lat1.ent"> + +<?xml-stylesheet type="text/xsl" href="xsl/main.xsl" charset="UTF-8"?> + +<personal> + <title lang="en">Documentation</title> + <title lang="de">Dokumantation</title> + <history> + <link id="docs" href="/docs.html">Documentation</link> + </history> + + <section title="Background"> + <par>To learn more about the mathematical background and + the design of Toss, use the following links.</par> + <itemize> +<item><em>Compact description</em> of the mathematical model behind Toss and +our game playing algorithm can be found in the paper +<a href="http://logic.rwth-aachen.de/~kaiser/playing_structure_rewriting_games.pdf">Playing Structure Rewriting Games</a>.</item> + +<item><em>Design and specification</em> of Toss are described in + the <a href="reference.pdf">reference.pdf</a> document.</item> + +<item> <em>Complexity</em> of a syntactic fragment of Toss was analyzed in + the paper <a href="http://logic.rwth-aachen.de/~kaiser/graph_games_short.pdf"> + Synthesis for Structure Rewriting Systems</a>.</item> +<item><em>Presentation</em> on the mathematics behind Toss was given at + <em>IIT Kanpur</em> and can be + <a href="http://www2.cse.iitk.ac.in/~fsttcs/2009/videos/star/LukaszKaiser.avi"> + watched</a> online.</item> + </itemize> + </section> + +</personal> Deleted: trunk/Toss/www/examples.php =================================================================== --- trunk/Toss/www/examples.php 2011-03-11 18:32:46 UTC (rev 1351) +++ trunk/Toss/www/examples.php 2011-03-11 18:41:40 UTC (rev 1352) @@ -1,74 +0,0 @@ -<?php @include "site_template.php"; - -//echo html_page ($prefix, $url, $title, $style, $body); - -$prefix = ""; -$url = "examples.php"; -$title = "Toss Examples Page"; -$style= ""; -$body = ' -<div class="main"> - -<h1>EXAMPLES</h1> - -<p>In the Toss file you -<a href="http://sourceforge.net/project/showfiles.php?group_id=115606"> -download</a> there is an <i>examples</i> directory -with the following examples. These are very simple models: they are meant -to get you acquainted with the way Toss works.</p> - -<h2>Simple Game</h2> - -<p>We use tic-tac-toe as the simplest example of a game. - The players play by assigning P and Q to blank positions and - the winning condition is given as a formula. You can click - <i>Hint</i> to get a move suggestion from Toss.</p> - -<a href="imgs/tic_tac_toe_screen.png"><img src="imgs/tic_tac_toe_screen_small.png" - style="float: right;" alt="tic_tac_toe_screenshot"/></a> -<p><b>(1) Tic Tac Toe</b></p> -<p>A simple tic-tac-toe game modelled using a structure.</p> - -<div style="clear: right; margin: 1em;"></div> - - -<h2>Board Games</h2> - -<p>Here are two more examples of board games which you can play with Toss.</p> - -<a href="imgs/gomoku_screen.png"><img src="imgs/gomoku_screen_small.png" - style="float: right;" alt="gomoku_screenshot"/></a> -<p><b>(2) Gomoku</b></p> -<p>This is the Gomoku (Connect-5) game played on an 8x8 board.</p> - -<div style="clear: right; margin: 1em;"></div> - -<a href="imgs/breakthrough_screen.png"><img src="imgs/breakthrough_screen_small.png" - style="float: right;" alt="breakthrough_screenshot"/></a> -<p><b>(3) Breakthrough</b></p> -<p>Standard breakthrough game.</p> - - - -<h2>Toss Features</h2> - -<p>These two examples demonstrate features of Toss.</p> - -<p><b>(4) Rewriting Example</b></p> -<p>This example shows that rewrite rules can - add elements and copy relations.</p> - -<div style="clear: right; padding: 5px;"></div> - -<p><b>(5) Bounce</b></p> -<p>This is an example where continuous dynamics is used, defined by ODEs and - with movement bounded by an invariant.</p> - -<div style="clear: right; margin: 1em;"></div> - -</div> <!-- end of main --> -'; - -echo html_page ($prefix, $url, $title, $style, $body); - -?> Added: trunk/Toss/www/examples.xml =================================================================== --- trunk/Toss/www/examples.xml (rev 0) +++ trunk/Toss/www/examples.xml 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE lecture SYSTEM "xsl/xhtml1-lat1.ent"> + +<?xml-stylesheet type="text/xsl" href="xsl/main.xsl" charset="UTF-8"?> + +<personal> + <title lang="en">Examples</title> + <title lang="de">Beispiele</title> + <history> + <link id="create" href="/create.html">Create New Games</link> + <link id="examples" href="/examples.html">Examples</link> + </history> + + <section title="Simple Games"> + <par>We use tic-tac-toe as the simplest example of a game. + The players play by assigning P and Q to blank positions and + the winning condition is given as a formula. You can click + <i>Hint</i> to get a move suggestion from Toss.</par> + + <itemize> + <item><em>(1) Tic Tac Toe</em> + A simple tic-tac-toe game modelled using a structure.</item> + </itemize> + <a href="tic_tac_toe_screen.png"> + <image src="tic_tac_toe_screen_small.png" /> + </a> + </section> + + <section title="Basic Board Games"> + <par>Here are more examples of board games which you can construct + with Toss.</par> + + <itemize> + <item><em>(2) Gomoku</em> + This is the Gomoku (Connect-5) game played on an 8x8 board.</item> + <item><em>(3) Breakthrough</em> + Standard breakthrough game.</item> + </itemize> + + <a href="imgs/gomoku_screen.png"> + <image src="gomoku_screen_small.png" /></a> + + <a href="imgs/breakthrough_screen.png"> + <image src="breakthrough_screen_small.png" /></a> + </section> + + <section title="More Complex Games"> + <par>To create more complex games, like Chess, it may be more + convenient to edit directly the textual game definition files, + rather than using only the GUI. Here are a few standard + games defined in Toss. You can them use as a starting point + for your own definitions.</par> + + <itemize> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Breakthrough.toss?revision=1349">Breakthrough</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Checkers.toss?revision=1349">Checkers</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Chess.toss?revision=1349">Chess</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Connect4.toss?revision=1349">Connect4</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Gomoku.toss?revision=1349">Gomoku</a></item> + <item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Tic-Tac-Toe.toss?revision=1349">Tic-Tac-Toe</a></item> + </itemize> + </section> + +</personal> Added: trunk/Toss/www/gui_interface.xml =================================================================== --- trunk/Toss/www/gui_interface.xml (rev 0) +++ trunk/Toss/www/gui_interface.xml 2011-03-11 18:41:40 UTC (rev 1352) @@ -0,0 +1,150 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE lecture SYSTEM "xsl/xhtml1-lat1.ent"> + +<?xml-stylesheet type="text/xsl" href="xsl/main.xsl" charset="UTF-8"?> + +<personal> + <title lang="en">GUI Interface Guide</title> + <title lang="de">GUI Interface Guide</title> + <history> + <link id="create" href="/create.html">Create New Games</link> + <link id="examples" href="/examples.html">Examples</link> + </history> + + <section title="Running the Toss GUI"> + <itemize> + <item><em>Download</em> Toss from the + <a href="http://sourceforge.net/project/showfiles.php?group_id=115606"> + Sourceforge Download Page</a>.</item> + <item><em>Run Toss</em> by clicking <em>Toss.py</em>. + You can start by opening a file from the <em>examples</em> + directory.</item> + <item><em>Screenshots</em> of a few example games are + given on the <a href="/examples.html">Examples</a> page.</item> + </itemize> + </section> + + <section title="Changing Elements"> + <itemize> + <item> + <image src="move.png" title="hand"/> + <em>The move cursor</em> can shift the whole structure (your view-point) + and give more information about elements when you hover over them + (such as name, position and speed of the element). + </item> + + <item> + <image src="draw.png" title="pointer"/> + <em>The pointer</em> can be used for three things: + <itemize> + <item>adding new elements (click on the desired spot and a circle + appears)</item> + <item>selecting and deselecting existing elements + (circle becomes disc when selected)</item> + <item>moving elements (when these are selected)</item> + </itemize> + </item> + + <item> + <image src="erase.png" title="eraser"/> + <em>The eraser</em> has two functions: + <itemize> + <item>removing an element (click on the desired circle + or disc)</item> + <item>removing a relation between elements (click on the arrow + between two elements).</item> + </itemize> + </item> + + <item> + <image src="redraw.png" title="redraw"/> + <em>The redraw button</em> should be used whenever the picture + becomes garbled. As you can imagine an overcrowded region with + many inter-crossing arrows may easily become messed up. + </item> + </itemize> + </section> + + <section title="Editing Relations"> + <par>In the <em>Relations</em> panel you can create a new relation by + clicking <em>New</em>.</par> + + <par>Establishing relations between existing elements is done + with the pointer:</par> + <itemize> + <item>In order to establish a unary relation, select exactly one element + with the pointer and then click the name of the unary relation.</item> + <item>In order to establish a binary relation, select exactly + two elements with the pointer keeping in mind which of the elements + is selected first (relations are not reflexive by default) and + click the name of the relation.</item> + <item>In a similar way you can create relations with arbitrary + arity.</item> + </itemize> + </section> + + <section title="Adding and Applying Rules"> + <itemize> + <item> + <image src="add_rule.png" title="add rule"/> + <em>The add rule</em> button is used to declare a new rewrite rule. + </item> + + <item>For moving, you can use the + <em>Match</em>, <em>Apply</em>, <em>Hint</em>, and + <em>Toss</em>, <em>Toss Run</em>, and <em>Hint Run</em> buttons. + </item> + + <item><image src="match.png" title="match"/> + <em>The match button</em> + finds an embedding of the left-hand model from a rewrite rule in one + of currently allowed moves into the main model and marks it in red. + There may be many such ... [truncated message content] |
From: <luk...@us...> - 2011-03-11 18:32:52
|
Revision: 1351 http://toss.svn.sourceforge.net/toss/?rev=1351&view=rev Author: lukaszkaiser Date: 2011-03-11 18:32:46 +0000 (Fri, 11 Mar 2011) Log Message: ----------- Small move before update. Added Paths: ----------- trunk/Toss/www/img/ Removed Paths: ------------- trunk/Toss/www/imgs/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-03-11 01:08:34
|
Revision: 1350 http://toss.svn.sourceforge.net/toss/?rev=1350&view=rev Author: lukaszkaiser Date: 2011-03-11 01:08:26 +0000 (Fri, 11 Mar 2011) Log Message: ----------- Guest play in WebClient. Modified Paths: -------------- trunk/Toss/WebClient/Login.js trunk/Toss/WebClient/Main.js trunk/Toss/WebClient/Style.css trunk/Toss/WebClient/index.html Added Paths: ----------- trunk/Toss/WebClient/pics/ trunk/Toss/WebClient/pics/Breakthrough.png trunk/Toss/WebClient/pics/Breakthrough.svg trunk/Toss/WebClient/pics/Checkers.html trunk/Toss/WebClient/pics/Checkers.png trunk/Toss/WebClient/pics/Checkers.svg trunk/Toss/WebClient/pics/Chess.png trunk/Toss/WebClient/pics/Chess.svg trunk/Toss/WebClient/pics/Connect4.png trunk/Toss/WebClient/pics/Connect4.svg trunk/Toss/WebClient/pics/Entanglement.png trunk/Toss/WebClient/pics/Entanglement.svg trunk/Toss/WebClient/pics/Gomoku.png trunk/Toss/WebClient/pics/Gomoku.svg trunk/Toss/WebClient/pics/Pawn-Whopping.png trunk/Toss/WebClient/pics/Pawn-Whopping.svg trunk/Toss/WebClient/pics/Style.css trunk/Toss/WebClient/pics/Style2.css trunk/Toss/WebClient/pics/Tic-Tac-Toe.png trunk/Toss/WebClient/pics/Tic-Tac-Toe.svg trunk/Toss/WebClient/pics/convert_all.sh Modified: trunk/Toss/WebClient/Login.js =================================================================== --- trunk/Toss/WebClient/Login.js 2011-03-10 18:14:24 UTC (rev 1349) +++ trunk/Toss/WebClient/Login.js 2011-03-11 01:08:26 UTC (rev 1350) @@ -151,6 +151,10 @@ alert ("Your username must not contain spaces." + CORRMSG); return; } + if (un == "guest" || un == "computer") { + alert ("Your username must not be 'guest' or 'computer'." + CORRMSG); + return; + } if (pwd.length < 3) { alert ("Your password is too short." + CORRMSG); return; Modified: trunk/Toss/WebClient/Main.js =================================================================== --- trunk/Toss/WebClient/Main.js 2011-03-10 18:14:24 UTC (rev 1349) +++ trunk/Toss/WebClient/Main.js 2011-03-11 01:08:26 UTC (rev 1350) @@ -218,8 +218,8 @@ if (CUR_MOVE == "") return; var m = PLAYS[CUR_PLAY_I][3]; if (PLAYS[CUR_PLAY_I][m] != UNAME && PLAYS[CUR_PLAY_I][m] != "computer") { - alert ("It is your Opponent's turn"); - return; + alert ("It is your Opponent's turn"); + return; } document.getElementById("working").style.display = "block"; var info = srv("MOVE_PLAY", 'c, '+ CUR_MOVE +', '+ play_py_id (CUR_PLAY_I)); @@ -238,7 +238,7 @@ var li = new_play_item (GAME_NAME, CUR_PLAY_I); old_li.parentNode.replaceChild (li, old_li); if (PLAYS[CUR_PLAY_I][PLAYER_STR] == "computer") { - var m = suggest_move_better (); + var m = suggest_move (); if (m != "") { make_move (); } } } @@ -333,6 +333,17 @@ return ("'''" + svg_s + "'''"); } +function new_play_guest (game) { + if (game == "Chess") { + alert ("At present Chess is not supported in automatic mode.\n" + + "Please Register (above, right) to play against Your Friends."); + return + } + GAME_NAME = game; + UNAME = "guest"; + new_play_do ("computer"); +} + function new_play_do (opp_uid) { list_plays (GAME_NAME) game_click (GAME_NAME) Modified: trunk/Toss/WebClient/Style.css =================================================================== --- trunk/Toss/WebClient/Style.css 2011-03-10 18:14:24 UTC (rev 1349) +++ trunk/Toss/WebClient/Style.css 2011-03-11 01:08:26 UTC (rev 1350) @@ -484,8 +484,9 @@ #welcome { text-align: justify; - margin-top: 5em; + margin-top: 4em; margin-left: 2em; + margin-bottom: 2em; } #welcome-top { Modified: trunk/Toss/WebClient/index.html =================================================================== --- trunk/Toss/WebClient/index.html 2011-03-10 18:14:24 UTC (rev 1349) +++ trunk/Toss/WebClient/index.html 2011-03-11 01:08:26 UTC (rev 1350) @@ -75,6 +75,45 @@ <a href="register.html">Register</a>, login and enjoy quality games with our best interface on <span class="logo-in">tPlay</span>! </p> + +<p style="width:100%; text-align: justify"> +<button onclick="new_play_guest('Breakthrough')" style="width:24%" + class="boldobt" title="Play Breakthrough"> + <img style="max-width:95%" src="pics/Breakthrough.png" alt="Breakthrough Board"> +</button> +<button onclick="new_play_guest('Checkers')" style="width:24%" + class="boldobt" title="Play Checkers"> + <img style="max-width:95%" src="pics/Checkers.png" alt="Checkers Board"> +</button> +<button onclick="new_play_guest('Chess')" style="width:24%" + class="boldobt" title="Play Chess"> + <img style="max-width:95%" src="pics/Chess.png" alt="Chess Board"> +</button> +<button onclick="new_play_guest('Connect4')" style="width:24%" + class="boldobt" title="Play Connect4"> + <img style="max-width:95%" src="pics/Connect4.png" alt="Connect4 Board"> +</button> +</p> + +<p style="width:100%; text-align: justify"> +<button onclick="new_play_guest('Entanglement')" style="width:24%" + class="boldobt" title="Play Entanglement"> + <img style="max-width:95%" src="pics/Entanglement.png" alt="Entanglement Board"> +</button> +<button onclick="new_play_guest('Gomoku')" style="width:24%" + class="boldobt" title="Play Gomoku"> + <img style="max-width:95%" src="pics/Gomoku.png" alt="Gomoku Board"> +</button> +<button onclick="new_play_guest('Pawn-Whopping')" style="width:24%" + class="boldobt" title="Play Pawn-Whopping"> + <img style="max-width:95%" src="pics/Pawn-Whopping.png" alt="Pawn-Whopping Board"> +</button> +<button onclick="new_play_guest('Tic-Tac-Toe')" style="width:24%" + class="boldobt" title="Play Tic-Tac-Toe"> + <img style="max-width:95%" src="pics/Tic-Tac-Toe.png" alt="Tic-Tac-Toe Board"> +</button> +</p> + <ul class="welcome-list"> <li>Play Breakthrough, Checkers, Chess, Gomoku and many other board games</li> <li>Challenge your friends or play a fast game against the computer for fun</li> @@ -83,6 +122,7 @@ <li>Invent new games with <a href="http://toss.sourceforge.net/">Toss</a> and play them online here</li> </ul> + </div> <div id="nosvg" Added: trunk/Toss/WebClient/pics/Breakthrough.png =================================================================== (Binary files differ) Property changes on: trunk/Toss/WebClient/pics/Breakthrough.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/Toss/WebClient/pics/Breakthrough.svg =================================================================== --- trunk/Toss/WebClient/pics/Breakthrough.svg (rev 0) +++ trunk/Toss/WebClient/pics/Breakthrough.svg 2011-03-11 01:08:26 UTC (rev 1350) @@ -0,0 +1,3 @@ +<?xml-stylesheet href="Style.css" type="text/css"?> +<svg id="svg" viewBox="0 0 580 580"> +<rect class="model-elem-0" x="4.285714285714285" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_a1" ></rect><rect class="model-elem-1" x="75.71428571428572" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_b1" ></rect><rect class="model-elem-0" x="147.14285714285714" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_c1" ></rect><rect class="model-elem-1" x="218.57142857142856" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_d1" ></rect><rect class="model-elem-0" x="290" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_e1" ></rect><rect class="model-elem-1" x="361.42857142857144" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_f1" ></rect><rect class="model-elem-0" x="432.85714285714283" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_g1" ></rect><rect class="model-elem-1" x="504.2857142857143" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_h1" ></rect><rect class="model-elem-1" x="4.285714285714285" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_a2" ></rect><rect class="model-elem-0" x="75.71428571428572" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_b2" ></rect><rect class="model-elem-1" x="147.14285714285714" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_c2" ></rect><rect class="model-elem-0" x="218.57142857142856" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_d2" ></rect><rect class="model-elem-1" x="290" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_e2" ></rect><rect class="model-elem-0" x="361.42857142857144" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_f2" ></rect><rect class="model-elem-1" x="432.85714285714283" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_g2" ></rect><rect class="model-elem-0" x="504.2857142857143" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_h2" ></rect><rect class="model-elem-0" x="4.285714285714285" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_a3" ></rect><rect class="model-elem-1" x="75.71428571428572" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_b3" ></rect><rect class="model-elem-0" x="147.14285714285714" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_c3" ></rect><rect class="model-elem-1" x="218.57142857142856" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_d3" ></rect><rect class="model-elem-0" x="290" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_e3" ></rect><rect class="model-elem-1" x="361.42857142857144" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_f3" ></rect><rect class="model-elem-0" x="432.85714285714283" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_g3" ></rect><rect class="model-elem-1" x="504.2857142857143" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_h3" ></rect><rect class="model-elem-1" x="4.285714285714285" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_a4" ></rect><rect class="model-elem-0" x="75.71428571428572" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_b4" ></rect><rect class="model-elem-1" x="147.14285714285714" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_c4" ></rect><rect class="model-elem-0" x="218.57142857142856" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_d4" ></rect><rect class="model-elem-1" x="290" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_e4" ></rect><rect class="model-elem-0" x="361.42857142857144" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_f4" ></rect><rect class="model-elem-1" x="432.85714285714283" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_g4" ></rect><rect class="model-elem-0" x="504.2857142857143" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_h4" ></rect><rect class="model-elem-0" x="4.285714285714285" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_a5" ></rect><rect class="model-elem-1" x="75.71428571428572" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_b5" ></rect><rect class="model-elem-0" x="147.14285714285714" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_c5" ></rect><rect class="model-elem-1" x="218.57142857142856" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_d5" ></rect><rect class="model-elem-0" x="290" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_e5" ></rect><rect class="model-elem-1" x="361.42857142857144" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_f5" ></rect><rect class="model-elem-0" x="432.85714285714283" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_g5" ></rect><rect class="model-elem-1" x="504.2857142857143" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_h5" ></rect><rect class="model-elem-1" x="4.285714285714285" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_a6" ></rect><rect class="model-elem-0" x="75.71428571428572" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_b6" ></rect><rect class="model-elem-1" x="147.14285714285714" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_c6" ></rect><rect class="model-elem-0" x="218.57142857142856" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_d6" ></rect><rect class="model-elem-1" x="290" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_e6" ></rect><rect class="model-elem-0" x="361.42857142857144" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_f6" ></rect><rect class="model-elem-1" x="432.85714285714283" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_g6" ></rect><rect class="model-elem-0" x="504.2857142857143" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_h6" ></rect><rect class="model-elem-0" x="4.285714285714285" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_a7" ></rect><rect class="model-elem-1" x="75.71428571428572" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_b7" ></rect><rect class="model-elem-0" x="147.14285714285714" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_c7" ></rect><rect class="model-elem-1" x="218.57142857142856" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_d7" ></rect><rect class="model-elem-0" x="290" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_e7" ></rect><rect class="model-elem-1" x="361.42857142857144" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_f7" ></rect><rect class="model-elem-0" x="432.85714285714283" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_g7" ></rect><rect class="model-elem-1" x="504.2857142857143" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_h7" ></rect><rect class="model-elem-1" x="4.285714285714285" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_a8" ></rect><rect class="model-elem-0" x="75.71428571428572" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_b8" ></rect><rect class="model-elem-1" x="147.14285714285714" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_c8" ></rect><rect class="model-elem-0" x="218.57142857142856" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_d8" ></rect><rect class="model-elem-1" x="290" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_e8" ></rect><rect class="model-elem-0" x="361.42857142857144" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_f8" ></rect><rect class="model-elem-1" x="432.85714285714283" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_g8" ></rect><rect class="model-elem-0" x="504.2857142857143" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_h8" ></rect><circle class="model-pred-B" cx="40" cy="111.42857142857143" r="23.714285714285715" id="pred_a7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="111.42857142857143" cy="111.42857142857143" r="23.714285714285715" id="pred_b7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="182.85714285714286" cy="111.42857142857143" r="23.714285714285715" id="pred_c7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="254.28571428571428" cy="111.42857142857143" r="23.714285714285715" id="pred_d7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="325.7142857142857" cy="111.42857142857143" r="23.714285714285715" id="pred_e7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="397.14285714285717" cy="111.42857142857143" r="23.714285714285715" id="pred_f7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="468.57142857142856" cy="111.42857142857143" r="23.714285714285715" id="pred_g7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="540" cy="111.42857142857143" r="23.714285714285715" id="pred_h7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="40" cy="40" r="23.714285714285715" id="pred_a8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="111.42857142857143" cy="40" r="23.714285714285715" id="pred_b8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="182.85714285714286" cy="40" r="23.714285714285715" id="pred_c8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="254.28571428571428" cy="40" r="23.714285714285715" id="pred_d8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="325.7142857142857" cy="40" r="23.714285714285715" id="pred_e8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="397.14285714285717" cy="40" r="23.714285714285715" id="pred_f8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="468.57142857142856" cy="40" r="23.714285714285715" id="pred_g8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="540" cy="40" r="23.714285714285715" id="pred_h8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="40" cy="540" r="23.714285714285715" id="pred_a1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="111.42857142857143" cy="540" r="23.714285714285715" id="pred_b1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="182.85714285714286" cy="540" r="23.714285714285715" id="pred_c1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="254.28571428571428" cy="540" r="23.714285714285715" id="pred_d1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="325.7142857142857" cy="540" r="23.714285714285715" id="pred_e1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="397.14285714285717" cy="540" r="23.714285714285715" id="pred_f1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="468.57142857142856" cy="540" r="23.714285714285715" id="pred_g1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="540" cy="540" r="23.714285714285715" id="pred_h1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="40" cy="468.57142857142856" r="23.714285714285715" id="pred_a2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="111.42857142857143" cy="468.57142857142856" r="23.714285714285715" id="pred_b2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="182.85714285714286" cy="468.57142857142856" r="23.714285714285715" id="pred_c2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="254.28571428571428" cy="468.57142857142856" r="23.714285714285715" id="pred_d2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="325.7142857142857" cy="468.57142857142856" r="23.714285714285715" id="pred_e2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="397.14285714285717" cy="468.57142857142856" r="23.714285714285715" id="pred_f2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="468.57142857142856" cy="468.57142857142856" r="23.714285714285715" id="pred_g2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="540" cy="468.57142857142856" r="23.714285714285715" id="pred_h2_W" stroke-width="5.571428571428571" ></circle></svg> Added: trunk/Toss/WebClient/pics/Checkers.html =================================================================== --- trunk/Toss/WebClient/pics/Checkers.html (rev 0) +++ trunk/Toss/WebClient/pics/Checkers.html 2011-03-11 01:08:26 UTC (rev 1350) @@ -0,0 +1,16 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xml:lang="en" lang="en"> +<head> + <meta http-equiv="Content-Type" content="text/xhtml+xml; charset=UTF-8" /> + <title>tPlay</title> + <meta name="Description" + content="Play the best strategic games online with a nice interface." /> + <meta http-equiv="X-UA-Compatible" content="chrome=1" /> + <link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico" /> + <link href="fontstyle.css" media="screen" rel="stylesheet" type="text/css" /> + <link rel="stylesheet" type="text/css" href="Style.css" media="screen" title="Default"/> +</head> +<body> +<svg id="svg" class="Game-Checkers" viewBox="0 0 580 580"><rect class="model-elem-0" x="4.285714285714285" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_a1" ></rect><rect class="model-elem-1" x="75.71428571428572" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_b1" ></rect><rect class="model-elem-0" x="147.14285714285714" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_c1" ></rect><rect class="model-elem-1" x="218.57142857142856" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_d1" ></rect><rect class="model-elem-0" x="290" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_e1" ></rect><rect class="model-elem-1" x="361.42857142857144" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_f1" ></rect><rect class="model-elem-0" x="432.85714285714283" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_g1" ></rect><rect class="model-elem-1" x="504.2857142857143" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_h1" ></rect><rect class="model-elem-1" x="4.285714285714285" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_a2" ></rect><rect class="model-elem-0" x="75.71428571428572" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_b2" ></rect><rect class="model-elem-1" x="147.14285714285714" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_c2" ></rect><rect class="model-elem-0" x="218.57142857142856" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_d2" ></rect><rect class="model-elem-1" x="290" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_e2" ></rect><rect class="model-elem-0" x="361.42857142857144" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_f2" ></rect><rect class="model-elem-1" x="432.85714285714283" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_g2" ></rect><rect class="model-elem-0" x="504.2857142857143" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_h2" ></rect><rect class="model-elem-0" x="4.285714285714285" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_a3" ></rect><rect class="model-elem-1" x="75.71428571428572" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_b3" ></rect><rect class="model-elem-0" x="147.14285714285714" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_c3" ></rect><rect class="model-elem-1" x="218.57142857142856" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_d3" ></rect><rect class="model-elem-0" x="290" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_e3" ></rect><rect class="model-elem-1" x="361.42857142857144" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_f3" ></rect><rect class="model-elem-0" x="432.85714285714283" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_g3" ></rect><rect class="model-elem-1" x="504.2857142857143" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_h3" ></rect><rect class="model-elem-1" x="4.285714285714285" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_a4" ></rect><rect class="model-elem-0" x="75.71428571428572" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_b4" ></rect><rect class="model-elem-1" x="147.14285714285714" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_c4" ></rect><rect class="model-elem-0" x="218.57142857142856" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_d4" ></rect><rect class="model-elem-1" x="290" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_e4" ></rect><rect class="model-elem-0" x="361.42857142857144" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_f4" ></rect><rect class="model-elem-1" x="432.85714285714283" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_g4" ></rect><rect class="model-elem-0" x="504.2857142857143" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_h4" ></rect><rect class="model-elem-0" x="4.285714285714285" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_a5" ></rect><rect class="model-elem-1" x="75.71428571428572" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_b5" ></rect><rect class="model-elem-0" x="147.14285714285714" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_c5" ></rect><rect class="model-elem-1" x="218.57142857142856" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_d5" ></rect><rect class="model-elem-0" x="290" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_e5" ></rect><rect class="model-elem-1" x="361.42857142857144" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_f5" ></rect><rect class="model-elem-0" x="432.85714285714283" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_g5" ></rect><rect class="model-elem-1" x="504.2857142857143" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_h5" ></rect><rect class="model-elem-1" x="4.285714285714285" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_a6" ></rect><rect class="model-elem-0" x="75.71428571428572" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_b6" ></rect><rect class="model-elem-1" x="147.14285714285714" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_c6" ></rect><rect class="model-elem-0" x="218.57142857142856" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_d6" ></rect><rect class="model-elem-1" x="290" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_e6" ></rect><rect class="model-elem-0" x="361.42857142857144" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_f6" ></rect><rect class="model-elem-1" x="432.85714285714283" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_g6" ></rect><rect class="model-elem-0" x="504.2857142857143" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_h6" ></rect><rect class="model-elem-0" x="4.285714285714285" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_a7" ></rect><rect class="model-elem-1" x="75.71428571428572" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_b7" ></rect><rect class="model-elem-0" x="147.14285714285714" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_c7" ></rect><rect class="model-elem-1" x="218.57142857142856" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_d7" ></rect><rect class="model-elem-0" x="290" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_e7" ></rect><rect class="model-elem-1" x="361.42857142857144" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_f7" ></rect><rect class="model-elem-0" x="432.85714285714283" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_g7" ></rect><rect class="model-elem-1" x="504.2857142857143" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_h7" ></rect><rect class="model-elem-1" x="4.285714285714285" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_a8" ></rect><rect class="model-elem-0" x="75.71428571428572" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_b8" ></rect><rect class="model-elem-1" x="147.14285714285714" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_c8" ></rect><rect class="model-elem-0" x="218.57142857142856" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_d8" ></rect><rect class="model-elem-1" x="290" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_e8" ></rect><rect class="model-elem-0" x="361.42857142857144" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_f8" ></rect><rect class="model-elem-1" x="432.85714285714283" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_g8" ></rect><rect class="model-elem-0" x="504.2857142857143" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_h8" ></rect><circle class="model-pred-W" cx="40" cy="540" r="23.714285714285715" id="pred_a1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="182.85714285714286" cy="540" r="23.714285714285715" id="pred_c1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="325.7142857142857" cy="540" r="23.714285714285715" id="pred_e1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="468.57142857142856" cy="540" r="23.714285714285715" id="pred_g1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="111.42857142857143" cy="468.57142857142856" r="23.714285714285715" id="pred_b2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="254.28571428571428" cy="468.57142857142856" r="23.714285714285715" id="pred_d2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="397.14285714285717" cy="468.57142857142856" r="23.714285714285715" id="pred_f2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="540" cy="468.57142857142856" r="23.714285714285715" id="pred_h2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="40" cy="397.14285714285717" r="23.714285714285715" id="pred_a3_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="182.85714285714286" cy="397.14285714285717" r="23.714285714285715" id="pred_c3_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="325.7142857142857" cy="397.14285714285717" r="23.714285714285715" id="pred_e3_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="468.57142857142856" cy="397.14285714285717" r="23.714285714285715" id="pred_g3_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="111.42857142857143" cy="182.85714285714286" r="23.714285714285715" id="pred_b6_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="254.28571428571428" cy="182.85714285714286" r="23.714285714285715" id="pred_d6_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="397.14285714285717" cy="182.85714285714286" r="23.714285714285715" id="pred_f6_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="540" cy="182.85714285714286" r="23.714285714285715" id="pred_h6_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="40" cy="111.42857142857143" r="23.714285714285715" id="pred_a7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="182.85714285714286" cy="111.42857142857143" r="23.714285714285715" id="pred_c7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="325.7142857142857" cy="111.42857142857143" r="23.714285714285715" id="pred_e7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="468.57142857142856" cy="111.42857142857143" r="23.714285714285715" id="pred_g7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="111.42857142857143" cy="40" r="23.714285714285715" id="pred_b8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="254.28571428571428" cy="40" r="23.714285714285715" id="pred_d8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="397.14285714285717" cy="40" r="23.714285714285715" id="pred_f8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="540" cy="40" r="23.714285714285715" id="pred_h8_B" stroke-width="5.571428571428571" ></circle></svg> +</body> +</html> Added: trunk/Toss/WebClient/pics/Checkers.png =================================================================== (Binary files differ) Property changes on: trunk/Toss/WebClient/pics/Checkers.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/Toss/WebClient/pics/Checkers.svg =================================================================== --- trunk/Toss/WebClient/pics/Checkers.svg (rev 0) +++ trunk/Toss/WebClient/pics/Checkers.svg 2011-03-11 01:08:26 UTC (rev 1350) @@ -0,0 +1,2 @@ +<?xml-stylesheet href="Style2.css" type="text/css"?> +<svg id="svg" viewBox="0 0 580 580"><rect class="model-elem-0" x="4.285714285714285" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_a1" ></rect><rect class="model-elem-1" x="75.71428571428572" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_b1" ></rect><rect class="model-elem-0" x="147.14285714285714" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_c1" ></rect><rect class="model-elem-1" x="218.57142857142856" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_d1" ></rect><rect class="model-elem-0" x="290" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_e1" ></rect><rect class="model-elem-1" x="361.42857142857144" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_f1" ></rect><rect class="model-elem-0" x="432.85714285714283" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_g1" ></rect><rect class="model-elem-1" x="504.2857142857143" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_h1" ></rect><rect class="model-elem-1" x="4.285714285714285" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_a2" ></rect><rect class="model-elem-0" x="75.71428571428572" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_b2" ></rect><rect class="model-elem-1" x="147.14285714285714" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_c2" ></rect><rect class="model-elem-0" x="218.57142857142856" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_d2" ></rect><rect class="model-elem-1" x="290" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_e2" ></rect><rect class="model-elem-0" x="361.42857142857144" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_f2" ></rect><rect class="model-elem-1" x="432.85714285714283" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_g2" ></rect><rect class="model-elem-0" x="504.2857142857143" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_h2" ></rect><rect class="model-elem-0" x="4.285714285714285" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_a3" ></rect><rect class="model-elem-1" x="75.71428571428572" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_b3" ></rect><rect class="model-elem-0" x="147.14285714285714" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_c3" ></rect><rect class="model-elem-1" x="218.57142857142856" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_d3" ></rect><rect class="model-elem-0" x="290" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_e3" ></rect><rect class="model-elem-1" x="361.42857142857144" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_f3" ></rect><rect class="model-elem-0" x="432.85714285714283" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_g3" ></rect><rect class="model-elem-1" x="504.2857142857143" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_h3" ></rect><rect class="model-elem-1" x="4.285714285714285" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_a4" ></rect><rect class="model-elem-0" x="75.71428571428572" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_b4" ></rect><rect class="model-elem-1" x="147.14285714285714" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_c4" ></rect><rect class="model-elem-0" x="218.57142857142856" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_d4" ></rect><rect class="model-elem-1" x="290" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_e4" ></rect><rect class="model-elem-0" x="361.42857142857144" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_f4" ></rect><rect class="model-elem-1" x="432.85714285714283" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_g4" ></rect><rect class="model-elem-0" x="504.2857142857143" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_h4" ></rect><rect class="model-elem-0" x="4.285714285714285" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_a5" ></rect><rect class="model-elem-1" x="75.71428571428572" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_b5" ></rect><rect class="model-elem-0" x="147.14285714285714" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_c5" ></rect><rect class="model-elem-1" x="218.57142857142856" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_d5" ></rect><rect class="model-elem-0" x="290" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_e5" ></rect><rect class="model-elem-1" x="361.42857142857144" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_f5" ></rect><rect class="model-elem-0" x="432.85714285714283" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_g5" ></rect><rect class="model-elem-1" x="504.2857142857143" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_h5" ></rect><rect class="model-elem-1" x="4.285714285714285" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_a6" ></rect><rect class="model-elem-0" x="75.71428571428572" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_b6" ></rect><rect class="model-elem-1" x="147.14285714285714" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_c6" ></rect><rect class="model-elem-0" x="218.57142857142856" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_d6" ></rect><rect class="model-elem-1" x="290" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_e6" ></rect><rect class="model-elem-0" x="361.42857142857144" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_f6" ></rect><rect class="model-elem-1" x="432.85714285714283" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_g6" ></rect><rect class="model-elem-0" x="504.2857142857143" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_h6" ></rect><rect class="model-elem-0" x="4.285714285714285" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_a7" ></rect><rect class="model-elem-1" x="75.71428571428572" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_b7" ></rect><rect class="model-elem-0" x="147.14285714285714" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_c7" ></rect><rect class="model-elem-1" x="218.57142857142856" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_d7" ></rect><rect class="model-elem-0" x="290" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_e7" ></rect><rect class="model-elem-1" x="361.42857142857144" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_f7" ></rect><rect class="model-elem-0" x="432.85714285714283" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_g7" ></rect><rect class="model-elem-1" x="504.2857142857143" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_h7" ></rect><rect class="model-elem-1" x="4.285714285714285" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_a8" ></rect><rect class="model-elem-0" x="75.71428571428572" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_b8" ></rect><rect class="model-elem-1" x="147.14285714285714" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_c8" ></rect><rect class="model-elem-0" x="218.57142857142856" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_d8" ></rect><rect class="model-elem-1" x="290" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_e8" ></rect><rect class="model-elem-0" x="361.42857142857144" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_f8" ></rect><rect class="model-elem-1" x="432.85714285714283" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_g8" ></rect><rect class="model-elem-0" x="504.2857142857143" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_h8" ></rect><circle class="model-pred-W" cx="40" cy="540" r="23.714285714285715" id="pred_a1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="182.85714285714286" cy="540" r="23.714285714285715" id="pred_c1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="325.7142857142857" cy="540" r="23.714285714285715" id="pred_e1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="468.57142857142856" cy="540" r="23.714285714285715" id="pred_g1_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="111.42857142857143" cy="468.57142857142856" r="23.714285714285715" id="pred_b2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="254.28571428571428" cy="468.57142857142856" r="23.714285714285715" id="pred_d2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="397.14285714285717" cy="468.57142857142856" r="23.714285714285715" id="pred_f2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="540" cy="468.57142857142856" r="23.714285714285715" id="pred_h2_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="40" cy="397.14285714285717" r="23.714285714285715" id="pred_a3_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="182.85714285714286" cy="397.14285714285717" r="23.714285714285715" id="pred_c3_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="325.7142857142857" cy="397.14285714285717" r="23.714285714285715" id="pred_e3_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-W" cx="468.57142857142856" cy="397.14285714285717" r="23.714285714285715" id="pred_g3_W" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="111.42857142857143" cy="182.85714285714286" r="23.714285714285715" id="pred_b6_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="254.28571428571428" cy="182.85714285714286" r="23.714285714285715" id="pred_d6_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="397.14285714285717" cy="182.85714285714286" r="23.714285714285715" id="pred_f6_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="540" cy="182.85714285714286" r="23.714285714285715" id="pred_h6_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="40" cy="111.42857142857143" r="23.714285714285715" id="pred_a7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="182.85714285714286" cy="111.42857142857143" r="23.714285714285715" id="pred_c7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="325.7142857142857" cy="111.42857142857143" r="23.714285714285715" id="pred_e7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="468.57142857142856" cy="111.42857142857143" r="23.714285714285715" id="pred_g7_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="111.42857142857143" cy="40" r="23.714285714285715" id="pred_b8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="254.28571428571428" cy="40" r="23.714285714285715" id="pred_d8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="397.14285714285717" cy="40" r="23.714285714285715" id="pred_f8_B" stroke-width="5.571428571428571" ></circle><circle class="model-pred-B" cx="540" cy="40" r="23.714285714285715" id="pred_h8_B" stroke-width="5.571428571428571" ></circle></svg> Added: trunk/Toss/WebClient/pics/Chess.png =================================================================== (Binary files differ) Property changes on: trunk/Toss/WebClient/pics/Chess.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/Toss/WebClient/pics/Chess.svg =================================================================== --- trunk/Toss/WebClient/pics/Chess.svg (rev 0) +++ trunk/Toss/WebClient/pics/Chess.svg 2011-03-11 01:08:26 UTC (rev 1350) @@ -0,0 +1,2 @@ +<?xml-stylesheet href="Style2.css" type="text/css"?> +<svg id="svg" class="Game-Chess" viewBox="0 0 580 580"><rect class="model-elem-0" x="4.285714285714285" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_a1" ></rect><rect class="model-elem-1" x="75.71428571428572" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_b1" ></rect><rect class="model-elem-0" x="147.14285714285714" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_c1" ></rect><rect class="model-elem-1" x="218.57142857142856" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_d1" ></rect><rect class="model-elem-0" x="290" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_e1" ></rect><rect class="model-elem-1" x="361.42857142857144" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_f1" ></rect><rect class="model-elem-0" x="432.85714285714283" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_g1" ></rect><rect class="model-elem-1" x="504.2857142857143" y="504.2857142857143" width="71.42857142857143" height="71.42857142857143" id="elem_h1" ></rect><rect class="model-elem-1" x="4.285714285714285" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_a2" ></rect><rect class="model-elem-0" x="75.71428571428572" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_b2" ></rect><rect class="model-elem-1" x="147.14285714285714" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_c2" ></rect><rect class="model-elem-0" x="218.57142857142856" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_d2" ></rect><rect class="model-elem-1" x="290" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_e2" ></rect><rect class="model-elem-0" x="361.42857142857144" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_f2" ></rect><rect class="model-elem-1" x="432.85714285714283" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_g2" ></rect><rect class="model-elem-0" x="504.2857142857143" y="432.85714285714283" width="71.42857142857143" height="71.42857142857143" id="elem_h2" ></rect><rect class="model-elem-0" x="4.285714285714285" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_a3" ></rect><rect class="model-elem-1" x="75.71428571428572" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_b3" ></rect><rect class="model-elem-0" x="147.14285714285714" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_c3" ></rect><rect class="model-elem-1" x="218.57142857142856" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_d3" ></rect><rect class="model-elem-0" x="290" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_e3" ></rect><rect class="model-elem-1" x="361.42857142857144" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_f3" ></rect><rect class="model-elem-0" x="432.85714285714283" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_g3" ></rect><rect class="model-elem-1" x="504.2857142857143" y="361.42857142857144" width="71.42857142857143" height="71.42857142857143" id="elem_h3" ></rect><rect class="model-elem-1" x="4.285714285714285" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_a4" ></rect><rect class="model-elem-0" x="75.71428571428572" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_b4" ></rect><rect class="model-elem-1" x="147.14285714285714" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_c4" ></rect><rect class="model-elem-0" x="218.57142857142856" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_d4" ></rect><rect class="model-elem-1" x="290" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_e4" ></rect><rect class="model-elem-0" x="361.42857142857144" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_f4" ></rect><rect class="model-elem-1" x="432.85714285714283" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_g4" ></rect><rect class="model-elem-0" x="504.2857142857143" y="290" width="71.42857142857143" height="71.42857142857143" id="elem_h4" ></rect><rect class="model-elem-0" x="4.285714285714285" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_a5" ></rect><rect class="model-elem-1" x="75.71428571428572" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_b5" ></rect><rect class="model-elem-0" x="147.14285714285714" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_c5" ></rect><rect class="model-elem-1" x="218.57142857142856" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_d5" ></rect><rect class="model-elem-0" x="290" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_e5" ></rect><rect class="model-elem-1" x="361.42857142857144" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_f5" ></rect><rect class="model-elem-0" x="432.85714285714283" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_g5" ></rect><rect class="model-elem-1" x="504.2857142857143" y="218.57142857142856" width="71.42857142857143" height="71.42857142857143" id="elem_h5" ></rect><rect class="model-elem-1" x="4.285714285714285" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_a6" ></rect><rect class="model-elem-0" x="75.71428571428572" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_b6" ></rect><rect class="model-elem-1" x="147.14285714285714" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_c6" ></rect><rect class="model-elem-0" x="218.57142857142856" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_d6" ></rect><rect class="model-elem-1" x="290" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_e6" ></rect><rect class="model-elem-0" x="361.42857142857144" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_f6" ></rect><rect class="model-elem-1" x="432.85714285714283" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_g6" ></rect><rect class="model-elem-0" x="504.2857142857143" y="147.14285714285714" width="71.42857142857143" height="71.42857142857143" id="elem_h6" ></rect><rect class="model-elem-0" x="4.285714285714285" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_a7" ></rect><rect class="model-elem-1" x="75.71428571428572" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_b7" ></rect><rect class="model-elem-0" x="147.14285714285714" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_c7" ></rect><rect class="model-elem-1" x="218.57142857142856" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_d7" ></rect><rect class="model-elem-0" x="290" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_e7" ></rect><rect class="model-elem-1" x="361.42857142857144" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_f7" ></rect><rect class="model-elem-0" x="432.85714285714283" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_g7" ></rect><rect class="model-elem-1" x="504.2857142857143" y="75.71428571428572" width="71.42857142857143" height="71.42857142857143" id="elem_h7" ></rect><rect class="model-elem-1" x="4.285714285714285" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_a8" ></rect><rect class="model-elem-0" x="75.71428571428572" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_b8" ></rect><rect class="model-elem-1" x="147.14285714285714" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_c8" ></rect><rect class="model-elem-0" x="218.57142857142856" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_d8" ></rect><rect class="model-elem-1" x="290" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_e8" ></rect><rect class="model-elem-0" x="361.42857142857144" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_f8" ></rect><rect class="model-elem-1" x="432.85714285714283" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_g8" ></rect><rect class="model-elem-0" x="504.2857142857143" y="4.285714285714285" width="71.42857142857143" height="71.42857142857143" id="elem_h8" ></rect><g transform="translate(40,40) scale(1.2857142857142858,1.2857142857142858)"><g class="chessB" id="pred_a8_bR" ><g transform="translate(-22.5,-22.5)"> <path d="M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z " style="stroke-linecap:butt;" class="chess-path-Bx"></path> <path d="M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z " style="stroke-linecap:butt;" class="chess-path-B"></path> <path d="M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14" style="stroke-linecap:butt;" class="chess-path-B"></path> <path d="M 34,14 L 31,17 L 14,17 L 11,14" style="stroke-linecap:butt;" class="chess-path-B"></path> <path d="M 31,17 L 31,29.5 L 14,29.5 L 14,17" style="stroke-linecap:butt;" class="chess-path-B"></path> <path d="M 31,29.5 L 32.5,32 L 12.5,32 L 14,29.5" class="chess-path-B"></path> <path d="M 11,14 L 34,14" class="chess-path-D"></path> </g></g> </g><g transform="translate(540,40) scale(1.2857142857142858,1.2857142857142858)"><g class="chessB" id="pred_h8_bR" ><g transform="translate(-22.5,-22.5)"> <path d="M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z " style="stroke-linecap:butt;" class="chess-path-Bx"></path> <path d="M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z " style="stroke-linecap:butt;" class="chess-path-B"></path> <path d="M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14" style="stroke-linecap:butt;" class="chess-path-B"></path> <path d="M 34,14 L 31,17 L 14,17 L 11,14" style="stroke-linecap:butt;" class="chess-path-B"></path> <path d="M 31,17 L 31,29.5 L 14,29.5 L 14,17" style="stroke-linecap:butt;" class="chess-path-B"></path> <path d="M 31,29.5 L 32.5,32 L 12.5,32 L 14,29.5" class="chess-path-B"></path> <path d="M 11,14 L 34,14" class="chess-path-D"></path> </g></g> </g><g transform="translate(254.28571428571428,540) scale(1.2857142857142858,1.2857142857142858)"><g class="chessW" id="pred_d1_wQ" ><g transform="translate(-22.5,-22.5)"> <path d="M 9 13 A 2 2 0 1 1 5,13 A 2 2 0 1 1 9 13 z" transform="translate(-1,-1)" style="fill-rule: none;" class="chess-path-BW"></path> <path d="M 9 13 A 2 2 0 1 1 5,13 A 2 2 0 1 1 9 13 z" transform="translate(15.5,-5.5)" style="fill-rule: none;" class="chess-path-BW"></path> <path d="M 9 13 A 2 2 0 1 1 5,13 A 2 2 0 1 1 9 13 z" transform="translate(32,-1)" style="fill-rule: none;" class="chess-path-BW"></path> <path d="M 9 13 A 2 2 0 1 1 5,13 A 2 2 0 1 1 9 13 z" transform="translate(7,-4.5)" style="fill-rule: none;" class="chess-path-BW"></path> <path d="M 9 13 A 2 2 0 1 1 5,13 A 2 2 0 1 1 9 13 z" transform="translate(24,-4)" style="fill-rule: none;" class="chess-path-BW"></path> <path d="M 9,26 C 17.5,24.5 30,24.5 36,26 L 38,14 L 31,25 L 31,11 L 25.5,24.5 L 22.5,9.5 L 19.5,24.5 L 14,10.5 L 14,25 L 7,14 L 9,26 z " style="stroke-linecap:butt;" class="chess-path-BW"></path> <path d="M 9,26 C 9,28 10.5,28 11.5,30 C 12.5,31.5 12.5,31 12,33.5... [truncated message content] |
From: <luk...@us...> - 2011-03-10 18:14:31
|
Revision: 1349 http://toss.svn.sourceforge.net/toss/?rev=1349&view=rev Author: lukaszkaiser Date: 2011-03-10 18:14:24 +0000 (Thu, 10 Mar 2011) Log Message: ----------- WebClient corrections, adding Connect4 and Pawn-Whopping. Modified Paths: -------------- trunk/Toss/GGP/GDL.ml trunk/Toss/Play/Play.ml trunk/Toss/Play/Play.mli trunk/Toss/Server/Server.ml trunk/Toss/WebClient/Connect.js trunk/Toss/WebClient/Handler.py trunk/Toss/WebClient/Login.js trunk/Toss/WebClient/Main.js trunk/Toss/WebClient/MakeDB.py trunk/Toss/WebClient/Style.css trunk/Toss/WebClient/Wrapper.py trunk/Toss/WebClient/index.html trunk/Toss/examples/Chess.toss Added Paths: ----------- trunk/Toss/examples/Pawn-Whopping.toss trunk/Toss/examples/Pawn-Whopping.tossstyle Removed Paths: ------------- trunk/Toss/examples/PawnWhopping.toss trunk/Toss/examples/PawnWhopping.tossstyle Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-03-08 11:15:20 UTC (rev 1348) +++ trunk/Toss/GGP/GDL.ml 2011-03-10 18:14:24 UTC (rev 1349) @@ -3578,7 +3578,7 @@ let initialize_game_pawn_whopping player game_descr startcl = let state = - state_of_file (!top_exec_path ^ "/examples/PawnWhopping.toss") in + state_of_file (!top_exec_path ^ "/examples/Pawn-Whopping.toss") in game_description := game_descr; let pterms = [|Const "X"; Const "O"|] in let noops = [|Some (Const "NOOP"); Some (Const "NOOP")|] in Modified: trunk/Toss/Play/Play.ml =================================================================== --- trunk/Toss/Play/Play.ml 2011-03-08 11:15:20 UTC (rev 1348) +++ trunk/Toss/Play/Play.ml 2011-03-10 18:14:24 UTC (rev 1349) @@ -5,7 +5,12 @@ let debug_level = ref 0 let set_debug_level i = debug_level := i +let timeout = ref 0. +let set_timeout t = timeout := Unix.time() +. t +let cancel_timeout () = timeout := 0. +let timed_out () = !timeout > 1. && Unix.time() > !timeout + (* ------------ MAXIMAX BY DEPTH ------------- *) let maxdepth_node dp player heurs children = @@ -42,8 +47,9 @@ (* Maximax unfolding upto depth. *) let rec unfold_maximax_upto ?(ab=false) count game heur t = - if count = 0 || Game.get_timeout () then ( - if !debug_level > 1 && Game.get_timeout () then print_endline "Timeout"; + if count = 0 || Game.get_timeout () || timed_out () then ( + if !debug_level > 1 && (Game.get_timeout() || timed_out()) then + print_endline "Timeout"; t ) else try Modified: trunk/Toss/Play/Play.mli =================================================================== --- trunk/Toss/Play/Play.mli 2011-03-08 11:15:20 UTC (rev 1348) +++ trunk/Toss/Play/Play.mli 2011-03-10 18:14:24 UTC (rev 1349) @@ -2,7 +2,10 @@ val set_debug_level : int -> unit +val set_timeout : float -> unit +val cancel_timeout : unit -> unit + (** ------------ MAXIMAX BY DEPTH ------------- *) (** Maximax by depth unfolding function. Throws Not_found if ready. *) Modified: trunk/Toss/Server/Server.ml =================================================================== --- trunk/Toss/Server/Server.ml 2011-03-08 11:15:20 UTC (rev 1348) +++ trunk/Toss/Server/Server.ml 2011-03-10 18:14:24 UTC (rev 1349) @@ -4,7 +4,7 @@ let set_debug_level i = debug_level := i; if i > 5 then Solver.set_debug_level 1; - if i > 0 then GameTree.set_debug_level 1; + if i > 0 then (GameTree.set_debug_level 1; Play.set_debug_level 1); Game.set_debug_level i; Heuristic.debug_level := i - 3 @@ -173,29 +173,29 @@ (loc, timer, effort, how, horizon, heuristic, advr)) -> ( Random.self_init (); - (* TODO: should be in idle time, not now *) - Gc.full_major (); - let heuristic = - match heuristic with None -> None - | Some heur -> - Some (Array.map ( - Arena.array_of_players (Formula.Const 0.0) - (fst !state).Arena.player_names) heur) in - let p, ps = - match !game_modified, !play, !play_state with - | false, Some play, Some play_state -> - play, play_state - | _ -> - let p, ps = Game.initialize_default - !state ~loc ~effort ~search_method:how - ?horizon ?heuristic ?advr () in - game_modified := false; - play := Some p; play_state := Some ps; - p, ps in ignore (Unix.alarm timer); + Play.set_timeout (float(timer)); if !no_gtree then + let heuristic = + match heuristic with None -> None + | Some heur -> + Some (Array.map ( + Arena.array_of_players (Formula.Const 0.0) + (fst !state).Arena.player_names) heur) in + let p, ps = + match !game_modified, !play, !play_state with + | false, Some play, Some play_state -> + play, play_state + | _ -> + let p, ps = Game.initialize_default + !state ~loc ~effort ~search_method:how + ?horizon ?heuristic ?advr () in + game_modified := false; + play := Some p; play_state := Some ps; + p, ps in let res = Game.suggest ~effort p ps in Game.cancel_timeout (); + Play.cancel_timeout (); match res with | Some (move, new_state) -> play_state := Some new_state; @@ -212,6 +212,7 @@ let (move, _) = Play.maximax_unfold_choose effort (fst !state) (snd !state) heur in Game.cancel_timeout (); + Play.cancel_timeout (); Move.move_gs_str !state move ) Modified: trunk/Toss/WebClient/Connect.js =================================================================== --- trunk/Toss/WebClient/Connect.js 2011-03-08 11:15:20 UTC (rev 1348) +++ trunk/Toss/WebClient/Connect.js 2011-03-10 18:14:24 UTC (rev 1349) @@ -26,8 +26,8 @@ var RELS_STR = "" var MOVES_STR = "" var PAYOFF_STR = "" +var PLAYER_STR = "" - // Helper function: sign of a number. function sign (x) { if (x > 0.01) { return (1); } @@ -38,7 +38,7 @@ function set_info (info) { var res_arr = []; res_arr = info.split("$"); - if (res_arr.length != 4) { return (false); } + if (res_arr.length != 5) { return (false); } DIM_STR = res_arr[0]; ELEM_STR = res_arr[1]; RELS_STR = res_arr[2]; @@ -49,6 +49,7 @@ MOVES_STR = ""; PAYOFF_STR = res_arr[3]; }; + PLAYER_STR = res_arr[4]; var dim = strip('(', ')', DIM_STR).split(','); MODEL_MAXX = parseFloat(strip(' ', ' ', dim[0])); MODEL_MINX = parseFloat(strip(' ', ' ', dim[1])); Modified: trunk/Toss/WebClient/Handler.py =================================================================== --- trunk/Toss/WebClient/Handler.py 2011-03-08 11:15:20 UTC (rev 1348) +++ trunk/Toss/WebClient/Handler.py 2011-03-10 18:14:24 UTC (rev 1349) @@ -106,18 +106,19 @@ fid = int(f[0]) return (fid + 1) -def new_play (db, client, game, p1, p2, move): +def new_play (db, client, game, p1, p2): res = get_all_from_db (db, "games", "game='" + game + "'") (_, toss) = res[0] client.open_from_str (toss) info = get_game_info (client) model = client.get_model () loc = client.get_cur_loc () + move_pl = int(client.get_loc_player (loc)) - 1 get_global_lock (db) pid = get_free_id (db) - db_cur_insert (db, game, p1, p2, pid, move, model, loc, info, "") + db_cur_insert (db, game, p1, p2, pid, move_pl, model, loc, info, "") release_global_lock (db) - return (str(pid) + "$" + info) + return (str(pid) + "$" + info + "$" + str(move_pl)) def game_select_s (g, p1, p2, pid, m): return("game='" + g + "' and player1='" + p1 + "' and player2='" + p2 + @@ -126,8 +127,8 @@ def open_db (db, game, p1, p2, pid, move): select_s = game_select_s (game, p1, p2, pid, move) res = get_all_from_db (db, "cur_states", select_s) - (_, _, _, _, _, _, _, info, _) = res[0] - return (info) + (_, _, _, _, move, _, _, info, _) = res[0] + return (info + "$" + str(move)) def db_escape (s): return (s.replace("'", "''")) @@ -141,16 +142,16 @@ client.open_from_str (game_toss + "\n MODEL " + old_toss) client.set_cur_loc (old_loc) (move1, move2, move3) = move_tup - client.make_move (move1, move2, move3) + new_pl = int(client.make_move (move1, move2, move3)) - 1 new_toss = db_escape (client.get_model ()) new_info = get_game_info (client) new_info_db = db_escape (new_info) db.execute ("update cur_states set toss='" + new_toss + "' where " + sel_s) db.execute ("update cur_states set info='"+ new_info_db +"' where "+ sel_s) db.execute ("update cur_states set loc='"+ str(move3) +"' where "+ sel_s) - db.execute ("update cur_states set move=" + str(int(m)+1) +" where "+ sel_s) + db.execute ("update cur_states set move=" + str(new_pl) +" where "+ sel_s) db_old_insert (db, g, p1, p2, pid, m, old_toss, old_loc, old_info, old_svg) - return (new_info) + return (new_info + "$" + str(new_pl)) def upd_svg (db, g, p1, p2, pid, m, svg_s): select_s = game_select_s (g, p1, p2, pid, m) @@ -253,17 +254,17 @@ (_, game_toss) = game_res[0] client.open_from_str (game_toss + "\n MODEL " + toss) client.set_cur_loc (loc) - depth = client.get_data ("depth") - if depth == "none": depth = 2 - adv_ratio = client.get_data ("adv_ratio") - if adv_ratio == "none": adv_ratio = 2 - return (client.suggest (int(depth) + offset, adv_ratio)) + #depth = client.get_data ("depth") + #if depth == "none": depth = 2 + #adv_ratio = client.get_data ("adv_ratio") + #if adv_ratio == "none": adv_ratio = 2 + return (client.suggest (offset)) def suggest (db, client, g, p1, p2, pid, m): - return (suggest_offset (0, db, client, g, p1, p2, pid, m)) + return (suggest_offset (5, db, client, g, p1, p2, pid, m)) def suggestx (db, client, g, p1, p2, pid, m): - return (suggest_offset (1, db, client, g, p1, p2, pid, m)) + return (suggest_offset (10, db, client, g, p1, p2, pid, m)) def handler(req): req.content_type = "text/plain" Modified: trunk/Toss/WebClient/Login.js =================================================================== --- trunk/Toss/WebClient/Login.js 2011-03-08 11:15:20 UTC (rev 1348) +++ trunk/Toss/WebClient/Login.js 2011-03-10 18:14:24 UTC (rev 1349) @@ -25,9 +25,11 @@ list_plays_string ("Breakthrough", udata[2]); list_plays_string ("Checkers", udata[3]); list_plays_string ("Chess", udata[4]); - list_plays_string ("Entanglement", udata[5]); - list_plays_string ("Gomoku", udata[6]); - list_plays_string ("Tic-Tac-Toe", udata[7]); + list_plays_string ("Connect4", udata[5]); + list_plays_string ("Entanglement", udata[6]); + list_plays_string ("Gomoku", udata[7]); + list_plays_string ("Pawn-Whopping", udata[8]); + list_plays_string ("Tic-Tac-Toe", udata[9]); get_opponents (); } Modified: trunk/Toss/WebClient/Main.js =================================================================== --- trunk/Toss/WebClient/Main.js 2011-03-08 11:15:20 UTC (rev 1348) +++ trunk/Toss/WebClient/Main.js 2011-03-10 18:14:24 UTC (rev 1349) @@ -216,7 +216,7 @@ // Apply current move. function make_move () { if (CUR_MOVE == "") return; - var m = PLAYS[CUR_PLAY_I][3] % 2; + var m = PLAYS[CUR_PLAY_I][3]; if (PLAYS[CUR_PLAY_I][m] != UNAME && PLAYS[CUR_PLAY_I][m] != "computer") { alert ("It is your Opponent's turn"); return; @@ -227,17 +227,17 @@ CUR_MOVE = ""; CUR_ELEMS = []; ELEM_COUNTERS = {}; + PLAYS[CUR_PLAY_I][3] = PLAYER_STR; document.getElementById("cur-player").innerHTML = - disp_name(PLAYS[CUR_PLAY_I][(m + 1) % 2]); + disp_name(PLAYS[CUR_PLAY_I][PLAYER_STR]); document.getElementById("working").style.display = "none"; full_redraw (); - PLAYS[CUR_PLAY_I][3] = parseInt(PLAYS[CUR_PLAY_I][3]) + 1; async_srv ("UPD_SVG", play_py_id(CUR_PLAY_I) + ", " + svg_string()); var old_li = document.getElementById ("plays-list-" + GAME_NAME + "-elem-" + CUR_PLAY_I); var li = new_play_item (GAME_NAME, CUR_PLAY_I); old_li.parentNode.replaceChild (li, old_li); - if (PLAYS[CUR_PLAY_I][(m + 1) % 2] == "computer") { + if (PLAYS[CUR_PLAY_I][PLAYER_STR] == "computer") { var m = suggest_move_better (); if (m != "") { make_move (); } } @@ -281,7 +281,9 @@ for (var i = 0; i < FRIENDS.length; i++) { var oi = opponent_item (FRIENDS[i], i+1); if (i > MAX_OPNT_LEN - 2) { oi.style.display = "none"; } - o.appendChild (oi); + if (GAME_NAME != 'Chess' || FRIENDS[i] != 'computer') { + o.appendChild (oi); + } } document.getElementById("opponents").style.display = "block"; } @@ -343,7 +345,7 @@ document.getElementById("plays-list-" + GAME_NAME).style.display = "block"; document.getElementById("working").style.display = "block"; info_nbr = srv ("NEW_PLAY", "c, '" + GAME_NAME + "', '" + UNAME + - "', '" + opp_uid + "', 0"); + "', '" + opp_uid + "'"); document.getElementById("working").style.display = "none"; info_idx = info_nbr.indexOf('$'); FREE_PLAY_NO = parseInt(info_nbr.substring(0, info_idx)); Modified: trunk/Toss/WebClient/MakeDB.py =================================================================== --- trunk/Toss/WebClient/MakeDB.py 2011-03-08 11:15:20 UTC (rev 1348) +++ trunk/Toss/WebClient/MakeDB.py 2011-03-10 18:14:24 UTC (rev 1349) @@ -11,8 +11,8 @@ GAMES_PATH = "../examples" -GAMES = ["Breakthrough", "Checkers", "Chess", "Entanglement", - "Gomoku", "Tic-Tac-Toe"] +GAMES = ["Breakthrough", "Checkers", "Chess", "Connect4", "Entanglement", + "Gomoku", "Pawn-Whopping", "Tic-Tac-Toe"] def create_db (db_file, games_path, games): Modified: trunk/Toss/WebClient/Style.css =================================================================== --- trunk/Toss/WebClient/Style.css 2011-03-08 11:15:20 UTC (rev 1348) +++ trunk/Toss/WebClient/Style.css 2011-03-10 18:14:24 UTC (rev 1349) @@ -638,13 +638,15 @@ stroke-width: 3px; } -.Game-Chess .model-elem-0, .Game-Checkers .model-elem-0 { +.Game-Chess .model-elem-0, .Game-Checkers .model-elem-0, + .Game-Pawn-Whopping .model-elem-0 { fill: #d18b47; stroke: #260314; stroke-width: 3px; } -.Game-Chess .model-elem-1, .Game-Checkers .model-elem-1 { +.Game-Chess .model-elem-1, .Game-Checkers .model-elem-1, + .Game-Pawn-Whopping .model-elem-1 { fill: #ffe4aa; /* #ffce9e; */ stroke: #260314; stroke-width: 3px; Modified: trunk/Toss/WebClient/Wrapper.py =================================================================== --- trunk/Toss/WebClient/Wrapper.py 2011-03-08 11:15:20 UTC (rev 1348) +++ trunk/Toss/WebClient/Wrapper.py 2011-03-10 18:14:24 UTC (rev 1349) @@ -193,10 +193,15 @@ moves.append ((m, r, endp)) return ("; ".join([str(m) for m in moves])) + def get_loc_player (self, i): + """Get player for the i-th location.""" + m = self.msg ("GET LOC PLAYER " + (str (i))) + return (m) + def make_move (self, m, r, endp): self.apply_rule (r, m, 1.0, []) self.set_cur_loc (endp) - return ("move ok") + return (self.get_loc_player(endp)) def get_data (self, did): m = self.msg ("GET DATA " + did) @@ -213,12 +218,11 @@ t = [s.strip() for s in m.split('/')] return ((float(t[0]), float(t[1]))) - def suggest (self, depth, adv_ratio): + def suggest (self, timeout): loc = self.get_cur_loc () (ts, t) = self.get_time () - m = self.msg ("EVAL LOC MOVES " + str(adv_ratio) + ".0 " + - str(loc) +" TIMEOUT 1200 "+ str(depth) + - " alpha_beta_ord") + m = self.msg ("EVAL LOC MOVES 4.0 " + str(loc) + + " TIMEOUT "+ str(timeout) + " 55500 alpha_beta_ord") self.set_time (ts, t) msg = [s.strip() for s in m.split(';')] if len(msg) < 2: return ("") Modified: trunk/Toss/WebClient/index.html =================================================================== --- trunk/Toss/WebClient/index.html 2011-03-08 11:15:20 UTC (rev 1348) +++ trunk/Toss/WebClient/index.html 2011-03-10 18:14:24 UTC (rev 1349) @@ -130,6 +130,14 @@ <li style="display: none;"/> </ul> <p class="game-par"> + <button onclick="new_play('Connect4')" + class="boldobt">Connect4</button> + (<a href="http://en.wikipedia.org/wiki/Connect4">info</a>) + </p> + <ul class="plays-list" id="plays-list-Connect4"> + <li style="display: none;"/> + </ul> + <p class="game-par"> <button onclick="new_play('Entanglement')" class="boldobt">Entanglement</button> (<a href="http://en.wikipedia.org/wiki/Entanglement_(graph_measure)" @@ -147,6 +155,14 @@ <li style="display: none;"/> </ul> <p class="game-par"> + <button onclick="new_play('Pawn-Whopping')" + class="boldobt">Pawn-Whopping</button> + (<a href="http://en.wikipedia.org/wiki/Pawn-Whopping">info</a>) + </p> + <ul class="plays-list" id="plays-list-Pawn-Whopping"> + <li style="display: none;"/> + </ul> + <p class="game-par"> <button onclick="new_play('Tic-Tac-Toe')" class="boldobt">Tic-Tac-Toe</button> (<a href="http://en.wikipedia.org/wiki/Tic-tac-toe">info</a>) Modified: trunk/Toss/examples/Chess.toss =================================================================== --- trunk/Toss/examples/Chess.toss 2011-03-08 11:15:20 UTC (rev 1348) +++ trunk/Toss/examples/Chess.toss 2011-03-10 18:14:24 UTC (rev 1349) @@ -94,33 +94,14 @@ bP " emb w, b pre IsSeventh(a3) post not CheckB() -RULE WhitePawnRight: +RULE WhitePawnBeat: + [ a, b | wP { a }; b { b } | - ] + -> + [ a, b | wP { b } | - ] + emb w, b pre ex z (C(a, z) and (R(z, b) or R(b, z))) post not CheckW() +RULE WhitePawnBeatRDbl: [ | | ] " ... - ?..b - ... - wP ?.. -" -> [ | | ] " - ... - ?..wP - ... - . ?.. -" emb w, b post not CheckW() -RULE WhitePawnLeft: - [ | | ] " - ... - b..? - ... - ? wP. -" -> [ | | ] " - ... - wP.? - ... - ? ... -" emb w, b post not CheckW() -RULE WhitePawnRightDbl: - [ | | ] " - ... ?..-bP ... ? ... @@ -134,7 +115,7 @@ ... .... " emb w, b post not CheckW() -RULE WhitePawnLeftDbl: +RULE WhitePawnBeatLDbl: [ | | ] " ... -bP? @@ -150,33 +131,14 @@ ... .... " emb w, b post not CheckW() -RULE BlackPawnRight: +RULE BlackPawnBeat: + [ a, b | bP { a }; w { b } | - ] + -> + [ a, b | bP { b } | - ] + emb w, b pre ex z (C(z, a) and (R(z, b) or R(b, z))) post not CheckB() +RULE BlackPawnBeatRDbl: [ | | ] " ... - bP.? - ... - ? w.. -" -> [ | | ] " - ... - ...? - ... - ? bP. -" emb w, b post not CheckB() -RULE BlackPawnLeft: - [ | | ] " - ... - ?..bP - ... - w ?.. -" -> [ | | ] " - ... - ?... - ... - bP ?.. -" emb w, b post not CheckB() -RULE BlackPawnRightDbl: - [ | | ] " - ... bP.wP ... ? ... @@ -190,7 +152,7 @@ ... ?... " emb w, b post not CheckB() -RULE BlackPawnLeftDbl: +RULE BlackPawnBeatLDbl: [ | | ] " ... wP.bP @@ -341,10 +303,9 @@ MOVES [WhitePawnMove -> 1]; [WhitePawnMoveDbl -> 1]; - [WhitePawnLeft -> 1]; - [WhitePawnLeftDbl -> 1]; - [WhitePawnRight -> 1]; - [WhitePawnRightDbl -> 1]; + [WhitePawnBeat -> 1]; + [WhitePawnBeatLDbl -> 1]; + [WhitePawnBeatRDbl -> 1]; [WhitePawnPromote -> 1]; [WhiteKnight -> 1]; [WhiteBishop -> 1]; @@ -365,10 +326,9 @@ MOVES [BlackPawnMove -> 0]; [BlackPawnMoveDbl -> 0]; - [BlackPawnLeft -> 0]; - [BlackPawnLeftDbl -> 0]; - [BlackPawnRight -> 0]; - [BlackPawnRightDbl -> 0]; + [BlackPawnBeat -> 0]; + [BlackPawnBeatLDbl -> 0]; + [BlackPawnBeatRDbl -> 0]; [BlackPawnPromote -> 0]; [BlackKnight -> 0]; [BlackBishop -> 0]; @@ -389,10 +349,9 @@ MOVES [WhitePawnMove -> 3]; [WhitePawnMoveDbl -> 3]; - [WhitePawnLeft -> 3]; - [WhitePawnLeftDbl -> 3]; - [WhitePawnRight -> 3]; - [WhitePawnRightDbl -> 3]; + [WhitePawnBeat -> 3]; + [WhitePawnBeatLDbl -> 3]; + [WhitePawnBeatRDbl -> 3]; [WhitePawnPromote -> 3]; [WhiteKnight -> 3]; [WhiteBishop -> 3]; @@ -412,10 +371,9 @@ MOVES [BlackPawnMove -> 2]; [BlackPawnMoveDbl -> 2]; - [BlackPawnLeft -> 2]; - [BlackPawnLeftDbl -> 2]; - [BlackPawnRight -> 2]; - [BlackPawnRightDbl -> 2]; + [BlackPawnBeat -> 2]; + [BlackPawnBeatLDbl -> 2]; + [BlackPawnBeatRDbl -> 2]; [BlackPawnPromote -> 2]; [BlackKnight -> 2]; [BlackBishop -> 2]; @@ -436,10 +394,9 @@ MOVES [WhitePawnMove -> 5]; [WhitePawnMoveDbl -> 5]; - [WhitePawnLeft -> 5]; - [WhitePawnLeftDbl -> 5]; - [WhitePawnRight -> 5]; - [WhitePawnRightDbl -> 5]; + [WhitePawnBeat -> 5]; + [WhitePawnBeatLDbl -> 5]; + [WhitePawnBeatRDbl -> 5]; [WhitePawnPromote -> 5]; [WhiteKnight -> 5]; [WhiteBishop -> 5]; @@ -459,10 +416,9 @@ MOVES [BlackPawnMove -> 4]; [BlackPawnMoveDbl -> 4]; - [BlackPawnLeft -> 4]; - [BlackPawnLeftDbl -> 4]; - [BlackPawnRight -> 4]; - [BlackPawnRightDbl -> 4]; + [BlackPawnBeat -> 4]; + [BlackPawnBeatLDbl -> 4]; + [BlackPawnBeatRDbl -> 4]; [BlackPawnPromote -> 4]; [BlackKnight -> 4]; [BlackBishop -> 4]; @@ -483,10 +439,9 @@ MOVES [WhitePawnMove -> 7]; [WhitePawnMoveDbl -> 7]; - [WhitePawnLeft -> 7]; - [WhitePawnLeftDbl -> 7]; - [WhitePawnRight -> 7]; - [WhitePawnRightDbl -> 7]; + [WhitePawnBeat -> 7]; + [WhitePawnBeatLDbl -> 7]; + [WhitePawnBeatRDbl -> 7]; [WhitePawnPromote -> 7]; [WhiteKnight -> 7]; [WhiteBishop -> 7]; @@ -505,10 +460,9 @@ MOVES [BlackPawnMove -> 6]; [BlackPawnMoveDbl -> 6]; - [BlackPawnLeft -> 6]; - [BlackPawnLeftDbl -> 6]; - [BlackPawnRight -> 6]; - [BlackPawnRightDbl -> 6]; + [BlackPawnBeat -> 6]; + [BlackPawnBeatLDbl -> 6]; + [BlackPawnBeatRDbl -> 6]; [BlackPawnPromote -> 6]; [BlackKnight -> 6]; [BlackBishop -> 6]; @@ -529,10 +483,9 @@ MOVES [WhitePawnMove -> 9]; [WhitePawnMoveDbl -> 9]; - [WhitePawnLeft -> 9]; - [WhitePawnLeftDbl -> 9]; - [WhitePawnRight -> 9]; - [WhitePawnRightDbl -> 9]; + [WhitePawnBeat -> 9]; + [WhitePawnBeatLDbl -> 9]; + [WhitePawnBeatRDbl -> 9]; [WhitePawnPromote -> 9]; [WhiteKnight -> 9]; [WhiteBishop -> 9]; @@ -553,10 +506,9 @@ MOVES [BlackPawnMove -> 8]; [BlackPawnMoveDbl -> 8]; - [BlackPawnLeft -> 8]; - [BlackPawnLeftDbl -> 8]; - [BlackPawnRight -> 8]; - [BlackPawnRightDbl -> 8]; + [BlackPawnBeat -> 8]; + [BlackPawnBeatLDbl -> 8]; + [BlackPawnBeatRDbl -> 8]; [BlackPawnPromote -> 8]; [BlackKnight -> 8]; [BlackBishop -> 8]; @@ -576,10 +528,9 @@ MOVES [WhitePawnMove -> 11]; [WhitePawnMoveDbl -> 11]; - [WhitePawnLeft -> 11]; - [WhitePawnLeftDbl -> 11]; - [WhitePawnRight -> 11]; - [WhitePawnRightDbl -> 11]; + [WhitePawnBeat -> 11]; + [WhitePawnBeatLDbl -> 11]; + [WhitePawnBeatRDbl -> 11]; [WhitePawnPromote -> 11]; [WhiteKnight -> 11]; [WhiteBishop -> 11]; @@ -599,10 +550,9 @@ MOVES [BlackPawnMove -> 10]; [BlackPawnMoveDbl -> 10]; - [BlackPawnLeft -> 10]; - [BlackPawnLeftDbl -> 10]; - [BlackPawnRight -> 10]; - [BlackPawnRightDbl -> 10]; + [BlackPawnBeat -> 10]; + [BlackPawnBeatLDbl -> 10]; + [BlackPawnBeatRDbl -> 10]; [BlackPawnPromote -> 10]; [BlackKnight -> 10]; [BlackBishop -> 10]; @@ -622,10 +572,9 @@ MOVES [WhitePawnMove -> 13]; [WhitePawnMoveDbl -> 13]; - [WhitePawnLeft -> 13]; - [WhitePawnLeftDbl -> 13]; - [WhitePawnRight -> 13]; - [WhitePawnRightDbl -> 13]; + [WhitePawnBeat -> 13]; + [WhitePawnBeatLDbl -> 13]; + [WhitePawnBeatRDbl -> 13]; [WhitePawnPromote -> 13]; [WhiteKnight -> 13]; [WhiteBishop -> 13]; @@ -645,10 +594,9 @@ MOVES [BlackPawnMove -> 12]; [BlackPawnMoveDbl -> 12]; - [BlackPawnLeft -> 12]; - [BlackPawnLeftDbl -> 12]; - [BlackPawnRight -> 12]; - [BlackPawnRightDbl -> 12]; + [BlackPawnBeat -> 12]; + [BlackPawnBeatLDbl -> 12]; + [BlackPawnBeatRDbl -> 12]; [BlackPawnPromote -> 12]; [BlackKnight -> 12]; [BlackBishop -> 12]; @@ -668,10 +616,9 @@ MOVES [WhitePawnMove -> 15]; [WhitePawnMoveDbl -> 15]; - [WhitePawnLeft -> 15]; - [WhitePawnLeftDbl -> 15]; - [WhitePawnRight -> 15]; - [WhitePawnRightDbl -> 15]; + [WhitePawnBeat -> 15]; + [WhitePawnBeatLDbl -> 15]; + [WhitePawnBeatRDbl -> 15]; [WhitePawnPromote -> 15]; [WhiteKnight -> 15]; [WhiteBishop -> 15]; @@ -690,10 +637,9 @@ MOVES [BlackPawnMove -> 14]; [BlackPawnMoveDbl -> 14]; - [BlackPawnLeft -> 14]; - [BlackPawnLeftDbl -> 14]; - [BlackPawnRight -> 14]; - [BlackPawnRightDbl -> 14]; + [BlackPawnBeat -> 14]; + [BlackPawnBeatLDbl -> 14]; + [BlackPawnBeatRDbl -> 14]; [BlackPawnPromote -> 14]; [BlackKnight -> 14]; [BlackBishop -> 14]; @@ -713,10 +659,9 @@ MOVES [WhitePawnMove -> 17]; [WhitePawnMoveDbl -> 17]; - [WhitePawnLeft -> 17]; - [WhitePawnLeftDbl -> 17]; - [WhitePawnRight -> 17]; - [WhitePawnRightDbl -> 17]; + [WhitePawnBeat -> 17]; + [WhitePawnBeatLDbl -> 17]; + [WhitePawnBeatRDbl -> 17]; [WhitePawnPromote -> 17]; [WhiteKnight -> 17]; [WhiteBishop -> 17]; @@ -737,10 +682,9 @@ MOVES [BlackPawnMove -> 16]; [BlackPawnMoveDbl -> 16]; - [BlackPawnLeft -> 16]; - [BlackPawnLeftDbl -> 16]; - [BlackPawnRight -> 16]; - [BlackPawnRightDbl -> 16]; + [BlackPawnBeat -> 16]; + [BlackPawnBeatLDbl -> 16]; + [BlackPawnBeatRDbl -> 16]; [BlackPawnPromote -> 16]; [BlackKnight -> 16]; [BlackBishop -> 16]; @@ -760,10 +704,9 @@ MOVES [WhitePawnMove -> 19]; [WhitePawnMoveDbl -> 19]; - [WhitePawnLeft -> 19]; - [WhitePawnLeftDbl -> 19]; - [WhitePawnRight -> 19]; - [WhitePawnRightDbl -> 19]; + [WhitePawnBeat -> 19]; + [WhitePawnBeatLDbl -> 19]; + [WhitePawnBeatRDbl -> 19]; [WhitePawnPromote -> 19]; [WhiteKnight -> 19]; [WhiteBishop -> 19]; @@ -783,10 +726,9 @@ MOVES [BlackPawnMove -> 18]; [BlackPawnMoveDbl -> 18]; - [BlackPawnLeft -> 18]; - [BlackPawnLeftDbl -> 18]; - [BlackPawnRight -> 18]; - [BlackPawnRightDbl -> 18]; + [BlackPawnBeat -> 18]; + [BlackPawnBeatLDbl -> 18]; + [BlackPawnBeatRDbl -> 18]; [BlackPawnPromote -> 18]; [BlackKnight -> 18]; [BlackBishop -> 18]; @@ -806,10 +748,9 @@ MOVES [WhitePawnMove -> 21]; [WhitePawnMoveDbl -> 21]; - [WhitePawnLeft -> 21]; - [WhitePawnLeftDbl -> 21]; - [WhitePawnRight -> 21]; - [WhitePawnRightDbl -> 21]; + [WhitePawnBeat -> 21]; + [WhitePawnBeatLDbl -> 21]; + [WhitePawnBeatRDbl -> 21]; [WhitePawnPromote -> 21]; [WhiteKnight -> 21]; [WhiteBishop -> 21]; @@ -829,10 +770,9 @@ MOVES [BlackPawnMove -> 20]; [BlackPawnMoveDbl -> 20]; - [BlackPawnLeft -> 20]; - [BlackPawnLeftDbl -> 20]; - [BlackPawnRight -> 20]; - [BlackPawnRightDbl -> 20]; + [BlackPawnBeat -> 20]; + [BlackPawnBeatLDbl -> 20]; + [BlackPawnBeatRDbl -> 20]; [BlackPawnPromote -> 20]; [BlackKnight -> 20]; [BlackBishop -> 20]; @@ -852,10 +792,9 @@ MOVES [WhitePawnMove -> 23]; [WhitePawnMoveDbl -> 23]; - [WhitePawnLeft -> 23]; - [WhitePawnLeftDbl -> 23]; - [WhitePawnRight -> 23]; - [WhitePawnRightDbl -> 23]; + [WhitePawnBeat -> 23]; + [WhitePawnBeatLDbl -> 23]; + [WhitePawnBeatRDbl -> 23]; [WhitePawnPromote -> 23]; [WhiteKnight -> 23]; [WhiteBishop -> 23]; @@ -874,10 +813,9 @@ MOVES [BlackPawnMove -> 22]; [BlackPawnMoveDbl -> 22]; - [BlackPawnLeft -> 22]; - [BlackPawnLeftDbl -> 22]; - [BlackPawnRight -> 22]; - [BlackPawnRightDbl -> 22]; + [BlackPawnBeat -> 22]; + [BlackPawnBeatLDbl -> 22]; + [BlackPawnBeatRDbl -> 22]; [BlackPawnPromote -> 22]; [BlackKnight -> 22]; [BlackBishop -> 22]; @@ -897,10 +835,9 @@ MOVES [WhitePawnMove -> 25]; [WhitePawnMoveDbl -> 25]; - [WhitePawnLeft -> 25]; - [WhitePawnLeftDbl -> 25]; - [WhitePawnRight -> 25]; - [WhitePawnRightDbl -> 25]; + [WhitePawnBeat -> 25]; + [WhitePawnBeatLDbl -> 25]; + [WhitePawnBeatRDbl -> 25]; [WhitePawnPromote -> 25]; [WhiteKnight -> 25]; [WhiteBishop -> 25]; @@ -921,10 +858,9 @@ MOVES [BlackPawnMove -> 24]; [BlackPawnMoveDbl -> 24]; - [BlackPawnLeft -> 24]; - [BlackPawnLeftDbl -> 24]; - [BlackPawnRight -> 24]; - [BlackPawnRightDbl -> 24]; + [BlackPawnBeat -> 24]; + [BlackPawnBeatLDbl -> 24]; + [BlackPawnBeatRDbl -> 24]; [BlackPawnPromote -> 24]; [BlackKnight -> 24]; [BlackBishop -> 24]; @@ -943,10 +879,9 @@ MOVES [WhitePawnMove -> 27]; [WhitePawnMoveDbl -> 27]; - [WhitePawnLeft -> 27]; - [WhitePawnLeftDbl -> 27]; - [WhitePawnRight -> 27]; - [WhitePawnRightDbl -> 27]; + [WhitePawnBeat -> 27]; + [WhitePawnBeatLDbl -> 27]; + [WhitePawnBeatRDbl -> 27]; [WhitePawnPromote -> 27]; [WhiteKnight -> 27]; [WhiteBishop -> 27]; @@ -966,10 +901,9 @@ MOVES [BlackPawnMove -> 26]; [BlackPawnMoveDbl -> 26]; - [BlackPawnLeft -> 26]; - [BlackPawnLeftDbl -> 26]; - [BlackPawnRight -> 26]; - [BlackPawnRightDbl -> 26]; + [BlackPawnBeat -> 26]; + [BlackPawnBeatLDbl -> 26]; + [BlackPawnBeatRDbl -> 26]; [BlackPawnPromote -> 26]; [BlackKnight -> 26]; [BlackBishop -> 26]; @@ -988,10 +922,9 @@ MOVES [WhitePawnMove -> 29]; [WhitePawnMoveDbl -> 29]; - [WhitePawnLeft -> 29]; - [WhitePawnLeftDbl -> 29]; - [WhitePawnRight -> 29]; - [WhitePawnRightDbl -> 29]; + [WhitePawnBeat -> 29]; + [WhitePawnBeatLDbl -> 29]; + [WhitePawnBeatRDbl -> 29]; [WhitePawnPromote -> 29]; [WhiteKnight -> 29]; [WhiteBishop -> 29]; @@ -1011,10 +944,9 @@ MOVES [BlackPawnMove -> 28]; [BlackPawnMoveDbl -> 28]; - [BlackPawnLeft -> 28]; - [BlackPawnLeftDbl -> 28]; - [BlackPawnRight -> 28]; - [BlackPawnRightDbl -> 28]; + [BlackPawnBeat -> 28]; + [BlackPawnBeatLDbl -> 28]; + [BlackPawnBeatRDbl -> 28]; [BlackPawnPromote -> 28]; [BlackKnight -> 28]; [BlackBishop -> 28]; @@ -1033,10 +965,9 @@ MOVES [WhitePawnMove -> 31]; [WhitePawnMoveDbl -> 31]; - [WhitePawnLeft -> 31]; - [WhitePawnLeftDbl -> 31]; - [WhitePawnRight -> 31]; - [WhitePawnRightDbl -> 31]; + [WhitePawnBeat -> 31]; + [WhitePawnBeatLDbl -> 31]; + [WhitePawnBeatRDbl -> 31]; [WhitePawnPromote -> 31]; [WhiteKnight -> 31]; [WhiteBishop -> 31]; @@ -1055,10 +986,9 @@ MOVES [BlackPawnMove -> 30]; [BlackPawnMoveDbl -> 30]; - [BlackPawnLeft -> 30]; - [BlackPawnLeftDbl -> 30]; - [BlackPawnRight -> 30]; - [BlackPawnRightDbl -> 30]; + [BlackPawnBeat -> 30]; + [BlackPawnBeatLDbl -> 30]; + [BlackPawnBeatRDbl -> 30]; [BlackPawnPromote -> 30]; [BlackKnight -> 30]; [BlackBishop -> 30]; Copied: trunk/Toss/examples/Pawn-Whopping.toss (from rev 1348, trunk/Toss/examples/PawnWhopping.toss) =================================================================== --- trunk/Toss/examples/Pawn-Whopping.toss (rev 0) +++ trunk/Toss/examples/Pawn-Whopping.toss 2011-03-10 18:14:24 UTC (rev 1349) @@ -0,0 +1,170 @@ +PLAYERS 1, 2 +DATA depth: 4, adv_ratio: 2 +REL DiagW (x, y) = ex z (C(x, z) and (R(y, z) or R(z, y))) +REL DiagB (x, y) = ex z (C(z, x) and (R(y, z) or R(z, y))) +REL IsFirst(x) = not ex z C(z, x) +REL IsSecond(x) = ex y (C(y, x) and IsFirst(y)) +REL IsEight(x) = not ex z C(x, z) +REL IsSeventh(x) = ex y (C(x, y) and IsEight(y)) +REL WhiteEnds() = (ex x (wP(x) and not ex y C(x, y))) or (not ex z bP(z)) +REL BlackEnds() = (ex x (bP(x) and not ex y C(y, x))) or (not ex z wP(z)) +RULE WhiteDiag: + [ a, b | wP { a }; bP { b } | - ] -> [ a, b | wP { b } | - ] emb wP, bP + pre DiagW(a, b) and not BlackEnds() +RULE WhiteStraight: + [ | bP:1 {}; R:2 {} | ] " + + . + + wP +" -> [ | bP:1 {}; R:2 {} | ] " + + wP + + . +" emb wP, bP pre not BlackEnds() +RULE WhiteStraightTwo: + [ | bP:1 {}; R:2 {} | ] " + + . + + . + + wP +" -> [ | bP:1 {}; R:2 {} | ] " + + wP + + . + + . +" emb wP, bP pre IsSecond(a1) and not BlackEnds() +RULE WhitePawnRightDbl: + [ | | ] " + ... + ?..-bP + ... + ? ... + ... + wP.bP +" -> [ | | ] " + ... + ?... + ... + ? wP. + ... + .... +" emb wP, bP pre not BlackEnds() +RULE WhitePawnLeftDbl: + [ | | ] " + ... + -bP? + ... + . ?.. + ... + bP.wP +" -> [ | | ] " + ... + ...? + ... + wP ?.. + ... + .... +" emb wP, bP pre not BlackEnds() +RULE BlackDiag: + [ a, b | bP { a }; wP { b } | - ] -> [ a, b | bP { b } | - ] emb wP, bP + pre DiagB(a, b) and not WhiteEnds() +RULE BlackStraight: + [ | R:2 {}; wP:1 {} | ] " + + bP + + . +" -> [ | R:2 {}; wP:1 {} | ] " + + . + + bP +" emb wP, bP pre not WhiteEnds() +RULE BlackStraightTwo: + [ | R:2 {}; wP:1 {} | ] " + + bP + + . + + . +" -> [ | R:2 {}; wP:1 {} | ] " + + . + + . + + bP +" emb wP, bP pre IsSeventh(a3) and not WhiteEnds() +RULE BlackPawnRightDbl: + [ | | ] " + ... + bP.wP + ... + ? ... + ... + ?..-wP +" -> [ | | ] " + ... + .... + ... + ? bP. + ... + ?... +" emb wP, bP pre not WhiteEnds() +RULE BlackPawnLeftDbl: + [ | | ] " + ... + wP.bP + ... + . ?.. + ... + -wP? +" -> [ | | ] " + ... + .... + ... + bP ?.. + ... + ...? +" emb wP, bP pre not WhiteEnds() +LOC 0 { + PLAYER 1 + PAYOFF { + 1: :(WhiteEnds()) - :(BlackEnds()); + 2: :(BlackEnds()) - :(WhiteEnds()) + } + MOVES [WhiteDiag -> 1]; [WhiteStraight -> 1]; [WhiteStraightTwo -> 1] +} +LOC 1 { + PLAYER 2 + PAYOFF { + 1: :(WhiteEnds()) - :(BlackEnds()); + 2: :(BlackEnds()) - :(WhiteEnds()) + } + MOVES [BlackDiag -> 0]; [BlackStraight -> 0]; [BlackStraightTwo -> 0] +} +MODEL [ | | ] " + ... ... ... ... + ... ... ... ... + ... ... ... ... + bP.bP bP.bP bP.bP bP.bP + ... ... ... ... + ... ... ... ... + ... ... ... ... + ... ... ... ... + ... ... ... ... + ... ... ... ... + ... ... ... ... + ... ... ... ... + ... ... ... ... + wP wP.wP wP.wP wP.wP wP. + ... ... ... ... + ... ... ... ... +" Copied: trunk/Toss/examples/Pawn-Whopping.tossstyle (from rev 1348, trunk/Toss/examples/PawnWhopping.tossstyle) =================================================================== --- trunk/Toss/examples/Pawn-Whopping.tossstyle (rev 0) +++ trunk/Toss/examples/Pawn-Whopping.tossstyle 2011-03-10 18:14:24 UTC (rev 1349) @@ -0,0 +1,6 @@ +nocolor ; +elOPACITY: 20 ; +relOPACITY: 150 ; +arrLENscale: 0.0 ; +wP: ~/pawn_white.svg; +bP: ~/pawn_black.svg; Deleted: trunk/Toss/examples/PawnWhopping.toss =================================================================== --- trunk/Toss/examples/PawnWhopping.toss 2011-03-08 11:15:20 UTC (rev 1348) +++ trunk/Toss/examples/PawnWhopping.toss 2011-03-10 18:14:24 UTC (rev 1349) @@ -1,170 +0,0 @@ -PLAYERS 1, 2 -DATA depth: 4, adv_ratio: 2 -REL DiagW (x, y) = ex z (C(x, z) and (R(y, z) or R(z, y))) -REL DiagB (x, y) = ex z (C(z, x) and (R(y, z) or R(z, y))) -REL IsFirst(x) = not ex z C(z, x) -REL IsSecond(x) = ex y (C(y, x) and IsFirst(y)) -REL IsEight(x) = not ex z C(x, z) -REL IsSeventh(x) = ex y (C(x, y) and IsEight(y)) -REL WhiteEnds() = (ex x (W(x) and not ex y C(x, y))) or (not ex z B(z)) -REL BlackEnds() = (ex x (B(x) and not ex y C(y, x))) or (not ex z W(z)) -RULE WhiteDiag: - [ a, b | W { a }; B { b } | - ] -> [ a, b | W { b } | - ] emb W, B - pre DiagW(a, b) and not BlackEnds() -RULE WhiteStraight: - [ | B:1 {}; R:2 {} | ] " - - . - - W -" -> [ | B:1 {}; R:2 {} | ] " - - W - - . -" emb W, B pre not BlackEnds() -RULE WhiteStraightTwo: - [ | B:1 {}; R:2 {} | ] " - - . - - . - - W -" -> [ | B:1 {}; R:2 {} | ] " - - W - - . - - . -" emb W, B pre IsSecond(a1) and not BlackEnds() -RULE WhitePawnRightDbl: - [ | | ] " - ... - ?..-B - ... - ? ... - ... - W..B -" -> [ | | ] " - ... - ?... - ... - ? W.. - ... - .... -" emb W, B pre not BlackEnds() -RULE WhitePawnLeftDbl: - [ | | ] " - ... - -B.? - ... - . ?.. - ... - B..W -" -> [ | | ] " - ... - ...? - ... - W ?.. - ... - .... -" emb W, B pre not BlackEnds() -RULE BlackDiag: - [ a, b | B { a }; W { b } | - ] -> [ a, b | B { b } | - ] emb W, B - pre DiagB(a, b) and not WhiteEnds() -RULE BlackStraight: - [ | R:2 {}; W:1 {} | ] " - - B - - . -" -> [ | R:2 {}; W:1 {} | ] " - - . - - B -" emb W, B pre not WhiteEnds() -RULE BlackStraightTwo: - [ | R:2 {}; W:1 {} | ] " - - B - - . - - . -" -> [ | R:2 {}; W:1 {} | ] " - - . - - . - - B -" emb W, B pre IsSeventh(a3) and not WhiteEnds() -RULE BlackPawnRightDbl: - [ | | ] " - ... - B..W - ... - ? ... - ... - ?..-W -" -> [ | | ] " - ... - .... - ... - ? B.. - ... - ?... -" emb W, B pre not WhiteEnds() -RULE BlackPawnLeftDbl: - [ | | ] " - ... - W..B - ... - . ?.. - ... - -W.? -" -> [ | | ] " - ... - .... - ... - B ?.. - ... - ...? -" emb W, B pre not WhiteEnds() -LOC 0 { - PLAYER 1 - PAYOFF { - 1: :(WhiteEnds()) - :(BlackEnds()); - 2: :(BlackEnds()) - :(WhiteEnds()) - } - MOVES [WhiteDiag -> 1]; [WhiteStraight -> 1]; [WhiteStraightTwo -> 1] -} -LOC 1 { - PLAYER 2 - PAYOFF { - 1: :(WhiteEnds()) - :(BlackEnds()); - 2: :(BlackEnds()) - :(WhiteEnds()) - } - MOVES [BlackDiag -> 0]; [BlackStraight -> 0]; [BlackStraightTwo -> 0] -} -MODEL [ | | ] " - ... ... ... ... - ... ... ... ... - ... ... ... ... - B..B B..B B..B B..B - ... ... ... ... - ... ... ... ... - ... ... ... ... - ... ... ... ... - ... ... ... ... - ... ... ... ... - ... ... ... ... - ... ... ... ... - ... ... ... ... - W W..W W..W W..W W.. - ... ... ... ... - ... ... ... ... -" Deleted: trunk/Toss/examples/PawnWhopping.tossstyle =================================================================== --- trunk/Toss/examples/PawnWhopping.tossstyle 2011-03-08 11:15:20 UTC (rev 1348) +++ trunk/Toss/examples/PawnWhopping.tossstyle 2011-03-10 18:14:24 UTC (rev 1349) @@ -1,6 +0,0 @@ -nocolor ; -elOPACITY: 20 ; -relOPACITY: 150 ; -arrLENscale: 0.0 ; -W: ~/pawn_white.svg; -B: ~/pawn_black.svg; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |