[Toss-devel-svn] SF.net SVN: toss:[1662] trunk/Toss
Status: Beta
Brought to you by:
lukaszkaiser
|
From: <luk...@us...> - 2012-02-04 01:07:16
|
Revision: 1662
http://toss.svn.sourceforge.net/toss/?rev=1662&view=rev
Author: lukaszkaiser
Date: 2012-02-04 01:07:09 +0000 (Sat, 04 Feb 2012)
Log Message:
-----------
Allow play history reference in rule preconditions, shorten chess definition.
Modified Paths:
--------------
trunk/Toss/Arena/Arena.ml
trunk/Toss/Arena/Arena.mli
trunk/Toss/Arena/ArenaParser.mly
trunk/Toss/Arena/ContinuousRule.ml
trunk/Toss/Arena/ContinuousRuleParser.mly
trunk/Toss/Arena/DiscreteRule.ml
trunk/Toss/Arena/DiscreteRule.mli
trunk/Toss/Arena/DiscreteRuleParser.mly
trunk/Toss/Arena/DiscreteRuleTest.ml
trunk/Toss/Formula/Lexer.mll
trunk/Toss/Formula/Tokens.mly
trunk/Toss/Makefile
trunk/Toss/Play/Move.ml
trunk/Toss/Server/ReqHandler.ml
trunk/Toss/examples/Chess.toss
Modified: trunk/Toss/Arena/Arena.ml
===================================================================
--- trunk/Toss/Arena/Arena.ml 2012-02-02 11:16:52 UTC (rev 1661)
+++ trunk/Toss/Arena/Arena.ml 2012-02-04 01:07:09 UTC (rev 1662)
@@ -374,6 +374,24 @@
let equational_def_style = ref true
+let fprint_game_move f ({mv_time = t; parameters = pl; rule = rn;
+ next_loc = l; matching = m}, rtime) =
+ let m_s = String.concat ", "
+ (List.map (fun (e, x) -> Printf.sprintf "%s: %i" e x) m) in
+ let rt = match rtime with None -> "" | Some f -> " " ^ (string_of_float f) in
+ if (pl = []) then
+ Format.fprintf f "@[<1>[%s@ %F@ ->@ %i@ emb@ %s]%s@]" rn t l m_s rt
+ else (
+ let p_s = String.concat ", "
+ (List.map (fun (p, v) -> Printf.sprintf "%s: %F" p v) pl) in
+ Format.fprintf f "@[<1>[%s@ %F,@ %s@ ->@ %i@ emb@ %s]%s@]" rn t p_s l m_s rt
+ )
+
+let sprint_game_move gm =
+ ignore (Format.flush_str_formatter ());
+ fprint_game_move Format.str_formatter gm;
+ Format.flush_str_formatter ()
+
let fprint_state_full print_compiled_rules ppf
({rules = rules;
graph = graph;
@@ -385,6 +403,7 @@
{struc = struc;
time = time;
cur_loc = cur_loc;
+ history = hist;
}) =
Format.fprintf ppf "@[<v>";
List.iter (fun (drel, (args, body)) ->
@@ -414,6 +433,9 @@
loc_id (fprint_loc_body struc player_names) loc) graph;
Format.fprintf ppf "@[<1>MODEL@ %a@]@ "
(Structure.fprint ~show_empty:true) struc;
+ if (hist <> []) then
+ Format.fprintf ppf "@[<1>MOVES@ %a@]@ "
+ (Aux.fprint_sep_list ";\n" fprint_game_move) hist;
if cur_loc <> 0 then
Format.fprintf ppf "@[<1>STATE LOC@ %d@]@ " cur_loc;
if time <> 0. then
@@ -637,10 +659,11 @@
| GetTime (* Get time step and time *)
| SetState of game * game_state (* Set the full state *)
| GetState (* Return the state *)
- | SetModel of Structure.structure (* Set the model *)
- | GetModel (* Return the current model*)
+ | GetModel (* Return model+history *)
+ | SetModel of Structure.structure * (move * float option) list (* Set above *)
+
(* --------------------------- REQUEST HANDLER ------------------------------ *)
(* Apply function [f] to named structure at location [loc] in [state].
@@ -942,7 +965,7 @@
{d with DiscreteRule.match_formula = pre}
| Some rule_src ->
DiscreteRule.compile_rule signat defs
- {rule_src with DiscreteRule.pre = pre} in
+ {rule_src with DiscreteRule.pre = (pre, []) } in
let nr = (* TODO: rename lhs_* relations to be consistent with ln *)
ContinuousRule.make_rule defs discr dyn upd ~inv ~post () in
(nr, "RULE COND SET") in
@@ -953,7 +976,7 @@
let pre =
match discr.DiscreteRule.struc_rule with
| None -> discr.DiscreteRule.match_formula
- | Some struc_r -> struc_r.DiscreteRule.pre in
+ | Some struc_r -> fst struc_r.DiscreteRule.pre in
let (inv, post)=(r.ContinuousRule.inv, r.ContinuousRule.post) in
(Formula.str pre)^"; "^ (Formula.str inv) ^"; "^ (Formula.str post) in
((state_game, state),
@@ -1042,9 +1065,18 @@
get_from_rule get_assoc r_name state_game "get rule assoc")
| GetRuleMatches (r_name) -> (
+ let check_history_pre r hist =
+ match r.ContinuousRule.discrete.DiscreteRule.struc_rule with
+ | None -> true
+ | Some sr ->
+ let prev_list = snd (sr.DiscreteRule.pre) in
+ let constraint_satisfied (rname, b) =
+ List.exists (fun (mv, _) -> mv.rule = rname) hist = b in
+ List.for_all constraint_satisfied prev_list in
try
let r = List.assoc r_name state_game.rules in
- let matches = ContinuousRule.matches_post struc r state.time in
+ let matches = if not (check_history_pre r state.history) then [] else
+ ContinuousRule.matches_post struc r state.time in
(* matches are from LHS to model *)
((state_game, state),
String.concat "; " (
@@ -1064,7 +1096,11 @@
(* we've moved to using element names in Term *)
f ^ ", " ^ e ^ ", " ^ (String.concat ", " (List.map ts tl)) in
let shifts_s = String.concat "; " (List.map val_str shifts) in
- ((state_game, {state with struc = new_struc; time = new_time}),
+ let newmv = { mv_time = t; parameters = p; rule = r_name;
+ matching = m; next_loc = -1 (*FIX*) } in
+ let h = (newmv, None) :: state.history in
+ ((state_game,
+ {state with struc = new_struc; time = new_time; history = h}),
shifts_s)
| None -> ((state_game, state),
"ERR applying "^r_name^", postcondition fails")
@@ -1100,8 +1136,12 @@
| SetState (g, s) ->
((g, s), "STATE SET")
| GetState -> ((state_game, state), state_str (state_game, state))
- | SetModel m -> ((state_game, { state with struc = m }), "MODEL SET")
- | GetModel -> ((state_game, state), Structure.sprint state.struc)
+ | GetModel ->
+ let h_str = if state.history = [] then "" else "\nMOVES\n" ^
+ (String.concat ";\n" (List.map sprint_game_move state.history)) in
+ ((state_game, state), (Structure.sprint state.struc) ^ h_str)
+ | SetModel (m, h) ->
+ ((state_game, { state with struc = m; history = h }), "MODEL SET")
let can_modify_game = function
Modified: trunk/Toss/Arena/Arena.mli
===================================================================
--- trunk/Toss/Arena/Arena.mli 2012-02-02 11:16:52 UTC (rev 1661)
+++ trunk/Toss/Arena/Arena.mli 2012-02-04 01:07:09 UTC (rev 1662)
@@ -232,8 +232,9 @@
| GetTime (** Get time step and time *)
| SetState of game * game_state (** Set the full state *)
| GetState (** Return the state *)
- | SetModel of Structure.structure (** Set the model *)
- | GetModel (** Return the model *)
+ | GetModel (** Return model+history *)
+ | SetModel of Structure.structure * (move * float option) list
+ (** Set the model+history *)
val handle_request :
Modified: trunk/Toss/Arena/ArenaParser.mly
===================================================================
--- trunk/Toss/Arena/ArenaParser.mly 2012-02-02 11:16:52 UTC (rev 1661)
+++ trunk/Toss/Arena/ArenaParser.mly 2012-02-04 01:07:09 UTC (rev 1662)
@@ -86,17 +86,21 @@
EQ body = formula_expr_err { (rel, args, body) }
game_move_timed:
- | OPENSQ RULE_SPEC? r = id_int COMMA? t = FLOAT COMMA?
+ | OPENSQ r = id_int t = FLOAT RARR l = INT EMB
+ emb = separated_list (COMMA, separated_pair (ID, COLON, INT)) CLOSESQ
+ { ({mv_time = t; parameters = []; rule = r; next_loc = l; matching = emb;},
+ None) }
+ | OPENSQ r = id_int t = FLOAT COMMA
p = separated_list (COMMA, separated_pair (ID, COLON, FLOAT))
- RARR LOC_MOD? l = INT EMB
+ RARR l = INT EMB
emb = separated_list (COMMA, separated_pair (ID, COLON, INT)) CLOSESQ
- f = FLOAT?
+ f = FLOAT
{ ({mv_time = t; parameters = p; rule = r; next_loc = l; matching = emb;},
- f) }
+ Some f) }
| OPENSQ error
- { Lexer.report_parsing_error $startpos $endpos
+ { Lexer.report_parsing_error $startpos $endpos
"Syntax error in timed game move definition."
- }
+ }
game_defs:
| RULE_SPEC rname = id_int COLON r = rule_expr
@@ -149,6 +153,8 @@
| program = nonempty_list (game_defs)
{ process_definition program }
+move_expr:
+ | ID { Arena.empty_move with rule = $1 }
struct_location:
| MODEL_SPEC { Struct }
@@ -162,10 +168,14 @@
| SET_CMD STATE_SPEC gs=game_state { let (g, s) = gs in SetState (g, s) }
| GET_CMD STATE_SPEC { GetState }
| GET_CMD MODEL_SPEC { GetModel }
- | SET_CMD MODEL_SPEC struct_expr { SetModel $3 }
+ | SET_CMD MODEL_SPEC model = struct_expr
+ h = option (preceded (MOVES, separated_list (SEMICOLON, game_move_timed)))
+ { SetModel (model, match h with None -> [] | Some l -> l) }
| SET_CMD MODEL_SPEC model = struct_expr WITH
defs = separated_list (SEMICOLON, rel_def_simple)
- { SetModel (Arena.add_def_rels model defs) }
+ h = option (preceded (MOVES, separated_list (SEMICOLON, game_move_timed)))
+ { SetModel (Arena.add_def_rels model defs,
+ match h with None -> [] | Some l -> l) }
| ADD_CMD ELEM_MOD struct_location
{ AddElem ($3) }
| ADD_CMD REL_MOD
Modified: trunk/Toss/Arena/ContinuousRule.ml
===================================================================
--- trunk/Toss/Arena/ContinuousRule.ml 2012-02-02 11:16:52 UTC (rev 1661)
+++ trunk/Toss/Arena/ContinuousRule.ml 2012-02-04 01:07:09 UTC (rev 1662)
@@ -214,9 +214,8 @@
let rewrite_single struc cur_time m r t params =
let (res_struc, _, _ as res_struc_n_shifts) =
rewrite_single_nocheck struc cur_time m r t params in
- if r.post = Formula.And [] ||
- Solver.M.check res_struc r.post
- then Some res_struc_n_shifts
+ if r.post = Formula.And [] || Solver.M.check res_struc r.post then
+ Some res_struc_n_shifts
else None
Modified: trunk/Toss/Arena/ContinuousRuleParser.mly
===================================================================
--- trunk/Toss/Arena/ContinuousRuleParser.mly 2012-02-02 11:16:52 UTC (rev 1661)
+++ trunk/Toss/Arena/ContinuousRuleParser.mly 2012-02-04 01:07:09 UTC (rev 1662)
@@ -14,12 +14,20 @@
%%
+constr_expr:
+ | ID { ($1, true) }
+ | NOT ID { ($2, false) }
+precond_expr:
+ | formula_expr { ($1, []) }
+ | f = formula_expr AND BEFORE
+ l = separated_list (COMMA, constr_expr) { (f, l) }
+
%public rule_expr:
| discr = discrete_rule_expr
dyn = loption (preceded (DYNAMICS, eq_sys))
upd = loption (preceded (UPDATE, expr_eq_sys))
- pre = option (preceded (PRE, formula_expr))
+ pre = option (preceded (PRE, precond_expr))
inv = option (preceded (INV, formula_expr))
post = option (preceded (POST, formula_expr))
{ fun signat defs rname ->
Modified: trunk/Toss/Arena/DiscreteRule.ml
===================================================================
--- trunk/Toss/Arena/DiscreteRule.ml 2012-02-02 11:16:52 UTC (rev 1661)
+++ trunk/Toss/Arena/DiscreteRule.ml 2012-02-04 01:07:09 UTC (rev 1662)
@@ -15,7 +15,7 @@
rhs_struc : Structure.structure; (* optional tuples in _opt_R-relations *)
emb_rels : string list; (* tau_e-relations, other tau_h *)
rule_s : (int * int) list; (* map of [rhs] elements to [lhs] elements *)
- pre : Formula.formula; (* Precondition for embedding *)
+ pre : Formula.formula * (string * bool) list; (* precondition *)
}
type var_tuples = string array list
@@ -237,16 +237,17 @@
let map_to_formulas f r =
+ let f1 (a, l) = (f a, l) in
{r with
struc_rule = Aux.map_option
- (fun discr -> {discr with pre = f discr.pre}) r.struc_rule;
+ (fun discr -> {discr with pre = f1 discr.pre}) r.struc_rule;
match_formula = f r.match_formula}
let fold_over_formulas f r acc =
let acc =
match r.struc_rule with
| None -> acc
- | Some r -> f r.pre acc in
+ | Some r -> f (fst r.pre) acc in
let acc =
f r.match_formula acc in
acc
@@ -917,7 +918,7 @@
lhs_neg_tups @
List.map (function [x;y] -> Not (Eq (`FO x, `FO y))
| _ -> assert false) lhs_alldif_tups @
- (FormulaOps.as_conjuncts rule_src.pre)
+ (FormulaOps.as_conjuncts (fst rule_src.pre))
) in
(* Substitute defined relations, expanding their special variants. *)
@@ -1037,7 +1038,7 @@
List.map fst add_elems @ Aux.list_diff lhs_vars del_elems in
let match_formula = match pre with
| None -> match_formula
- | Some pre -> Formula.And [match_formula; pre] in
+ | Some (pre, _) -> Formula.And [match_formula; pre] in
let rlmap =
if add_elems = [] && del_elems = []
then None
@@ -1226,7 +1227,7 @@
rhs_struc = rhs_struc;
emb_rels = emb_rels;
rule_s = List.map (fun (_,i) ->i,i) struc_elems;
- pre = precond;
+ pre = (precond, []);
}
@@ -1263,8 +1264,12 @@
let l_str = Structure.str r.lhs_struc in
let r_str = Structure.str r.rhs_struc in
let pre_str =
- if r.pre = Formula.And [] then ""
- else " pre " ^ (Formula.str r.pre) in
+ if (fst r.pre = Formula.And [] && snd r.pre = []) then "" else
+ let s = " pre " ^ (Formula.str (fst r.pre)) in
+ if snd r.pre = [] then s else
+ let before_str (name, b) = if b then name else "not " ^ name in
+ let before_s = String.concat ", " (List.map before_str (snd r.pre)) in
+ s ^ " and before " ^ before_s in
l_str ^ " -> " ^ r_str ^ emb_str ^ assoc_str ^ pre_str
let fprint_struc_rule f r =
@@ -1282,10 +1287,13 @@
Format.fprintf f "@ @[<1>with@ [@,@[<1>%a@]@,]@]"
(Aux.fprint_sep_list "," matched) r.rule_s;
Format.fprintf f "@]";
- if r.pre <> Formula.And [] then
- Format.fprintf f "@ @[<1>pre@ %a@]" Formula.fprint r.pre
+ if (fst r.pre <> Formula.And [] || snd r.pre <> []) then
+ Format.fprintf f "@ @[<1>pre@ %a@]" Formula.fprint (fst r.pre);
+ if (snd r.pre <> []) then
+ let before_str (name, b) = if b then name else "not " ^ name in
+ let before_s = String.concat ", " (List.map before_str (snd r.pre)) in
+ Format.fprintf f "@ @[<1>and before@ %s@]" before_s
-
let rel_tups_to_atoms rel_tups =
Aux.concat_map
(fun (rel, tups) ->
@@ -1477,8 +1485,15 @@
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 = Formula.flatten r1.pre in
- let pre2 = Formula.flatten r2.pre in
+ if snd r1.pre <> snd r2.pre then (
+ let before_str (name, b) = if b then name else "not " ^ name in
+ let before_s r = String.concat ", " (List.map before_str (snd r.pre)) in
+ raise (Diff_result (Printf.sprintf
+ "Rule preconditions BEFORE differ:\n%s\n =/=\n%s"
+ (before_s r1) (before_s r2)));
+ );
+ let pre1 = Formula.flatten (fst r1.pre) in
+ let pre2 = Formula.flatten (fst 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)));
Modified: trunk/Toss/Arena/DiscreteRule.mli
===================================================================
--- trunk/Toss/Arena/DiscreteRule.mli 2012-02-02 11:16:52 UTC (rev 1661)
+++ trunk/Toss/Arena/DiscreteRule.mli 2012-02-04 01:07:09 UTC (rev 1662)
@@ -19,7 +19,7 @@
rhs_struc : Structure.structure; (** optional tuples in _opt_R-relations *)
emb_rels : string list; (** tau_e-relations, other tau_h *)
rule_s : (int * int) list; (** map of [rhs] elements to [lhs] elems *)
- pre : Formula.formula; (** Precondition for embedding *)
+ pre : Formula.formula * (string * bool) list; (** precondition *)
}
type var_tuples = string array list
@@ -135,7 +135,7 @@
Formula.formula ->
(string list * (string * string list) list) option ->
((string * string option) list * (string * string list) list) option ->
- Formula.formula option -> rule
+ (Formula.formula * (string * bool) list) option -> rule
(** Relations that can explicitly change state by rewriting (i.e. not
as a result of erasure). (A "symmetric difference" of rule sides.) *)
Modified: trunk/Toss/Arena/DiscreteRuleParser.mly
===================================================================
--- trunk/Toss/Arena/DiscreteRuleParser.mly 2012-02-02 11:16:52 UTC (rev 1661)
+++ trunk/Toss/Arena/DiscreteRuleParser.mly 2012-02-04 01:07:09 UTC (rev 1662)
@@ -6,8 +6,8 @@
%start parse_discrete_rule
%type <(string * int) list ->
(string * (string list * Formula.formula)) list ->
- Formula.formula option -> DiscreteRule.rule>
- parse_discrete_rule discrete_rule_expr
+ (Formula.formula * (string * bool) list) option -> DiscreteRule.rule>
+ parse_discrete_rule discrete_rule_expr
%%
@@ -47,7 +47,7 @@
let base_struc = Structure.empty_with_signat signat in
let lhs = lhs base_struc and rhs = rhs base_struc in
let pre =
- match pre with None -> Formula.And [] | Some pre -> pre in
+ match pre with None -> (Formula.And [], []) | Some pre -> pre in
let struc_rule =
{ DiscreteRule.lhs_struc = lhs; rhs_struc = rhs;
emb_rels = emb_rels;
Modified: trunk/Toss/Arena/DiscreteRuleTest.ml
===================================================================
--- trunk/Toss/Arena/DiscreteRuleTest.ml 2012-02-02 11:16:52 UTC (rev 1661)
+++ trunk/Toss/Arena/DiscreteRuleTest.ml 2012-02-04 01:07:09 UTC (rev 1662)
@@ -132,7 +132,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = [];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -151,7 +151,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P";"Q"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -171,7 +171,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P";"Q"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -190,7 +190,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P";"R"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1; 2,2; 3,2]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -215,7 +215,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = [];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -234,7 +234,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P";"Q"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -254,7 +254,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P";"Q"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -273,7 +273,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P";"R"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1; 2,2; 3,2]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -298,7 +298,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = [];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -318,7 +318,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P";"Q"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1; 2,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -342,7 +342,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = [];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -361,7 +361,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P";"Q"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -385,7 +385,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = [];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -405,7 +405,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -430,7 +430,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = [];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -454,7 +454,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -474,7 +474,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["C"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1; 2,2]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -500,7 +500,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -520,7 +520,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = []; (* C is in $tau_h$ but loses e *)
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,2]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -540,7 +540,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["C"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -564,7 +564,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["R"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1; 2,2]} in
let embs = find_matchings model rule_obj in
assert_raises
@@ -589,7 +589,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P"];
- pre = formula_of_str "not C(a)";
+ pre = (formula_of_str "not C(a)", []);
rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
assert_raises
@@ -607,7 +607,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P"];
- pre = formula_of_str "not C(a)";
+ pre = (formula_of_str "not C(a)", []);
rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -630,7 +630,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["P"];
- pre = formula_of_str "not C(a)";
+ pre = (formula_of_str "not C(a)", []);
rule_s = [1,1]} in
let embs = find_matchings model rule_obj in
let emb = choose_match model rule_obj embs in
@@ -654,7 +654,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["O"; "D"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1]} in
assert_equal ~printer:(fun x->x) ~msg:"one not opt"
"not O(e)-> true"
@@ -668,7 +668,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["O"; "D"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1]} in
assert_equal ~printer:(fun x->x) ~msg:"del one not opt"
"O(e)-> not O(e)"
@@ -682,7 +682,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["O"; "D"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1]} in
assert_one_of ~msg:"match defined"
["P(e) or Q(e)-> O(e)"; "Q(e) or P(e)-> O(e)"]
@@ -696,7 +696,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["O"; "D"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1]} in
assert_one_of ~msg:"match defined 2"
["P(e) or Q(e)-> (O(e) and not P(e) and not Q(e))";
@@ -715,7 +715,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["O"; "D"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1]} in
assert_equal ~printer:(fun x->x) ~msg:"defrel: diffthan P Q"
"(not P(e) and not Q(e))-> true"
@@ -729,7 +729,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["O"; "D"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1]} in
assert_one_of ~msg:"del defrel"
["(O(e) and not P(e) and not Q(e) and (_del_P(e) or _del_Q(e)))-> (P(e) and not O(e))";
@@ -746,7 +746,7 @@
{lhs_struc = lhs_struc;
rhs_struc = rhs_struc;
emb_rels = ["O"; "D"];
- pre = Formula.And [];
+ pre = (Formula.And [], []);
rule_s = [1,1]} in
assert_equal ~printer:(fun x->x) ~msg:"diffthan override"
"(not O(e) and not P(e))-> (O(e) and not Q(e))"
Modified: trunk/Toss/Formula/Lexer.mll
===================================================================
--- trunk/Toss/Formula/Lexer.mll 2012-02-02 11:16:52 UTC (rev 1661)
+++ trunk/Toss/Formula/Lexer.mll 2012-02-04 01:07:09 UTC (rev 1662)
@@ -50,6 +50,7 @@
| WITH
| EMB
| PRE
+ | BEFORE
| INV
| POST
| UPDATE
@@ -191,6 +192,7 @@
| "with" { WITH }
| "emb" { EMB }
| "pre" { PRE }
+ | "before" { BEFORE }
| "inv" { INV }
| "post" { POST }
| "update" { UPDATE }
Modified: trunk/Toss/Formula/Tokens.mly
===================================================================
--- trunk/Toss/Formula/Tokens.mly 2012-02-02 11:16:52 UTC (rev 1661)
+++ trunk/Toss/Formula/Tokens.mly 2012-02-04 01:07:09 UTC (rev 1662)
@@ -8,8 +8,8 @@
%token LARR LDARR RARR RDARR LRARR LRDARR INTERV
%token OPENCUR CLOSECUR OPENSQ CLOSESQ OPEN CLOSE
%token IN_MOD AND OR XOR NOT EX ALL TC
-%token WITH EMB PRE INV POST UPDATE DYNAMICS TRUE FALSE ASSOC COND PAYOFF MOVES
-%token MATCH ADD_CMD DEL_CMD GET_CMD SET_CMD LET_CMD EVAL_CMD
+%token WITH EMB PRE BEFORE INV POST UPDATE DYNAMICS TRUE FALSE ASSOC COND PAYOFF
+%token MOVES MATCH ADD_CMD DEL_CMD GET_CMD SET_CMD LET_CMD EVAL_CMD
%token ELEM_MOD ELEMS_MOD REL_MOD RELS_MOD ALLOF_MOD SIG_MOD FUN_MOD DATA_MOD LOC_MOD TIMEOUT_MOD TIME_MOD PLAYER_MOD PLAYERS_MOD
%token MODEL_SPEC RULE_SPEC STATE_SPEC LEFT_SPEC RIGHT_SPEC CLASS LFP GFP EOF
Modified: trunk/Toss/Makefile
===================================================================
--- trunk/Toss/Makefile 2012-02-02 11:16:52 UTC (rev 1661)
+++ trunk/Toss/Makefile 2012-02-04 01:07:09 UTC (rev 1662)
@@ -45,8 +45,9 @@
OCB_LIB=-libs str,nums,unix,oUnit,sqlite3
OCB_LIBJS=-libs str,js_of_ocaml
OCB_PP=-pp "camlp4o -I /usr/local/lib/ocaml/3.12.0 ../caml_extensions/pa_let_try.cmo pa_macro.cmo js_of_ocaml/pa_js.cmo"
-OCB_PPJS=-pp "camlp4o -I /usr/local/lib/ocaml/3.12.0 ../caml_extensions/pa_let_try.cmo pa_macro.cmo -DJAVASCRIPT js_of_ocaml/pa_js.cmo"
-OCAMLBUILD=ocamlbuild -log build.log -j 8 -menhir ../menhir_conf $(OCB_PP) \
+OCB_PPJS=-pp "camlp4o -unsafe -I /usr/local/lib/ocaml/3.12.0 ../caml_extensions/pa_let_try.cmo pa_macro.cmo -DJAVASCRIPT js_of_ocaml/pa_js.cmo"
+OCAMLBUILD=ocamlbuild -log build.log -j 8 -menhir ../menhir_conf \
+ -ocamlopt "ocamlopt -inline 10" $(OCB_PP) \
$(OCB_LIB) $(OCB_CFLAG) $(OCB_LFLAG)
OCAMLBUILDJS=ocamlbuild -log build.log -j 8 -menhir ../menhir_conf $(OCB_PPJS) \
$(OCB_LIBJS) $(OCB_CFLAG) $(OCB_LFLAG)
Modified: trunk/Toss/Play/Move.ml
===================================================================
--- trunk/Toss/Play/Move.ml 2012-02-02 11:16:52 UTC (rev 1661)
+++ trunk/Toss/Play/Move.ml 2012-02-04 01:07:09 UTC (rev 1662)
@@ -80,20 +80,30 @@
) grid
) matchings))
+(* Check if the before-part of the precondition of the rule holds on history. *)
+let check_history_pre r hist =
+ match r.DiscreteRule.struc_rule with
+ | None -> true
+ | Some sr ->
+ let prev_list = snd (sr.DiscreteRule.pre) in
+ let constraint_satisfied (rname, b) =
+ List.exists (fun (mv, _) -> mv.Arena.rule = rname) hist = b in
+ List.for_all constraint_satisfied prev_list
-
let gen_models_list rules state time moves =
Aux.map_some (fun mv ->
let rule = List.assoc mv.Arena.rule rules in
- Aux.map_option
- (fun (model, time, _) -> (* ignoring shifts, i.e. animation steps *)
- (mv,
- {Arena.cur_loc = mv.Arena.next_loc;
- history = (mv, None) :: state.Arena.history;
- struc = model;
- time = time}))
- (ContinuousRule.rewrite_single state.Arena.struc time mv.Arena.matching
- rule mv.Arena.mv_time mv.Arena.parameters)) (Array.to_list moves)
+ if check_history_pre rule.ContinuousRule.discrete state.Arena.history then
+ Aux.map_option
+ (fun (model, time, _) -> (* ignoring shifts, i.e. animation steps *)
+ (mv,
+ {Arena.cur_loc = mv.Arena.next_loc;
+ history = (mv, None) :: state.Arena.history;
+ struc = model;
+ time = time}))
+ (ContinuousRule.rewrite_single state.Arena.struc time mv.Arena.matching
+ rule mv.Arena.mv_time mv.Arena.parameters)
+ else None) (Array.to_list moves)
let gen_models rules state time moves =
let res = gen_models_list rules state time moves in
Modified: trunk/Toss/Server/ReqHandler.ml
===================================================================
--- trunk/Toss/Server/ReqHandler.ml 2012-02-02 11:16:52 UTC (rev 1661)
+++ trunk/Toss/Server/ReqHandler.ml 2012-02-04 01:07:09 UTC (rev 1662)
@@ -221,8 +221,6 @@
client := new_st;
strip_ws res
-let client_get_state () = client_msg "GET STATE"
-
let client_get_model () = client_msg "GET MODEL"
let client_set_model model_s = ignore (client_msg ("SET MODEL " ^ model_s))
Modified: trunk/Toss/examples/Chess.toss
===================================================================
--- trunk/Toss/examples/Chess.toss 2012-02-02 11:16:52 UTC (rev 1661)
+++ trunk/Toss/examples/Chess.toss 2012-02-04 01:07:09 UTC (rev 1662)
@@ -299,7 +299,8 @@
" -> [ | | ] "
... ... ...
... wK.wR ...
-" emb w,b pre not(bBeats(c1) or bBeats(d1) or bBeats(e1)) post true
+" emb w,b pre not(bBeats(c1) or bBeats(d1) or bBeats(e1)) and before
+ not WhiteRookA1, not WhiteKing, not WhiteLeftCastle, not WhiteRightCastle
RULE WhiteRightCastle:
[ | | ] "
... ...
@@ -307,7 +308,8 @@
" -> [ | | ] "
... ...
...wR wK.
-" emb w,b pre not (bBeats(a1) or bBeats(b1) or bBeats(c1)) post true
+" emb w,b pre not (bBeats(a1) or bBeats(b1) or bBeats(c1)) and before
+ not WhiteRookH1, not WhiteKing, not WhiteLeftCastle, not WhiteRightCastle
RULE BlackLeftCastle:
[ | | ] "
... ... ...
@@ -315,7 +317,8 @@
" -> [ | | ] "
... ... ...
... bK.bR ...
-" emb w,b pre not(wBeats(c1) or wBeats(d1) or wBeats(e1)) post true
+" emb w,b pre not(wBeats(c1) or wBeats(d1) or wBeats(e1)) and before
+ not BlackRookA8, not BlackKing, not BlackLeftCastle, not BlackRightCastle
RULE BlackRightCastle:
[ | | ] "
... ...
@@ -323,8 +326,9 @@
" -> [ | | ] "
... ...
...bR bK.
-" emb w,b pre not (wBeats(a1) or wBeats(b1) or wBeats(c1)) post true
-LOC 0 { // both can castle
+" emb w,b pre not (wBeats(a1) or wBeats(b1) or wBeats(c1)) and before
+ not BlackRookH8, not BlackKing, not BlackLeftCastle, not BlackRightCastle
+LOC 0 {
PLAYER 1 {
COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
PAYOFF :(CheckB()) - :(CheckW())
@@ -339,19 +343,19 @@
[WhiteKnight -> 1];
[WhiteBishop -> 1];
[WhiteRook -> 1];
- [WhiteRookA1 -> 5];
- [WhiteRookH1 -> 3];
+ [WhiteRookA1 -> 1];
+ [WhiteRookH1 -> 1];
[WhiteQueen -> 1];
- [WhiteLeftCastle -> 7];
- [WhiteRightCastle -> 7];
- [WhiteKing -> 7]
+ [WhiteLeftCastle -> 1];
+ [WhiteRightCastle -> 1];
+ [WhiteKing -> 1]
}
PLAYER 2 {
COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
PAYOFF :(CheckW()) - :(CheckB())
}
}
-LOC 1 { // both can castle
+LOC 1 {
PLAYER 2 {
COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
PAYOFF :(CheckW()) - :(CheckB())
@@ -366,796 +370,18 @@
[BlackKnight -> 0];
[BlackBishop -> 0];
[BlackRook -> 0];
- [BlackRookA8 -> 16];
- [BlackRookH8 -> 8];
+ [BlackRookA8 -> 0];
+ [BlackRookH8 -> 0];
[BlackQueen -> 0];
- [BlackLeftCastle -> 24];
- [BlackRightCastle -> 24];
- [BlackKing -> 24]
+ [BlackLeftCastle -> 0];
+ [BlackRightCastle -> 0];
+ [BlackKing -> 0]
}
PLAYER 1 {
COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
PAYOFF :(CheckB()) - :(CheckW())
}
}
-LOC 2 { // w left, b can castle
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- MOVES
- [WhitePawnMove -> 3];
- [WhitePawnMoveDbl -> 3];
- [WhitePawnBeat -> 3];
- [WhitePawnBeatPromote -> 3];
- [WhitePawnBeatLDbl -> 3];
- [WhitePawnBeatRDbl -> 3];
- [WhitePawnPromote -> 3];
- [WhiteKnight -> 3];
- [WhiteBishop -> 3];
- [WhiteRook -> 3];
- [WhiteRookA1 -> 7];
- [WhiteRookH1 -> 3];
- [WhiteQueen -> 3];
- [WhiteLeftCastle -> 7];
- [WhiteKing -> 7]
- }
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- }
-}
-LOC 3 { // w left, b can castle
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- MOVES
- [BlackPawnMove -> 2];
- [BlackPawnMoveDbl -> 2];
- [BlackPawnBeat -> 2];
- [BlackPawnBeatPromote -> 2];
- [BlackPawnBeatLDbl -> 2];
- [BlackPawnBeatRDbl -> 2];
- [BlackPawnPromote -> 2];
- [BlackKnight -> 2];
- [BlackBishop -> 2];
- [BlackRook -> 2];
- [BlackRookA8 -> 18];
- [BlackRookH8 -> 10];
- [BlackQueen -> 2];
- [BlackLeftCastle -> 26];
- [BlackRightCastle -> 26];
- [BlackKing -> 26]
- }
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- }
-}
-LOC 4 { // w right, b can castle
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- MOVES
- [WhitePawnMove -> 5];
- [WhitePawnMoveDbl -> 5];
- [WhitePawnBeat -> 5];
- [WhitePawnBeatPromote -> 5];
- [WhitePawnBeatLDbl -> 5];
- [WhitePawnBeatRDbl -> 5];
- [WhitePawnPromote -> 5];
- [WhiteKnight -> 5];
- [WhiteBishop -> 5];
- [WhiteRook -> 5];
- [WhiteRookA1 -> 5];
- [WhiteRookH1 -> 7];
- [WhiteQueen -> 5];
- [WhiteRightCastle -> 7];
- [WhiteKing -> 7]
- }
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- }
-}
-LOC 5 { // w right, b can castle
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- MOVES
- [BlackPawnMove -> 4];
- [BlackPawnMoveDbl -> 4];
- [BlackPawnBeat -> 4];
- [BlackPawnBeatPromote -> 4];
- [BlackPawnBeatLDbl -> 4];
- [BlackPawnBeatRDbl -> 4];
- [BlackPawnPromote -> 4];
- [BlackKnight -> 4];
- [BlackBishop -> 4];
- [BlackRook -> 4];
- [BlackRookA8 -> 20];
- [BlackRookH8 -> 12];
- [BlackQueen -> 4];
- [BlackLeftCastle -> 28];
- [BlackRightCastle -> 28];
- [BlackKing -> 28]
- }
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- }
-}
-LOC 6 { // w no, b can castle
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- MOVES
- [WhitePawnMove -> 7];
- [WhitePawnMoveDbl -> 7];
- [WhitePawnBeat -> 7];
- [WhitePawnBeatPromote -> 7];
- [WhitePawnBeatLDbl -> 7];
- [WhitePawnBeatRDbl -> 7];
- [WhitePawnPromote -> 7];
- [WhiteKnight -> 7];
- [WhiteBishop -> 7];
- [WhiteRook -> 7];
- [WhiteRookA1 -> 7];
- [WhiteRookH1 -> 7];
- [WhiteQueen -> 7];
- [WhiteKing -> 7]
- }
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- }
-}
-LOC 7 { // w no, b can castle
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- MOVES
- [BlackPawnMove -> 6];
- [BlackPawnMoveDbl -> 6];
- [BlackPawnBeat -> 6];
- [BlackPawnBeatPromote -> 6];
- [BlackPawnBeatLDbl -> 6];
- [BlackPawnBeatRDbl -> 6];
- [BlackPawnPromote -> 6];
- [BlackKnight -> 6];
- [BlackBishop -> 6];
- [BlackRook -> 6];
- [BlackRookA8 -> 22];
- [BlackRookH8 -> 14];
- [BlackQueen -> 6];
- [BlackLeftCastle -> 30];
- [BlackRightCastle -> 30];
- [BlackKing -> 30]
- }
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- }
-}
-LOC 8 { // w can, b left castle
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- MOVES
- [WhitePawnMove -> 9];
- [WhitePawnMoveDbl -> 9];
- [WhitePawnBeat -> 9];
- [WhitePawnBeatPromote -> 9];
- [WhitePawnBeatLDbl -> 9];
- [WhitePawnBeatRDbl -> 9];
- [WhitePawnPromote -> 9];
- [WhiteKnight -> 9];
- [WhiteBishop -> 9];
- [WhiteRook -> 9];
- [WhiteRookA1 -> 13];
- [WhiteRookH1 -> 11];
- [WhiteQueen -> 9];
- [WhiteLeftCastle -> 15];
- [WhiteRightCastle -> 15];
- [WhiteKing -> 15]
- }
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- }
-}
-LOC 9 { // w can, b left castle
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- MOVES
- [BlackPawnMove -> 8];
- [BlackPawnMoveDbl -> 8];
- [BlackPawnBeat -> 8];
- [BlackPawnBeatPromote -> 8];
- [BlackPawnBeatLDbl -> 8];
- [BlackPawnBeatRDbl -> 8];
- [BlackPawnPromote -> 8];
- [BlackKnight -> 8];
- [BlackBishop -> 8];
- [BlackRook -> 8];
- [BlackRookA8 -> 24];
- [BlackRookH8 -> 8];
- [BlackQueen -> 8];
- [BlackLeftCastle -> 24];
- [BlackKing -> 24]
- }
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- }
-}
-LOC 10 { // w left, b left castle
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- MOVES
- [WhitePawnMove -> 11];
- [WhitePawnMoveDbl -> 11];
- [WhitePawnBeat -> 11];
- [WhitePawnBeatPromote -> 11];
- [WhitePawnBeatLDbl -> 11];
- [WhitePawnBeatRDbl -> 11];
- [WhitePawnPromote -> 11];
- [WhiteKnight -> 11];
- [WhiteBishop -> 11];
- [WhiteRook -> 11];
- [WhiteRookA1 -> 15];
- [WhiteRookH1 -> 11];
- [WhiteQueen -> 11];
- [WhiteLeftCastle -> 15];
- [WhiteKing -> 15]
- }
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- }
-}
-LOC 11 { // w left, b left castle
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- MOVES
- [BlackPawnMove -> 10];
- [BlackPawnMoveDbl -> 10];
- [BlackPawnBeat -> 10];
- [BlackPawnBeatPromote -> 10];
- [BlackPawnBeatLDbl -> 10];
- [BlackPawnBeatRDbl -> 10];
- [BlackPawnPromote -> 10];
- [BlackKnight -> 10];
- [BlackBishop -> 10];
- [BlackRook -> 10];
- [BlackRookA8 -> 26];
- [BlackRookH8 -> 10];
- [BlackQueen -> 10];
- [BlackLeftCastle -> 26];
- [BlackKing -> 26]
- }
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- }
-}
-LOC 12 { // w right, b left castle
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- MOVES
- [WhitePawnMove -> 13];
- [WhitePawnMoveDbl -> 13];
- [WhitePawnBeat -> 13];
- [WhitePawnBeatPromote -> 13];
- [WhitePawnBeatLDbl -> 13];
- [WhitePawnBeatRDbl -> 13];
- [WhitePawnPromote -> 13];
- [WhiteKnight -> 13];
- [WhiteBishop -> 13];
- [WhiteRook -> 13];
- [WhiteRookA1 -> 13];
- [WhiteRookH1 -> 15];
- [WhiteQueen -> 13];
- [WhiteRightCastle -> 15];
- [WhiteKing -> 15]
- }
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- }
-}
-LOC 13 { // w right, b left castle
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- MOVES
- [BlackPawnMove -> 12];
- [BlackPawnMoveDbl -> 12];
- [BlackPawnBeat -> 12];
- [BlackPawnBeatPromote -> 12];
- [BlackPawnBeatLDbl -> 12];
- [BlackPawnBeatRDbl -> 12];
- [BlackPawnPromote -> 12];
- [BlackKnight -> 12];
- [BlackBishop -> 12];
- [BlackRook -> 12];
- [BlackRookA8 -> 28];
- [BlackRookH8 -> 12];
- [BlackQueen -> 12];
- [BlackLeftCastle -> 28];
- [BlackKing -> 28]
- }
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- }
-}
-LOC 14 { // w no, b left castle
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- MOVES
- [WhitePawnMove -> 15];
- [WhitePawnMoveDbl -> 15];
- [WhitePawnBeat -> 15];
- [WhitePawnBeatPromote -> 15];
- [WhitePawnBeatLDbl -> 15];
- [WhitePawnBeatRDbl -> 15];
- [WhitePawnPromote -> 15];
- [WhiteKnight -> 15];
- [WhiteBishop -> 15];
- [WhiteRook -> 15];
- [WhiteRookA1 -> 15];
- [WhiteRookH1 -> 15];
- [WhiteQueen -> 15];
- [WhiteKing -> 15]
- }
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- }
-}
-LOC 15 { // w no, b left castle
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- MOVES
- [BlackPawnMove -> 14];
- [BlackPawnMoveDbl -> 14];
- [BlackPawnBeat -> 14];
- [BlackPawnBeatPromote -> 14];
- [BlackPawnBeatLDbl -> 14];
- [BlackPawnBeatRDbl -> 14];
- [BlackPawnPromote -> 14];
- [BlackKnight -> 14];
- [BlackBishop -> 14];
- [BlackRook -> 14];
- [BlackRookA8 -> 30];
- [BlackRookH8 -> 14];
- [BlackQueen -> 14];
- [BlackLeftCastle -> 30];
- [BlackKing -> 30]
- }
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- }
-}
-LOC 16 { // w can, b right castle
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- MOVES
- [WhitePawnMove -> 17];
- [WhitePawnMoveDbl -> 17];
- [WhitePawnBeat -> 17];
- [WhitePawnBeatPromote -> 17];
- [WhitePawnBeatLDbl -> 17];
- [WhitePawnBeatRDbl -> 17];
- [WhitePawnPromote -> 17];
- [WhiteKnight -> 17];
- [WhiteBishop -> 17];
- [WhiteRook -> 17];
- [WhiteRookA1 -> 21];
- [WhiteRookH1 -> 19];
- [WhiteQueen -> 17];
- [WhiteLeftCastle -> 23];
- [WhiteRightCastle -> 23];
- [WhiteKing -> 23]
- }
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- }
-}
-LOC 17 { // w can, b right castle
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- MOVES
- [BlackPawnMove -> 16];
- [BlackPawnMoveDbl -> 16];
- [BlackPawnBeat -> 16];
- [BlackPawnBeatPromote -> 16];
- [BlackPawnBeatLDbl -> 16];
- [BlackPawnBeatRDbl -> 16];
- [BlackPawnPromote -> 16];
- [BlackKnight -> 16];
- [BlackBishop -> 16];
- [BlackRook -> 16];
- [BlackRookA8 -> 16];
- [BlackRookH8 -> 24];
- [BlackQueen -> 16];
- [BlackRightCastle -> 24];
- [BlackKing -> 24]
- }
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- }
-}
-LOC 18 { // w left, b right castle
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- MOVES
- [WhitePawnMove -> 19];
- [WhitePawnMoveDbl -> 19];
- [WhitePawnBeat -> 19];
- [WhitePawnBeatPromote -> 19];
- [WhitePawnBeatLDbl -> 19];
- [WhitePawnBeatRDbl -> 19];
- [WhitePawnPromote -> 19];
- [WhiteKnight -> 19];
- [WhiteBishop -> 19];
- [WhiteRook -> 19];
- [WhiteRookA1 -> 23];
- [WhiteRookH1 -> 19];
- [WhiteQueen -> 19];
- [WhiteLeftCastle -> 23];
- [WhiteKing -> 23]
- }
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- }
-}
-LOC 19 { // w left, b right castle
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- MOVES
- [BlackPawnMove -> 18];
- [BlackPawnMoveDbl -> 18];
- [BlackPawnBeat -> 18];
- [BlackPawnBeatPromote -> 18];
- [BlackPawnBeatLDbl -> 18];
- [BlackPawnBeatRDbl -> 18];
- [BlackPawnPromote -> 18];
- [BlackKnight -> 18];
- [BlackBishop -> 18];
- [BlackRook -> 18];
- [BlackRookA8 -> 18];
- [BlackRookH8 -> 26];
- [BlackQueen -> 18];
- [BlackRightCastle -> 26];
- [BlackKing -> 26]
- }
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- }
-}
-LOC 20 { // w right, b right castle
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- MOVES
- [WhitePawnMove -> 21];
- [WhitePawnMoveDbl -> 21];
- [WhitePawnBeat -> 21];
- [WhitePawnBeatPromote -> 21];
- [WhitePawnBeatLDbl -> 21];
- [WhitePawnBeatRDbl -> 21];
- [WhitePawnPromote -> 21];
- [WhiteKnight -> 21];
- [WhiteBishop -> 21];
- [WhiteRook -> 21];
- [WhiteRookA1 -> 21];
- [WhiteRookH1 -> 23];
- [WhiteQueen -> 21];
- [WhiteRightCastle -> 23];
- [WhiteKing -> 23]
- }
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- }
-}
-LOC 21 { // w right, b right castle
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- MOVES
- [BlackPawnMove -> 20];
- [BlackPawnMoveDbl -> 20];
- [BlackPawnBeat -> 20];
- [BlackPawnBeatPromote -> 20];
- [BlackPawnBeatLDbl -> 20];
- [BlackPawnBeatRDbl -> 20];
- [BlackPawnPromote -> 20];
- [BlackKnight -> 20];
- [BlackBishop -> 20];
- [BlackRook -> 20];
- [BlackRookA8 -> 20];
- [BlackRookH8 -> 28];
- [BlackQueen -> 20];
- [BlackRightCastle -> 28];
- [BlackKing -> 28]
- }
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- }
-}
-LOC 22 { // w no, b right castle
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- MOVES
- [WhitePawnMove -> 23];
- [WhitePawnMoveDbl -> 23];
- [WhitePawnBeat -> 23];
- [WhitePawnBeatPromote -> 23];
- [WhitePawnBeatLDbl -> 23];
- [WhitePawnBeatRDbl -> 23];
- [WhitePawnPromote -> 23];
- [WhiteKnight -> 23];
- [WhiteBishop -> 23];
- [WhiteRook -> 23];
- [WhiteRookA1 -> 23];
- [WhiteRookH1 -> 23];
- [WhiteQueen -> 23];
- [WhiteKing -> 23]
- }
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- }
-}
-LOC 23 { // w no, b right castle
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- MOVES
- [BlackPawnMove -> 22];
- [BlackPawnMoveDbl -> 22];
- [BlackPawnBeat -> 22];
- [BlackPawnBeatPromote -> 22];
- [BlackPawnBeatLDbl -> 22];
- [BlackPawnBeatRDbl -> 22];
- [BlackPawnPromote -> 22];
- [BlackKnight -> 22];
- [BlackBishop -> 22];
- [BlackRook -> 22];
- [BlackRookA8 -> 22];
- [BlackRookH8 -> 30];
- [BlackQueen -> 22];
- [BlackRightCastle -> 30];
- [BlackKing -> 30]
- }
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- }
-}
-LOC 24 { // w can, b no castle
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- MOVES
- [WhitePawnMove -> 25];
- [WhitePawnMoveDbl -> 25];
- [WhitePawnBeat -> 25];
- [WhitePawnBeatPromote -> 25];
- [WhitePawnBeatLDbl -> 25];
- [WhitePawnBeatRDbl -> 25];
- [WhitePawnPromote -> 25];
- [WhiteKnight -> 25];
- [WhiteBishop -> 25];
- [WhiteRook -> 25];
- [WhiteRookA1 -> 29];
- [WhiteRookH1 -> 27];
- [WhiteQueen -> 25];
- [WhiteLeftCastle -> 31];
- [WhiteRightCastle -> 31];
- [WhiteKing -> 31]
- }
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- }
-}
-LOC 25 { // w can, b no castle
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- MOVES
- [BlackPawnMove -> 24];
- [BlackPawnMoveDbl -> 24];
- [BlackPawnBeat -> 24];
- [BlackPawnBeatPromote -> 24];
- [BlackPawnBeatLDbl -> 24];
- [BlackPawnBeatRDbl -> 24];
- [BlackPawnPromote -> 24];
- [BlackKnight -> 24];
- [BlackBishop -> 24];
- [BlackRook -> 24];
- [BlackRookA8 -> 24];
- [BlackRookH8 -> 24];
- [BlackQueen -> 24];
- [BlackKing -> 24]
- }
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- }
-}
-LOC 26 { // w left, b no castle
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- MOVES
- [WhitePawnMove -> 27];
- [WhitePawnMoveDbl -> 27];
- [WhitePawnBeat -> 27];
- [WhitePawnBeatPromote -> 27];
- [WhitePawnBeatLDbl -> 27];
- [WhitePawnBeatRDbl -> 27];
- [WhitePawnPromote -> 27];
- [WhiteKnight -> 27];
- [WhiteBishop -> 27];
- [WhiteRook -> 27];
- [WhiteRookA1 -> 31];
- [WhiteRookH1 -> 27];
- [WhiteQueen -> 27];
- [WhiteLeftCastle -> 31];
- [WhiteKing -> 31]
- }
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- }
-}
-LOC 27 { // w left, b no castle
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- MOVES
- [BlackPawnMove -> 26];
- [BlackPawnMoveDbl -> 26];
- [BlackPawnBeat -> 26];
- [BlackPawnBeatPromote -> 26];
- [BlackPawnBeatLDbl -> 26];
- [BlackPawnBeatRDbl -> 26];
- [BlackPawnPromote -> 26];
- [BlackKnight -> 26];
- [BlackBishop -> 26];
- [BlackRook -> 26];
- [BlackRookA8 -> 26];
- [BlackRookH8 -> 26];
- [BlackQueen -> 26];
- [BlackKing -> 26]
- }
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- }
-}
-LOC 28 { // w right, b no castle
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- MOVES
- [WhitePawnMove -> 29];
- [WhitePawnMoveDbl -> 29];
- [WhitePawnBeat -> 29];
- [WhitePawnBeatPromote -> 29];
- [WhitePawnBeatLDbl -> 29];
- [WhitePawnBeatRDbl -> 29];
- [WhitePawnPromote -> 29];
- [WhiteKnight -> 29];
- [WhiteBishop -> 29];
- [WhiteRook -> 29];
- [WhiteRookA1 -> 29];
- [WhiteRookH1 -> 31];
- [WhiteQueen -> 29];
- [WhiteRightCastle -> 31];
- [WhiteKing -> 31]
- }
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- }
-}
-LOC 29 { // w right, b no castle
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- MOVES
- [BlackPawnMove -> 28];
- [BlackPawnMoveDbl -> 28];
- [BlackPawnBeat -> 28];
- [BlackPawnBeatPromote -> 28];
- [BlackPawnBeatLDbl -> 28];
- [BlackPawnBeatRDbl -> 28];
- [BlackPawnPromote -> 28];
- [BlackKnight -> 28];
- [BlackBishop -> 28];
- [BlackRook -> 28];
- [BlackRookA8 -> 28];
- [BlackRookH8 -> 28];
- [BlackQueen -> 28];
- [BlackKing -> 28]
- }
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- }
-}
-LOC 30 { // w no, b no castle
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- MOVES
- [WhitePawnMove -> 31];
- [WhitePawnMoveDbl -> 31];
- [WhitePawnBeat -> 31];
- [WhitePawnBeatPromote -> 31];
- [WhitePawnBeatLDbl -> 31];
- [WhitePawnBeatRDbl -> 31];
- [WhitePawnPromote -> 31];
- [WhiteKnight -> 31];
- [WhiteBishop -> 31];
- [WhiteRook -> 31];
- [WhiteRookA1 -> 31];
- [WhiteRookH1 -> 31];
- [WhiteQueen -> 31];
- [WhiteKing -> 31]
- }
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- }
-}
-LOC 31 { // w no, b no castle
- PLAYER 2 {
- COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05
- PAYOFF :(CheckW()) - :(CheckB())
- MOVES
- [BlackPawnMove -> 30];
- [BlackPawnMoveDbl -> 30];
- [BlackPawnBeat -> 30];
- [BlackPawnBeatPromote -> 30];
- [BlackPawnBeatLDbl -> 30];
- [BlackPawnBeatRDbl -> 30];
- [BlackPawnPromote -> 30];
- [BlackKnight -> 30];
- [BlackBishop -> 30];
- [BlackRook -> 30];
- [BlackRookA8 -> 30];
- [BlackRookH8 -> 30];
- [BlackQueen -> 30];
- [BlackKing -> 30]
- }
- PLAYER 1 {
- COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05
- PAYOFF :(CheckB()) - :(CheckW())
- }
-}
MODEL [ | | ] "
... ... ... ...
bR bN.bB bQ.bK bB.bN bR.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|