[Toss-devel-svn] SF.net SVN: toss:[1691] trunk/Toss
Status: Beta
Brought to you by:
lukaszkaiser
|
From: <luk...@us...> - 2012-03-12 00:27:30
|
Revision: 1691
http://toss.svn.sourceforge.net/toss/?rev=1691&view=rev
Author: lukaszkaiser
Date: 2012-03-12 00:27:22 +0000 (Mon, 12 Mar 2012)
Log Message:
-----------
Both current and starting structure parsing, many small corrections.
Modified Paths:
--------------
trunk/Toss/Arena/Arena.ml
trunk/Toss/Arena/Arena.mli
trunk/Toss/Arena/ArenaParser.mly
trunk/Toss/Arena/ArenaTest.ml
trunk/Toss/Client/JsHandler.ml
trunk/Toss/Client/Main.js
trunk/Toss/Client/Play.js
trunk/Toss/Client/State.js
trunk/Toss/Client/Style.css
trunk/Toss/Client/index.html
trunk/Toss/Formula/Lexer.mll
trunk/Toss/Formula/Tokens.mly
trunk/Toss/GGP/TranslateGame.ml
trunk/Toss/GGP/TranslateGame.mli
trunk/Toss/GGP/TranslateGameTest.ml
trunk/Toss/Learn/LearnGameTest.ml
trunk/Toss/Play/GameTree.ml
trunk/Toss/Play/GameTreeTest.ml
trunk/Toss/Play/Play.ml
trunk/Toss/Play/PlayTest.ml
trunk/Toss/Server/Server.ml
trunk/Toss/www/codebasics.xml
trunk/Toss/www/create.xml
trunk/Toss/www/ideas.xml
trunk/Toss/www/navigation.xml
trunk/Toss/www/ocaml.xml
trunk/Toss/www/play.xml
trunk/Toss/www/xsl/common.xsl
Modified: trunk/Toss/Arena/Arena.ml
===================================================================
--- trunk/Toss/Arena/Arena.ml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Arena/Arena.ml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -47,7 +47,7 @@
parameters : (string * float) list ;
rule : string ;
next_loc : int ;
- matching : (string * int) list ;
+ matching : (string * string) list ;
}
(* State of the game and additional information. *)
@@ -101,7 +101,7 @@
let move_str (lb, i) = Printf.sprintf "[%s -> %i]" (label_str lb) i
let pmv_str (pl, lb, i) = Printf.sprintf "[%s,%s -> %i]" pl (label_str lb) i
-let fprint_loc_body_in struc pnames f player {payoff = in_p; moves = in_m} =
+let fprint_loc_body_in pnames f player {payoff = in_p; moves = in_m} =
Format.fprintf f "@ @[<0>PLAYER@ %s@ {@ %a}@]@," (Aux.rev_assoc pnames player)
(fun f (payoff, moves) ->
Format.fprintf f "@[<1>PAYOFF@ @[<1>%a@]@]@ "
@@ -120,20 +120,16 @@
Format.fprintf f "@ ->@ %d@]@,]" target)) moves
) (in_p, in_m)
-let fprint_loc_body struc pnames f loc =
- Array.iteri (fun p l -> fprint_loc_body_in struc pnames f p l) loc
+let fprint_loc_body pnames f loc =
+ Array.iteri (fun p l -> fprint_loc_body_in pnames f p l) loc
let equational_def_style = ref true
-let fprint_game_move ?(as_ints=false) struc f
+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) ->
- if as_ints then
- Printf.sprintf "%s: %i" e x
- else
- Printf.sprintf "%s: %s" e (Structure.elem_str struc x))
+ (List.map (fun (e, x) -> Printf.sprintf "%s: %s" e x)
(List.sort Pervasives.compare m)) in
let rt = match rtime with None -> "" | Some f -> " " ^ (string_of_float f) in
if (pl = []) then
@@ -144,9 +140,8 @@
Format.fprintf f "@[<1>[%s@ %F,@ %s@ ->@ %i@ emb@ %s]%s@]" rn t p_s l m_s rt
)
-let sprint_game_move st gm = AuxIO.sprint_of_fprint (fprint_game_move st) gm
-let game_move_str st gm = sprint_game_move st (gm, None)
-let game_move_gs_str st gm = sprint_game_move st.struc (gm, None)
+let sprint_game_move gm = AuxIO.sprint_of_fprint fprint_game_move gm
+let game_move_str gm = sprint_game_move (gm, None)
let fprint_only_state ?(ext_struct=false) ppf
{struc = struc;
@@ -159,7 +154,7 @@
(Structure.fprint ~show_empty:true)) struc;
if (hist <> []) then
Format.fprintf ppf "@[<1>MOVES@ %a@]@ "
- (Aux.fprint_sep_list ";\n" (fprint_game_move struc)) hist;
+ (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
@@ -174,11 +169,13 @@
player_names = player_names;
data = data;
defined_rels = defined_rels;
- starting_struc = struc;
+ starting_struc = start_struc;
},
- {time = time;
- cur_loc = cur_loc;
- history = hist;
+ {
+ struc = cur_struc;
+ time = time;
+ cur_loc = cur_loc;
+ history = hist;
}) =
Format.fprintf ppf "@[<v>";
List.iter (fun (drel, (args, body)) ->
@@ -205,17 +202,20 @@
(ContinuousRule.fprint_full print_compiled_rules) r) rules;
Array.iteri (fun loc_id loc ->
Format.fprintf ppf "@[<0>LOC@ %d@ {@,@[<2> %a@]@]@,}@ "
- loc_id (fprint_loc_body struc player_names) loc) graph;
+ loc_id (fprint_loc_body player_names) loc) graph;
Format.fprintf ppf "@[<1>START@ %a@]@ "
(if ext_struct then (Structure.fprint_ext_structure ~show_empty:true) else
- (Structure.fprint ~show_empty:true)) struc;
+ (Structure.fprint ~show_empty:true)) start_struc;
if (hist <> []) then
Format.fprintf ppf "@[<1>MOVES@ %a@]@ "
- (Aux.fprint_sep_list ";\n" (fprint_game_move ~as_ints:true struc)) hist;
+ (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
Format.fprintf ppf "@[<1>TIME@ %F@]@ " time;
+ if ext_struct then
+ Format.fprintf ppf "@[<1>CURRENT@ %a@]@ "
+ (Structure.fprint_ext_structure ~show_empty:true) cur_struc;
Format.fprintf ppf "@]"
let fprint_state = fprint_state_full false
@@ -266,11 +266,10 @@
(* The order of following entries matters: [DefPlayers] adds more
players, with consecutive numbers starting from first available;
- later [StateStruc], [StateTime] and [StateLoc] entries override
- earlier ones; later [DefLoc] with already existing location ID
+ later [StartStruc], [CurrentStruc], [StateTime] and [StateLoc] entries
+ override earlier ones; later [DefLoc] with already existing location ID
replaces the earlier one. The default state is the empty state,
- default location is 0, default time is 0.0, default data is
- empty. *)
+ default location is 0, default time is 0.0, default data is empty. *)
type definition =
| DefRule of string * (
(string * int) list ->
@@ -283,7 +282,8 @@
| DefRel of string * string list * Formula.formula
(* add a defined relation *)
| DefPattern of Formula.real_expr (* Pattern definition *)
- | StateStruc of Structure.structure (* initial/saved state *)
+ | StartStruc of Structure.structure (* initial structure *)
+ | CurrentStruc of Structure.structure (* current structure *)
| History of (move * float option) list (* Move history *)
| StateTime of float (* initial/saved time *)
| StateLoc of int (* initial/saved location *)
@@ -327,14 +327,16 @@
(* Helper: Apply a move to a game state, get the new state. *)
let apply_move rules state (m, t) =
let r = List.assoc m.rule rules in
- match ContinuousRule.rewrite_single state.struc state.time m.matching r
+ let mtch =
+ List.map (fun (v, e) -> v, Structure.elem_nbr state.struc e) m.matching in
+ match ContinuousRule.rewrite_single state.struc state.time mtch r
m.mv_time m.parameters with
| Some (new_struc, new_time, _) ->
{ struc = new_struc;
time = new_time;
history = (m, t) :: state.history;
cur_loc = m.next_loc }
- | _ -> failwith ("move " ^ (sprint_game_move state.struc (m,t)) ^
+ | _ -> failwith ("move " ^ (sprint_game_move (m,t)) ^
" inapplicable to " ^ (sprint_only_state state))
(* Make a move in a game. *)
@@ -344,76 +346,74 @@
list of definitions (usually corresponding to a ".toss" file.) *)
let process_definition ?extend_state defs =
let (old_rules, old_locs, players, old_defined_rels,
- state, time, cur_loc, patterns, data) =
+ strucs, time, cur_loc, patterns, data) =
match extend_state with
| None ->
- [], [], [], [], Structure.empty_structure (), 0.0, 0, [], []
+ [], [], [], [], (Structure.empty_structure (), None), 0.0, 0, [], []
| Some (game, gstate) ->
game.rules, Array.to_list (Array.mapi (fun i l -> i, l) game.graph),
List.map fst (List.sort (fun (_,x) (_,y) -> x-y) game.player_names),
List.map (fun (rel, (args, body)) -> rel, args, body) game.defined_rels,
- gstate.struc, gstate.time, gstate.cur_loc,
+ (game.starting_struc, Some gstate.struc), gstate.time, gstate.cur_loc,
game.patterns, game.data in
LOG 3 "process_definition: %d old rules, %d old locs\n%!"
(List.length old_rules) (List.length old_locs);
let rules, locations, players, defined_rels,
- state, time, cur_loc, patterns, data, hist =
+ strucs, time, cur_loc, patterns, data, hist =
List.fold_left (fun (rules, locations, players, defined_rels,
- state, time, cur_loc, patterns, data, hist) def ->
+ strucs, time, cur_loc, patterns, data, hist) def ->
match def with
| DefRule (rname, r) ->
((rname, r)::rules, locations, players, defined_rels,
- state, time, cur_loc, patterns, data, hist)
+ strucs, time, cur_loc, patterns, data, hist)
| DefLoc loc ->
(rules, loc::locations, players, defined_rels,
- state, time, cur_loc, patterns, data, hist)
+ strucs, time, cur_loc, patterns, data, hist)
| DefPlayers more_players ->
(rules, locations, players @ more_players, defined_rels,
- state, time, cur_loc, patterns, data, hist)
+ strucs, time, cur_loc, patterns, data, hist)
| DefRel (rel, args, body) ->
(rules, locations, players,
(rel, args, body)::defined_rels,
- state, time, cur_loc, patterns, data, hist)
+ strucs, time, cur_loc, patterns, data, hist)
| DefPattern pat ->
(rules, locations, players, defined_rels,
- state, time, cur_loc, pat :: patterns, data, hist)
- | StateStruc struc ->
+ strucs, time, cur_loc, pat :: patterns, data, hist)
+ | StartStruc struc ->
(rules, locations, players, defined_rels,
- struc, time, cur_loc, patterns, data, hist)
+ (struc, snd strucs), time, cur_loc, patterns, data, hist)
+ | CurrentStruc struc ->
+ (rules, locations, players, defined_rels,
+ (fst strucs, Some struc), time, cur_loc, patterns, data, hist)
| History h ->
(rules, locations, players, defined_rels,
- state, time, cur_loc, patterns, data, h @ hist)
+ strucs, time, cur_loc, patterns, data, h @ hist)
| StateTime ntime ->
(rules, locations, players, defined_rels,
- state, ntime, cur_loc, patterns, data, hist)
+ strucs, ntime, cur_loc, patterns, data, hist)
| StateLoc ncur_loc ->
(rules, locations, players, defined_rels,
- state, time, ncur_loc, patterns, data, hist)
+ strucs, time, ncur_loc, patterns, data, hist)
| StateData more_data ->
(rules, locations, players, defined_rels,
- state, time, cur_loc, patterns, data @ more_data, hist)
- ) ([], [], players, [],
- state, time, cur_loc, patterns, data, []) defs in
+ strucs, time, cur_loc, patterns, data @ more_data, hist)
+ ) ([], [], players, [], strucs, time, cur_loc, patterns, data, []) defs in
LOG 3 "process_definition: %d new rules, %d new defined rels\n%!"
(List.length rules) (List.length defined_rels);
let defined_rels = old_defined_rels @ List.rev defined_rels in
let def_rels_pure =
List.map (fun (rel, args, body) -> (rel, (args, body))) defined_rels in
let player_names =
- Array.to_list (Array.mapi (fun i pname->pname, i)
- (Array.of_list players)) in
+ Array.to_list (Array.mapi (fun i pname->pname,i) (Array.of_list players)) in
let num_players = List.length player_names in
- let signature = Structure.rel_signature state in
+ let signature = Structure.rel_signature (fst strucs) in
LOG 3 "process_definition: parsing new rules...%!";
- let rules =
- old_rules @ List.map (fun (name, r) ->
- name, r signature def_rels_pure name) rules in
+ let rules = old_rules @ List.map (fun (name, r) ->
+ name, r signature def_rels_pure name) rules in
LOG 3 " parsed\n%!";
- let rules =
- List.sort (fun (rn1,_) (rn2,_)->String.compare rn1 rn2) rules in
+ let rules = List.sort (fun (rn1,_) (rn2,_)->String.compare rn1 rn2) rules in
let updated_locs =
- if old_locs = [] then old_locs
- else
+ if old_locs = [] then old_locs else
let more = num_players - Array.length (snd (List.hd old_locs)) in
let add_more (i,loc) =
i, Array.append loc (Array.make more zero_loc) in
@@ -432,13 +432,13 @@
let graph = Aux.array_from_assoc (List.rev locations) in
let pats=List.rev_map (FormulaSubst.subst_rels_expr def_rels_pure) patterns in
let apply_moves rules mvs s = List.fold_left (apply_move rules) s mvs in
- let result_state =
- apply_moves rules (List.rev hist) {
- struc = state;
- time = time;
- cur_loc = cur_loc;
- history = [];
- } in
+ let result_state = match snd strucs with
+ | None ->
+ let st = apply_moves rules (List.rev hist)
+ { snd empty_state with struc = fst strucs } in
+ { st with time = time; cur_loc = cur_loc; history = hist }
+ | Some struc ->
+ { struc = struc; time = time; cur_loc = cur_loc; history = hist; } in
{
rules = rules;
patterns = pats;
@@ -447,7 +447,7 @@
player_names = player_names;
data = data;
defined_rels = List.map (fun (a, b, c) -> (a, (b, c))) defined_rels;
- starting_struc = state;
+ starting_struc = fst strucs;
}, result_state
@@ -611,7 +611,8 @@
parameters = [];
rule = label.lb_rule;
next_loc = next_loc;
- matching = emb
+ matching =
+ List.map (fun (v, e) -> (v, Structure.elem_name model e)) emb
} |]
else
let param_names, params_in =
@@ -631,9 +632,10 @@
parameters = List.combine param_names params;
rule = label.lb_rule;
next_loc = next_loc;
- matching = emb}
- ) grid
- ) matchings))
+ matching =
+ List.map (fun (v, e) -> (v, Structure.elem_name model e)) emb
+ }) grid
+ ) matchings))
(* Check if the before-part of the precondition of the rule holds on history. *)
let check_history_pre r hist =
@@ -649,6 +651,8 @@
Aux.map_some (fun mv ->
let rule = List.assoc mv.rule rules in
if check_history_pre rule.ContinuousRule.discrete state.history then
+ let mtch = List.map (fun (v, e) ->
+ v, Structure.elem_nbr state.struc e) mv.matching in
Aux.map_option
(fun (model, time, _) -> (* ignoring shifts, i.e. animation steps *)
(mv,
@@ -656,7 +660,7 @@
history = (mv, None) :: state.history;
struc = model;
time = time}))
- (ContinuousRule.rewrite_single state.struc time mv.matching
+ (ContinuousRule.rewrite_single state.struc time mtch
rule mv.mv_time mv.parameters)
else None) (Array.to_list moves)
@@ -712,15 +716,17 @@
r_name (ContinuousRule.matching_str struc mtch) player
(String.concat ", " (List.map (fun (lb,_) -> lb.lb_rule) mv_loc.moves))
(String.concat "; " (List.map (fun m ->
- m.rule ^ ":" ^ ContinuousRule.matching_str struc m.matching
+ let mstr = List.map (fun (v, e) ->
+ v, Structure.elem_nbr state.struc e) m.matching in
+ m.rule ^ ":" ^ ContinuousRule.matching_str struc mstr
) (Array.to_list moves)));
let pos = (
try
for i = 0 to Array.length moves - 1 do
let mov = moves.(i) in
- if r_name = mov.rule && List.for_all
- (fun (e, f) -> f = List.assoc e mov.matching) mtch then
- raise (Found i)
+ if r_name = mov.rule && List.for_all (fun (e, f) ->
+ Structure.elem_name state.struc f = List.assoc e mov.matching) mtch
+ then raise (Found i)
done;
LOG 1 "apply_rewrite: failed for pl. num %d, r_name=%s\n%!"
player r_name;
Modified: trunk/Toss/Arena/Arena.mli
===================================================================
--- trunk/Toss/Arena/Arena.mli 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Arena/Arena.mli 2012-03-12 00:27:22 UTC (rev 1691)
@@ -40,7 +40,7 @@
parameters : (string * float) list ;
rule : string ;
next_loc : int ;
- matching : (string * int) list ;
+ matching : (string * string) list ;
}
@@ -94,17 +94,15 @@
(** For the rules of the game, also print their compiled forms. *)
val sprint_state_full : game * game_state -> string
-val sprint_game_move : Structure.structure -> move * float option -> string
-val game_move_str : Structure.structure -> move -> string
-val game_move_gs_str : game_state -> move -> string
+val sprint_game_move : move * float option -> string
+val game_move_str : move -> string
(** The order of following entries matters: [DefPlayers] adds more
- players, with consecutive numbers starting from first available;
- later [StateStruc], [StateTime] and [StateLoc] entries override
- earlier ones; later [DefLoc] with already existing location ID
- replaces the earlier one. The default state is the empty state,
- default location is 0, default time is 0.0, default data is
- empty. *)
+ players, with consecutive numbers starting from first available;
+ later [StartStruc], [CurrentStruc], [StateTime] and [StateLoc] entries
+ override earlier ones; later [DefLoc] with already existing location ID
+ replaces the earlier one. The default state is the empty state,
+ default location is 0, default time is 0.0, default data is empty. *)
type definition =
| DefRule of string * (
(string * int) list ->
@@ -117,7 +115,8 @@
| DefRel of string * string list * Formula.formula
(** add a defined relation *)
| DefPattern of Formula.real_expr (** Pattern definition *)
- | StateStruc of Structure.structure (** initial/saved state *)
+ | StartStruc of Structure.structure (** initial structure *)
+ | CurrentStruc of Structure.structure (** current structure *)
| History of (move * float option) list (** Move history *)
| StateTime of float (** initial/saved time *)
| StateLoc of int (** initial/saved location *)
Modified: trunk/Toss/Arena/ArenaParser.mly
===================================================================
--- trunk/Toss/Arena/ArenaParser.mly 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Arena/ArenaParser.mly 2012-03-12 00:27:22 UTC (rev 1691)
@@ -85,13 +85,13 @@
game_move_timed:
| OPENSQ r = id_int t = FLOAT RARR l = INT EMB
- emb = separated_list (COMMA, separated_pair (ID, COLON, INT)) CLOSESQ
+ emb = separated_list (COMMA, separated_pair (ID, COLON, id_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 l = INT EMB
- emb = separated_list (COMMA, separated_pair (ID, COLON, INT)) CLOSESQ
+ emb = separated_list (COMMA, separated_pair (ID, COLON, id_int)) CLOSESQ
f = FLOAT
{ ({mv_time = t; parameters = p; rule = r; next_loc = l; matching = emb;},
Some f) }
@@ -123,10 +123,15 @@
body = formula_expr_err
{ DefRel (rel, arg, body) }
| START model = struct_expr
- { StateStruc model }
+ { StartStruc model }
| START model = struct_expr WITH
defs = separated_list (SEMICOLON, rel_def_simple)
- { StateStruc (Arena.add_def_rels model defs) }
+ { StartStruc (Arena.add_def_rels model defs) }
+ | CURRENT model = struct_expr
+ { CurrentStruc model }
+ | CURRENT model = struct_expr WITH
+ defs = separated_list (SEMICOLON, rel_def_simple)
+ { CurrentStruc (Arena.add_def_rels model defs) }
| MOVES moves = separated_list (SEMICOLON, game_move_timed)
{ History (moves) }
| TIME_MOD t = FLOAT
Modified: trunk/Toss/Arena/ArenaTest.ml
===================================================================
--- trunk/Toss/Arena/ArenaTest.ml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Arena/ArenaTest.ml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -85,10 +85,9 @@
parameters = [];
rule = "rule";
next_loc = 1;
- matching = [("x", 1)];
+ matching = [("x", "1")];
} in
- let s = Structure.empty_structure () in
- assert_equal ~printer:(fun x -> x) (Arena.game_move_str s mv)
+ assert_equal ~printer:(fun x -> x) (Arena.game_move_str mv)
"[rule 0. -> 1 emb x: 1]"
);
]
Modified: trunk/Toss/Client/JsHandler.ml
===================================================================
--- trunk/Toss/Client/JsHandler.ml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Client/JsHandler.ml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -1,8 +1,5 @@
(* JavaScript Handler for a subset of ReqHandler.handle_http_post requests. *)
-
-(* In-source definitions of several games, loading games from strings. *)
-
type game_state_data = {
heuristic : Formula.real_expr array array; (** heuristic *)
game_state : (Arena.game * Arena.game_state); (** game and state *)
@@ -143,10 +140,8 @@
let _ = set_handle "test_handle" test_handle
let js_of_move game state move_id (player, move, _) =
- let struc = state.Arena.struc in
let matched = Js.array
- (Aux.array_map_of_list (fun (_, e) ->
- js (Structure.elem_name struc e)) move.Arena.matching) in
+ (Aux.array_map_of_list (fun (_, e) -> js e) move.Arena.matching) in
let js_move = jsnew js_object () in
let player_name = Aux.rev_assoc game.Arena.player_names player in
Js.Unsafe.set js_move (js"matched") matched;
@@ -156,7 +151,7 @@
js_move
(* Translate current structure into an "info_obj" format. *)
-let js_of_game_state game state =
+let js_of_game_state ?(show_payoffs=true) game state =
let struc = state.Arena.struc in
let get_pos e =
Structure.fun_val struc "x" e, Structure.fun_val struc "y" e in
@@ -201,7 +196,7 @@
if !cur_all_moves <> [||] then
Js.Unsafe.set info_obj (js"moves")
(Js.array (Array.mapi (js_of_move game state) !cur_all_moves))
- else ( (* find payoffs *)
+ else if show_payoffs then ( (* find payoffs *)
let payoffs = Array.mapi
(fun i v -> i, Solver.M.get_real_val v.Arena.payoff struc)
game.Arena.graph.(state.Arena.cur_loc) in
@@ -212,7 +207,8 @@
let player_name = Aux.rev_assoc game.Arena.player_names i in
Js.Unsafe.set result (js player_name) (Js.float payoff))
payoffs;
- Js.Unsafe.set info_obj (js"result") result);
+ Js.Unsafe.set info_obj (js"result") result
+ );
LOG 0 "%s" "js_of_game_state: Game prepared. Sending...";
info_obj
@@ -244,11 +240,10 @@
let preview_move move_nbr =
let n = List.length !play_states - (move_nbr + 1) in
- if n < 0 then Js.null
- else
+ if n < 0 then Js.null else
let game, _ = !cur_game.game_state in
let state = List.nth !play_states n in
- Js.some (js_of_game_state game state)
+ Js.some (js_of_game_state ~show_payoffs:(n = 0) game state)
let _ = set_handle "prev_move" preview_move
@@ -325,7 +320,7 @@
let game, _ = !cur_game.game_state in
let move_s, state = of_js move_js, List.hd !play_states in
let move_id = Aux.array_argfind
- (fun (_,m,_) -> Arena.game_move_gs_str state m = move_s) !cur_all_moves in
+ (fun (_,m,_) -> Arena.game_move_str m = move_s) !cur_all_moves in
let result =
js_of_move game state move_id (!cur_all_moves.(move_id)) in
Js.Unsafe.set result (js"comp_iters")
Modified: trunk/Toss/Client/Main.js
===================================================================
--- trunk/Toss/Client/Main.js 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Client/Main.js 2012-03-12 00:27:22 UTC (rev 1691)
@@ -69,12 +69,12 @@
document.getElementById ("topuser").innerHTML = game;
document.getElementById ("game-title").style.display = "none";
document.getElementById ("game-title-move").style.display = "none";
- document.getElementById ("game-info-par").style.paddingBottom = "1em";
document.getElementById ("welcome").style.display = "none";
new_play_do ("computer", function () { });
}
function new_play_do (opp_uid, continuation) {
+ if (GAME_NAME === "Gomoku") { document.getElementById ("speed").value = 3; }
document.getElementById ("working").innerHTML = "Loading "+GAME_NAME+"...";
document.getElementById ("working").style.display = "block";
document.getElementById ("welcome").style.display = "none";
@@ -83,13 +83,13 @@
gd.style.display = "block";
gd.setAttribute ("class", "Game-" + GAME_NAME);
document.getElementById ("game-title").innerHTML = GAME_NAME;
- document.getElementById ("game-title").style.display = "inline";
- document.getElementById ("game-title-move").style.display = "inline";
var build_play = function (state_str) {
document.getElementById ("working").style.display = "none";
document.getElementById ("toss-link").style.display = "none";
document.getElementById ("appstorelink").style.display = "none";
document.getElementById ("toprighttab").style.display = "inline";
+ document.getElementById ("game-title").style.display = "inline";
+ document.getElementById ("game-title-move").style.display = "inline";
document.getElementById ("game-desc-controls").style.display = "block";
document.getElementById ("suggestions-toggle").style.display = "inline";
document.getElementById ("game-disp").style.display = "block";
@@ -109,9 +109,6 @@
document.getElementById ('payoffs').innerHTML = "Not Finished Yet";
document.getElementById ('payoffs').style.display = "none";
document.getElementById ('new-play-par').style.display = "none";
- if (UNAME == "guest") {
- document.getElementById ("game-info-par").style.paddingBottom = "1em";
- };
toggle_suggestions ();
toggle_suggestions ();
PLAY.clear ();
Modified: trunk/Toss/Client/Play.js
===================================================================
--- trunk/Toss/Client/Play.js 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Client/Play.js 2012-03-12 00:27:22 UTC (rev 1691)
@@ -1,4 +1,4 @@
-// JavaScript Toss Module -- Play (requires Connect.js or JsHandler, State.js)
+// JavaScript Toss Module -- Play (requires JsHandler, State.js)
var SIMPLE_MOVES = true;
var nameDISP = undefined;
@@ -135,12 +135,9 @@
// Apply the current move in a play.
function play_move () {
- if (typeof CONN != 'undefined' && ASYNC_ALL_REQ_PENDING != 0)
- { alert ("async"); return; }
if (this.CUR_MOVE == null) return;
if (this.move_nbr < this.last_move_nbr) { return; }
- // FIXME: why - 1? Move() already subtracts 1!
- var pl_nbr = this.CUR_MOVE.player; // - 1;
+ var pl_nbr = this.CUR_MOVE.player;
if (!isNaN(pl_nbr) && this.players[pl_nbr] != this.cur_player_uid &&
this.players[pl_nbr] != "computer") {
alert ("It is your Opponent's move: pl_nbr = "+pl_nbr +
@@ -165,7 +162,6 @@
Play.prototype.move_continue = play_move_continue;
function play_prev_move () {
- var prev;
var that = this;
var disp = function (prev) {
if (prev === null || prev == "NONE") { return; }
@@ -173,17 +169,11 @@
that.move_nbr = that.move_nbr - 1;
that.redraw ();
}
- if (typeof CONN == 'undefined') {
- prev = ASYNCH ("prev_move", [this.move_nbr - 1], disp);
- } else {
- prev = CONN.prev_move (this.pid, this.move_nbr - 1);
- disp (prev);
- }
+ ASYNCH ("prev_move", [this.move_nbr - 1], disp);
}
Play.prototype.prev_move = play_prev_move;
function play_next_move () {
- var next;
var that = this;
var disp = function (next) {
if (next === null || next == "NONE") {
@@ -198,12 +188,7 @@
}
that.redraw ();
}
- if (typeof CONN == 'undefined') {
- next = ASYNCH ("prev_move", [this.move_nbr + 1], disp);
- } else {
- next = CONN.prev_move (this.pid, this.move_nbr + 1);
- disp (next);
- }
+ ASYNCH ("prev_move", [this.move_nbr + 1], disp);
}
Play.prototype.next_move = play_next_move;
@@ -236,7 +221,7 @@
var result_string = "";
if (this.cur_state.result == null) { return ""; }
winners = this.get_winners();
- if (winners == null) { return "Tie"; }
+ if (winners == null) { return "No Winners"; }
if (winners.length == 0) { return null; }
for (var i=0; i < winners.length; i++) {
if (i > 0) result_string += ', ' + disp_name(winners[i]);
@@ -282,9 +267,9 @@
if (pl == un) { return ("You Win!"); }
return (nameDISP(pl) + " Wins");
}
- var subst_pl = function (pl, str) {
+ var subst_pl = function (pl, s) {
var un = pl.cur_player_uid;
- var s = str; //strip (' ', '\n', str);
+ if (typeof s == 'undefined') { return "Not Finished" }
if (s == "0: 1., 1: -1." || s == "1: 1, 2: -1") {
return (win_s (pl.players[0], un));
}
@@ -308,10 +293,9 @@
document.getElementById("board").style.paddingTop = "0em";
}
document.getElementById("move-info-par").style.display = "none";
- document.getElementById("game-info-par").style.paddingBottom = "0em";
document.getElementById('payoffs').innerHTML =
"Result: " + subst_pl(play, play.cur_state.payoff);
- document.getElementById('payoffs').style.display = "inline";
+ document.getElementById('payoffs').style.display = "block";
document.getElementById('new-play-par').style.display = "block";
}
}
Modified: trunk/Toss/Client/State.js
===================================================================
--- trunk/Toss/Client/State.js 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Client/State.js 2012-03-12 00:27:22 UTC (rev 1691)
@@ -149,7 +149,7 @@
payoffs.push (player + ': ' + info_obj.result[player]);
}
this.payoff = payoffs.join (', ');
- } else {
+ } else if (typeof info_obj.moves != 'undefined') {
var mvs = [];
var pls = [];
for (i = 0; i < info_obj.moves.length; i++) {
Modified: trunk/Toss/Client/Style.css
===================================================================
--- trunk/Toss/Client/Style.css 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Client/Style.css 2012-03-12 00:27:22 UTC (rev 1691)
@@ -164,6 +164,8 @@
height: 100%;
text-align: justify;
display: block;
+ margin-top: 1em;
+ margin-bottom: 1em;
}
#more-games-bt-div {
@@ -609,7 +611,7 @@
#game-desc-controls {
position: relative;
- top: -1.5em;
+ top: -1em;
display: none;
width: 80%;
margin: auto;
@@ -835,8 +837,13 @@
#game-info-par {
font-weight: bold;
margin-bottom: 0px;
+ padding-top: 1em;
+}
+
+#payoffs {
+ display: none;
margin-top: 0.5em;
- padding: 0px;
+ font-weight: bold;
}
#nextmovebt {
@@ -875,7 +882,7 @@
position: fixed;
left: 0px;
right: 0px;
- top: 4em;
+ top: 6em;
width: 15em;
margin-left: auto;
margin-right: auto;
Modified: trunk/Toss/Client/index.html
===================================================================
--- trunk/Toss/Client/index.html 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Client/index.html 2012-03-12 00:27:22 UTC (rev 1691)
@@ -178,8 +178,8 @@
</button><button id="nextmovebt" class="bt" onclick="next_move_click()">
+
</button></span>
- <span id="payoffs" style="display:none;">Not Finished Yet</span>
</p>
+ <p id="payoffs">Not Finished Yet</p>
<p id="new-play-par">
<button id="new_game_me" class="bt" onclick="play_anew(true)">
New Game (You Start)
Modified: trunk/Toss/Formula/Lexer.mll
===================================================================
--- trunk/Toss/Formula/Lexer.mll 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Formula/Lexer.mll 2012-03-12 00:27:22 UTC (rev 1691)
@@ -81,7 +81,7 @@
| TIME_MOD
| PLAYER_MOD
| PLAYERS_MOD
- | MODEL_SPEC
+ | CURRENT
| RULE_SPEC
| STATE_SPEC
| CLASS
@@ -224,7 +224,7 @@
| "TIME" { TIME_MOD }
| "PLAYER" { PLAYER_MOD }
| "PLAYERS" { PLAYERS_MOD }
- | "MODEL" { MODEL_SPEC }
+ | "CURRENT" { CURRENT }
| "RULE" { RULE_SPEC }
| "STATE" { STATE_SPEC }
| "class" { CLASS }
Modified: trunk/Toss/Formula/Tokens.mly
===================================================================
--- trunk/Toss/Formula/Tokens.mly 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Formula/Tokens.mly 2012-03-12 00:27:22 UTC (rev 1691)
@@ -11,7 +11,7 @@
%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 START
%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 CLASS LFP GFP EOF
+%token CURRENT RULE_SPEC STATE_SPEC CLASS LFP GFP EOF
/* List in order of increasing precedence. */
%nonassoc LET_CMD
Modified: trunk/Toss/GGP/TranslateGame.ml
===================================================================
--- trunk/Toss/GGP/TranslateGame.ml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/GGP/TranslateGame.ml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -3186,8 +3186,7 @@
let tossrule = Aux.StrMap.find rname gdl.tossrule_data in
(* let rule = List.assoc rname (fst state).Arena.rules in *)
LOG 1 "GDL.translate_outgoing_move: rname=%s; emb={%s}"
- rname (String.concat ", "(List.map (fun (v, e)->
- let ename = Structure.elem_str (snd state).Arena.struc e in
+ rname (String.concat ", "(List.map (fun (v, ename)->
if ename = "control__blank_" then
AuxIO.print (Structure.sprint (snd state).Arena.struc);
v ^ ": " ^ ename
@@ -3195,7 +3194,8 @@
(* 10d *)
(* only the synchronization element should raise [Not_found] *)
- let emb = Aux.map_try (fun (v, struc_e) ->
+ let emb = Aux.map_try (fun (v, e) ->
+ let struc_e = Structure.elem_nbr (snd state).Arena.struc e in
LOG 4 "translate_outgoing_move: emb v=%s, struc_e=%d" v struc_e;
LOG 4 "translate_outgoing_move: emb lhs term=%s"
(term_str (Aux.StrMap.find v tossrule.rulevar_terms));
Modified: trunk/Toss/GGP/TranslateGame.mli
===================================================================
--- trunk/Toss/GGP/TranslateGame.mli 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/GGP/TranslateGame.mli 2012-03-12 00:27:22 UTC (rev 1691)
@@ -88,7 +88,7 @@
GDL.term list -> (int * (string * DiscreteRule.matching)) list
val translate_outgoing_move : gdl_translation ->
- (Arena.game * Arena.game_state) -> string -> (string * int) list -> string
+ (Arena.game * Arena.game_state) -> string -> (string * string) list -> string
val noop_move : gdl_translation -> Arena.game_state -> string
Modified: trunk/Toss/GGP/TranslateGameTest.ml
===================================================================
--- trunk/Toss/GGP/TranslateGameTest.ml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/GGP/TranslateGameTest.ml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -62,10 +62,10 @@
eq;
(* * Sys.remove ("./GGP/tests/"^game_name^"-temp.toss"); * *)
let rname = loc0_rule_name in
- let emb =
- Arena.matching_of_names res rname loc0_emb in
- let transl =
- TranslateGame.translate_outgoing_move gdl res rname emb in
+ let emb = Arena.matching_of_names res rname loc0_emb in
+ let emb_s = List.map (fun (v, e) ->
+ (v, Structure.elem_name (snd res).Arena.struc e)) emb in
+ let transl = TranslateGame.translate_outgoing_move gdl res rname emb_s in
assert_equal ~printer:(fun x->x) loc0_move transl;
let moves = match loc0_noop with
| Some loc0_noop -> [pte loc0_move; pte loc0_noop]
@@ -95,44 +95,6 @@
~printer:(emb_str res)
(norm_move (rname, emb)) (norm_move move)
-(* COPIED FROM ReqHandler. *)
-exception Found of int
-(* Players are indexed from 1 in graph (0 is Environment) *)
-let apply_rewrite (game,state as gstate) (player, (r_name, mtch)) =
- if r_name <> "" then (
- let {Arena.rules=rules; graph=graph} = game in
- let struc = state.Arena.struc in
- let mv_loc = graph.(state.Arena.cur_loc).(player) in
- let moves = Arena.gen_moves Arena.cGRID_SIZE rules struc mv_loc in
- LOG 1 "apply_rewrite: r_name=%s; mtch=%s; player=%d; prules=%s; moves= %s"
- r_name (ContinuousRule.matching_str struc mtch) player
- (String.concat ", " (List.map (fun (lb,_)->lb.Arena.lb_rule)
- mv_loc.Arena.moves))
- (String.concat "; "
- (List.map (fun m->
- m.Arena.rule^":"^
- ContinuousRule.matching_str struc
- m.Arena.matching) (Array.to_list moves)));
- let pos = (
- try
- for i = 0 to Array.length moves - 1 do
- let mov = moves.(i) in
- if r_name = mov.Arena.rule && List.for_all
- (fun (e, f) -> f = List.assoc e mov.Arena.matching) mtch then
- raise (Found i)
- done;
- AuxIO.printf "apply_rewrite: failed for pl. num %d, r_name=%s\n%!"
- player r_name;
- failwith "GDL Play request: action mismatched with play state"
- with Found pos ->
- pos) in
- let req = (r_name, mtch, 0.1, []) in
- let (new_state_noloc, resp) = Arena.apply_rule_int gstate req in
- let new_loc = moves.(pos).Arena.next_loc in
- (fst new_state_noloc,
- {snd new_state_noloc with Arena.cur_loc = new_loc})
- ) else gstate
-
let simult_test_case ~game_name ~player ~plnum ~moves
~rules_and_embs =
let game = load_rules ("./GGP/examples/"^game_name^".gdl") in
@@ -158,9 +120,10 @@
rules_and_embs in
(* skipping environment -- 0th -- not given in the input array *)
let own_rname, _ = rules_and_embs.(plnum-1) in
+ let emb_s = List.map (fun (v, e) ->
+ (v, Structure.elem_name (snd res).Arena.struc e)) embs.(plnum-1) in
let transl =
- TranslateGame.translate_outgoing_move gdl res
- own_rname embs.(plnum-1) in
+ TranslateGame.translate_outgoing_move gdl res own_rname emb_s in
assert_equal ~printer:(fun x->x) moves.(plnum-1) transl;
let moves =
TranslateGame.translate_incoming_move gdl res
@@ -169,7 +132,7 @@
assert_equal ~msg:"own incoming move" ~printer:(emb_str res)
(norm_move (own_rname, embs.(plnum-1))) (norm_move move);
let res =
- List.fold_left apply_rewrite res moves in
+ List.fold_left Arena.apply_rewrite res moves in
(* TODO: perform a move by environment once it is nicely provided
by for example ReqHandler. *)
ignore res;
Modified: trunk/Toss/Learn/LearnGameTest.ml
===================================================================
--- trunk/Toss/Learn/LearnGameTest.ml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Learn/LearnGameTest.ml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -8,7 +8,7 @@
let s = "START " ^ s ^ " with Da (x, y) = ex u (R(x, u) and C(u, y));" ^
" Db (x, y) = ex u (C(x, u) and R(y, u))" in
match ArenaParser.parse_game_defs Lexer.lex (Lexing.from_string s) with
- | Arena.StateStruc struc -> struc
+ | Arena.StartStruc struc -> struc
| _ -> failwith "LearnGameTest:struc_of_string: not a structure"
else
StructureParser.parse_structure Lexer.lex (Lexing.from_string s)
Modified: trunk/Toss/Play/GameTree.ml
===================================================================
--- trunk/Toss/Play/GameTree.ml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Play/GameTree.ml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -251,7 +251,7 @@
let maxs = if maxs_exact <> [] then maxs_exact else
Aux.array_find_all (fun (_,c) -> (node_values c).(p) = mval) succ in
let nonleaf = function Leaf _ -> false | _ -> true in
- let move_s (m, n) = Arena.game_move_gs_str (state n) m in
+ let move_s (m, n) = Arena.game_move_str m in
LOG 3"\nBest Moves: %s" (String.concat ", " (List.map move_s maxs));
if List.exists (fun x -> nonleaf (snd x)) maxs then (
List.map (fun (m, t) -> (m, state t)) maxs
Modified: trunk/Toss/Play/GameTreeTest.ml
===================================================================
--- trunk/Toss/Play/GameTreeTest.ml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Play/GameTreeTest.ml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -11,7 +11,7 @@
let struc_of_str s =
match ArenaParser.parse_game_defs Lexer.lex (Lexing.from_string s) with
- | Arena.StateStruc struc -> struc
+ | Arena.StartStruc struc -> struc
| _ -> failwith "GameTreeTest:struc_of_str: not a structure"
let state_of_file ?(struc="") ?(time=0.) ?(loc=0) fname =
Modified: trunk/Toss/Play/Play.ml
===================================================================
--- trunk/Toss/Play/Play.ml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Play/Play.ml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -50,7 +50,7 @@
try
let u = unfold_maximax ~ab:ab game heur t in
if (AuxIO.debug_level_for "Play" > 0) then AuxIO.printf "%d,%!" (size u);
- LOG 2 "(%s)," (let move_s (m, n) = Arena.game_move_gs_str n m in
+ LOG 2 "(%s)," (let move_s (m, _) = Arena.game_move_str m in
String.concat ", " (List.map move_s (List.hd mvs)));
unfold_maximax_upto ~ab:ab (count-1) game heur (u, mvs)
with
Modified: trunk/Toss/Play/PlayTest.ml
===================================================================
--- trunk/Toss/Play/PlayTest.ml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Play/PlayTest.ml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -10,7 +10,7 @@
let struc_of_str s =
match ArenaParser.parse_game_defs Lexer.lex (Lexing.from_string s) with
- | Arena.StateStruc struc -> struc
+ | Arena.StartStruc struc -> struc
| _ -> failwith "GameTreeTest:struc_of_str: not a structure"
let state_of_file ?(struc="") ?(time=0.) ?(loc=0) fname =
@@ -28,7 +28,7 @@
let res_mvs = Play.maximax_unfold_choose iters g s h in
if res_mvs <> [] then
List.iter (fun (m, ns) ->
- let move_str = Arena.game_move_gs_str s m in
+ let move_str = Arena.game_move_str m in
assert_bool
(Printf.sprintf "%s: Failed move: %s." msg move_str) (cond move_str)
) res_mvs
Modified: trunk/Toss/Server/Server.ml
===================================================================
--- trunk/Toss/Server/Server.ml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/Server/Server.ml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -161,7 +161,7 @@
let (move, _) = Aux.random_elem (Play.maximax_unfold_choose 1000000
(fst gs) (snd gs) heur) in
Play.cancel_timeout ();
- let resp = Arena.game_move_gs_str (snd gs) move in
+ let resp = Arena.game_move_str move in
LOG 1 "%s" resp;
http_msg false "200 OK" "text/html; charset=utf-8" [] resp
Modified: trunk/Toss/www/codebasics.xml
===================================================================
--- trunk/Toss/www/codebasics.xml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/www/codebasics.xml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -7,7 +7,7 @@
<title lang="en">Toss Code Basics Tutorial</title>
<title lang="de">Toss Code Basics Tutorial (auf Englisch)</title>
<title lang="pol">Toss Code Basics Tutorial (po angielsku)</title>
- <title lang="fr">Toss Code Basics Tutorial (à anglais)</title>
+ <title lang="fr">Toss Code Basics Tutorial (en anglais)</title>
<history>
<link id="develop" href="/develop.html">Develop Toss</link>
</history>
Modified: trunk/Toss/www/create.xml
===================================================================
--- trunk/Toss/www/create.xml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/www/create.xml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -7,7 +7,7 @@
<title lang="en">Create New Games</title>
<title lang="de">Neue Spiele Erzeugen</title>
<title lang="pol">Stwórz Nową Grę</title>
- <title lang="fr">Créez de Nouveaux Jeux</title>
+ <title lang="fr">Créez des jeux nouveaux</title>
<history>
<link id="docs" href="/docs.html">Documentation</link>
<link id="create" href="/create.html">Create</link>
@@ -54,11 +54,11 @@
</itemize>
</section>
<section title="Fichiers toss" lang="fr">
- <par>Pour comprendre de texte dans les fichiers .toss, vous
- devriez se familiariser avec Toss: au moins parcourir
- <a href="reference/reference.pdf">Reference.pdf</a> et 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>Pour comprendre le contenu des fichiers .toss, vous devriez vous
+ familiariser avec le Toss: au moins parcourir
+ <a href="reference/reference.pdf">Reference.pdf</a> et jeter un coup d'oeil
+ sur notre <a href="docs.html">documentation</a>. Après cela, vous pouvez
+ simplement éditer un fichier .toss, peut-être commençant par un de ceux-ci.
</par>
<itemize>
<item><a href="http://toss.svn.sourceforge.net/viewvc/toss/trunk/Toss/examples/Tic-Tac-Toe.toss">Tic-Tac-Toe</a></item>
@@ -69,31 +69,28 @@
<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>
+ <par>To create more complex games, like Chess, is it
+ convenient to edit directly the .toss game definition files.
+ Here are a few standard games defined in Toss. You can use them
+ 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>
+ <par>Um kompliziertere Spiele, wie Schach, zu definieren, ist es
+ bequem, direkt die .toss Files 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="pol">
<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.
+ wygodnie jest edytować bezpośrednio pliki .toss.
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.
+ <section title="Des jeux plus complèxes" lang="fr">
+ <par>Dans le cas de création des jeux plus complèxes, comme les échecs,
+ il est plus practique de modifier la définition du jeu directement dans
+ un fichier textuel .toss. Voici quelques jeux définies en Toss, vous pouvez
+ les utiliser comme le point de départ pour vos propres définitions.
</par>
</section>
Modified: trunk/Toss/www/ideas.xml
===================================================================
--- trunk/Toss/www/ideas.xml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/www/ideas.xml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -7,7 +7,7 @@
<title lang="en">Development Ideas</title>
<title lang="de">Ausbauideen (auf Englisch)</title>
<title lang="pol">Dalsze Pomysły (po angielsku)</title>
- <title lang="fr">Idées de Développement (à anglais)</title>
+ <title lang="fr">Idées de Développement (en anglais)</title>
<history>
<link id="develop" href="/develop.html">Develop Toss</link>
<link id="ideas" href="/ideas.html">Development Ideas</link>
Modified: trunk/Toss/www/navigation.xml
===================================================================
--- trunk/Toss/www/navigation.xml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/www/navigation.xml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -74,8 +74,8 @@
<item href="http://sourceforge.net/project/showfiles.php?group_id=115606"
>Téléchargez</item>
<menu title="Documentation" href="/docs.html" id="docs">
- <item href="/create.html" id="create">Créez des Jeux</item>
- <item href="/play.html" id="play">Regardez Toss Jouer</item>
+ <item href="/create.html" id="create">Créez des jeux</item>
+ <item href="/play.html" id="play">Regardez le Toss jouer</item>
<item href="/learn.html" id="learn">Toss Apprend</item>
<item href="/Publications/" id="Publications">Papiers, Entretiens</item>
<item href="/reference/reference.pdf" id="refpdf">Référence (pdf)</item>
Modified: trunk/Toss/www/ocaml.xml
===================================================================
--- trunk/Toss/www/ocaml.xml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/www/ocaml.xml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -7,7 +7,7 @@
<title lang="en">Mini OCaml Tutorial</title>
<title lang="de">Mini OCaml Tutorial (auf Englisch)</title>
<title lang="pol">Mini OCaml Tutorial (po angielsku)</title>
- <title lang="fr">Mini OCaml Tutorial (à anglais)</title>
+ <title lang="fr">Mini OCaml Tutorial (en anglais)</title>
<history>
<link id="develop" href="/develop.html">Develop Toss</link>
</history>
Modified: trunk/Toss/www/play.xml
===================================================================
--- trunk/Toss/www/play.xml 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/www/play.xml 2012-03-12 00:27:22 UTC (rev 1691)
@@ -7,7 +7,7 @@
<title lang="en">Watch Toss Play</title>
<title lang="de">Wie Toss Spielt</title>
<title lang="pol">Jak Toss Gra</title>
- <title lang="fr">Regardez Toss Jouer</title>
+ <title lang="fr">Regardez le Toss jouer</title>
<history>
<link id="docs" href="/docs.html">Documentation</link>
<link id="play" href="/play.html">Toss Play</link>
@@ -22,7 +22,6 @@
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
@@ -39,7 +38,6 @@
<a href="http://euklid.inf.tu-dresden.de:8180/ggpserver/">
Dresden GGP Server</a> gegeneinander spielen lassen, und Toss hat
da in letzter Zeit auch einige 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 vor kurzem angefangen zu versuchen, dieses Problem zu beseitigen.
@@ -55,7 +53,6 @@
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>
@@ -65,14 +62,15 @@
</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/>
+ Game Playing</a>, GGP, correspond à un problème de jouer à un jeu inconnu
+ auparavant. GGP est actuellement un populaire champ de recherche de l'IA,
+ avec les équipes à <a href="http://games.stanford.edu/">Stanford</a> et
+ en <a href="http://www.general-game-playing.de/">Allemagne</a>
+ travaillant sur ce problème. Les logiciels qui acceptent les jeux en
+ format GDL peuvent jouer sur le
+ <a href="http://euklid.inf.tu-dresden.de:8180/ggpserver/">
+ Dresden GGP Serveur</a>.
+ Récemment le Toss est entré dans la compétition lui aussi.
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
Modified: trunk/Toss/www/xsl/common.xsl
===================================================================
--- trunk/Toss/www/xsl/common.xsl 2012-03-11 17:33:19 UTC (rev 1690)
+++ trunk/Toss/www/xsl/common.xsl 2012-03-12 00:27:22 UTC (rev 1691)
@@ -97,9 +97,9 @@
<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>
+ <h3><a href="http://tplay.org">Jouez en Ligne contre le Toss</a></h3>
<xsl:apply-templates />
- <p><a href="http://tplay.org">Plus de Jeux</a></p>
+ <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>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|