[Toss-devel-svn] SF.net SVN: toss:[1660] trunk/Toss
Status: Beta
Brought to you by:
lukaszkaiser
From: <luk...@us...> - 2012-02-01 19:28:49
|
Revision: 1660 http://toss.svn.sourceforge.net/toss/?rev=1660&view=rev Author: lukstafi Date: 2012-02-01 19:28:39 +0000 (Wed, 01 Feb 2012) Log Message: ----------- Local JS client: display iterations instead of tree size; diagnostic alerts for preparations of games; recompiled JsHandler.js. Modified Paths: -------------- trunk/Toss/Formula/Aux.ml trunk/Toss/Formula/Aux.mli trunk/Toss/Play/Play.ml trunk/Toss/Play/Play.mli trunk/Toss/Server/GameSelection.ml trunk/Toss/Server/JsHandler.ml trunk/Toss/WebClient/JsHandler.js trunk/Toss/WebClient/Main.js trunk/Toss/WebClient/Play.js Modified: trunk/Toss/Formula/Aux.ml =================================================================== --- trunk/Toss/Formula/Aux.ml 2012-02-01 18:27:03 UTC (rev 1659) +++ trunk/Toss/Formula/Aux.ml 2012-02-01 19:28:39 UTC (rev 1660) @@ -772,3 +772,14 @@ ) ELSE ( Str.global_replace (Str.regexp regexp) templ s ) ENDIF + +(* Display prominently a message and wait for user + acknowledgement. Intended mostly for diagnostic purposes. *) +let alert s = + IFDEF JAVASCRIPT THEN ( + let js_alert = Js.Unsafe.variable "alert" in + Js.Unsafe.fun_call js_alert [|Js.Unsafe.inject (Js.string s)|] + ) ELSE ( + prerr_endline (s ^ " -- PRESS [ENTER]"); + ignore (read_line ()) + ) ENDIF Modified: trunk/Toss/Formula/Aux.mli =================================================================== --- trunk/Toss/Formula/Aux.mli 2012-02-01 18:27:03 UTC (rev 1659) +++ trunk/Toss/Formula/Aux.mli 2012-02-01 19:28:39 UTC (rev 1660) @@ -369,3 +369,7 @@ except that all substrings of [s] that match [regexp] have been replaced by [templ]. *) val replace_regexp : regexp:string -> templ:string -> string -> string + +(** Display prominently a message and wait for user + acknowledgement. Intended mostly for diagnostic purposes. *) +val alert : string -> unit Modified: trunk/Toss/Play/Play.ml =================================================================== --- trunk/Toss/Play/Play.ml 2012-02-01 18:27:03 UTC (rev 1659) +++ trunk/Toss/Play/Play.ml 2012-02-01 19:28:39 UTC (rev 1660) @@ -45,6 +45,8 @@ unfold ~timeout:timed_out ~ab:ab game heur ~info_leaf:(fun _ _ _ -> 0) ~info_node:(maxdepth_node) ~choice:(maximax_depth_choice ab) +let latest_unfold_iters_left = ref 0 + (* Maximax unfolding upto depth. *) let rec unfold_maximax_upto ?(ab=false) count game heur (t, pmvs) = let mvs = (choose_moves game t) :: pmvs in @@ -61,13 +63,12 @@ with | Not_found -> (t, mvs) | Aux.Timeout msg -> + latest_unfold_iters_left := count; if !debug_level > 0 then Printf.printf "Timeout %f (%s)%!" (Aux.gettimeofday() -. !timeout) msg; (t, mvs) -let latest_gametree_size = ref 0 - (* Maximax unfold upto depth and choose move. *) let maximax_unfold_choose ?(check_stable=3) count game state heur = let ab = Heuristic.is_constant_sum heur in (* TODO: payoffs as well! *) @@ -77,7 +78,6 @@ let t = init game state (fun _ _ _ -> 0) heur in try let (u, mvs) = unfold_maximax_upto ~ab count game heur (t, []) in - latest_gametree_size := GameTree.size u; let nbr_to_check = min (2*check_stable + 1) (List.length mvs / 3) in let last_mvs = Aux.take_n (max 1 nbr_to_check) mvs in if !debug_level = 2 then Modified: trunk/Toss/Play/Play.mli =================================================================== --- trunk/Toss/Play/Play.mli 2012-02-01 18:27:03 UTC (rev 1659) +++ trunk/Toss/Play/Play.mli 2012-02-01 19:28:39 UTC (rev 1660) @@ -13,17 +13,18 @@ int GameTree.game_tree -> int GameTree.game_tree -(** Maximax unfolding upto depth, keep previous moves for stability. *) +(** Maximax unfolding upto iterations, keep previous moves for stability. *) val unfold_maximax_upto : ?ab:bool -> int -> Arena.game -> Formula.real_expr array array -> int GameTree.game_tree * (Arena.move * Arena.game_state) list list -> int GameTree.game_tree * (Arena.move * Arena.game_state) list list -(** Maximax unfold upto depth and choose move. *) +(** Maximax unfold upto iterations and choose move. *) val maximax_unfold_choose : ?check_stable:int -> int -> Arena.game -> Arena.game_state -> Formula.real_expr array array -> (Arena.move * Arena.game_state) list -(** Size of the game-tree produced by the latest call of - {!Play.maximax_unfold_choose}. *) -val latest_gametree_size : int ref +(** In case the computation is interrupted by a timeout, how many + iterations were left to perform by {!Play.maximax_unfold_choose} + or {!Play.unfold_maximax_upto}. *) +val latest_unfold_iters_left : int ref Modified: trunk/Toss/Server/GameSelection.ml =================================================================== --- trunk/Toss/Server/GameSelection.ml 2012-02-01 18:27:03 UTC (rev 1659) +++ trunk/Toss/Server/GameSelection.ml 2012-02-01 19:28:39 UTC (rev 1660) @@ -20,22 +20,1205 @@ with Not_found -> Heuristic.default_heuristic ~struc:state.Arena.struc ?advr game -let compile_game_data game_str = +let compile_game_data game_name game_str = + Aux.alert ("Parsing "^game_name^"..."); let (game, game_state as game_with_state) = ArenaParser.parse_game_state Lexer.lex (Lexing.from_string game_str) in + Aux.alert ("Parsed "^game_name^" -- computing its heuristic..."); let adv_ratio = try Some (float_of_string (List.assoc "adv_ratio" game.Arena.data)) with Not_found -> None in - {heuristic = compute_heuristic adv_ratio game_with_state; + let heuristic = compute_heuristic adv_ratio game_with_state in + Aux.alert ("Heuristic for "^game_name^" computed."); + game_name, + {heuristic = heuristic; game_state = game_with_state; playclock = 30; (* game clock from where? *) game_str = game_str; } -(* Maximum call stack size exceeded in JS (pbbly parsing Chess) -let chess_str = -*) +let chess_str = (" +PLAYERS 1, 2 +DATA depth: 0, adv_ratio: 1 +SET Sum (x | wP(x) : 1) +SET Sum (x | wR(x) : 1) +SET Sum (x | wN(x) : 1) +SET Sum (x | wB(x) : 1) +SET Sum (x | wQ(x) : 1) +SET Sum (x | bP(x) : 1) +SET Sum (x | bR(x) : 1) +SET Sum (x | bN(x) : 1) +SET Sum (x | bB(x) : 1) +SET Sum (x | bQ(x) : 1) +SET Sum (x | wBeats(x) : 1 + :(b(x)) + 3 * :(bK(x))) +SET Sum (x | bBeats(x) : 1 + :(w(x)) + 3 * :(wK(x))) +REL IsFirst(x) = not ex z C(z, x) +REL IsSecond(x) = ex y (C(y, x) and IsFirst(y)) +REL IsEight(x) = not ex z C(x, z) +REL IsSeventh(x) = ex y (C(x, y) and IsEight(y)) +REL IsA1(x) = not ex z R(z, x) and IsFirst(x) +REL IsH1(x) = not ex z R(x, z) and IsFirst(x) +REL IsA8(x) = not ex z R(z, x) and IsEight(x) +REL IsH8(x) = not ex z R(x, z) and IsEight(x) +REL w(x) = wP(x) or wR(x) or wN(x) or wB(x) or wQ(x) or wK(x) +REL b(x) = bP(x) or bR(x) or bN(x) or bB(x) or bQ(x) or bK(x) +REL DoubleC(x, y) = ex z ((C(x, z) and C(z, y)) or (C(y, z) and C(z, x))) +REL DoubleR(x, y) = ex z ((R(x, z) and R(z, y)) or (R(y, z) and R(z, x))) +REL KnightRCC(x, y) = ex z ((R(x, z) or R(z, x)) and DoubleC(z, y)) +REL KnightCRR(x, y) = ex z ((C(x, z) or C(z, x)) and DoubleR(z, y)) +REL Knight(x, y) = KnightRCC(x, y) or KnightCRR(x, y) +REL FreeD1 (x, y) = tc x, y (D1 (x, y) and not w(y) and not b(y)) +REL FreeD2 (x, y) = tc x, y (D2 (x, y) and not w(y) and not b(y)) +REL Diag1 (x, y) = ex z (FreeD1 (x, z) and (z = y or D1 (z, y))) +REL Diag2 (x, y) = ex z (FreeD2 (x, z) and (z = y or D2 (z, y))) +REL Diag (x, y) = Diag1 (x, y) or Diag2 (x, y) +REL FreeC (x, y) = tc x, y ((C(x, y) or C(y, x)) and not w(y) and not b(y)) +REL FreeR (x, y) = tc x, y ((R(x, y) or R(y, x)) and not w(y) and not b(y)) +REL Col (x, y) = ex z (FreeC (x, z) and (z = y or (C(z, y) or C(y, z)))) +REL Row (x, y) = ex z (FreeR (x, z) and (z = y or (R(z, y) or R(y, z)))) +REL Line (x, y) = Col (x, y) or Row (x, y) +REL Near (x, y) = C(x,y) or C(y,x) or R(x,y) or R(y,x) or D1(x, y) or D2(x, y) +REL wPBeats (x) = ex y (wP(y) and ex z ((R(y, z) or R(z, y)) and C(z, x))) +REL bPBeats (x) = ex y (bP(y) and ex z ((R(y, z) or R(z, y)) and C(x, z))) +REL wDiagBeats (x) = ex y ((wQ(y) or wB(y)) and Diag(y, x)) +REL bDiagBeats (x) = ex y ((bQ(y) or bB(y)) and Diag(y, x)) +REL wLineBeats (x) = ex y ((wQ(y) or wR(y)) and Line(y, x)) +REL bLineBeats (x) = ex y ((bQ(y) or bR(y)) and Line(y, x)) +REL wFigBeats(x) = wDiagBeats(x) or wLineBeats(x) or ex y(wN(y) and Knight(y,x)) +REL bFigBeats(x) = bDiagBeats(x) or bLineBeats(x) or ex y(bN(y) and Knight(y,x)) +REL wBeats(x) = wFigBeats(x) or wPBeats(x) or ex y (wK(y) and Near(y, x)) +REL bBeats(x) = bFigBeats(x) or bPBeats(x) or ex y (bK(y) and Near(y, x)) +REL CheckW() = ex x (wK(x) and bBeats(x)) +REL CheckB() = ex x (bK(x) and wBeats(x)) +RULE WhitePawnMove: + [ | | ] \" + ... + ... + + wP +\" -> [ | | ] \" + ... + wP + + . +\" emb w, b pre not IsEight(a2) post not CheckW() +RULE BlackPawnMove: + [ | | ] \" + ... + bP. + + . +\" -> [ | | ] \" + ... + ... + + bP +\" emb w, b pre not IsFirst(a1) post not CheckB() +RULE WhitePawnMoveDbl: + [ | | ] \" + + . + ... + ... + + wP +\" -> [ | | ] \" + ... + wP + + . + ... + ... +\" emb w, b pre IsSecond(a1) post not CheckW() +RULE BlackPawnMoveDbl: + [ | | ] \" + ... + bP. + + . + ... + ... +\" -> [ | | ] \" + + + ... + ... + + bP +\" emb w, b pre IsSeventh(a3) post not CheckB() +RULE WhitePawnBeat: + [ a, b | wP { a }; b { b } | - ] + -> + [ a, b | wP { b } | - ] + emb w, b + pre not IsEight(b) and ex z (C(a, z) and (R(z, b) or R(b, z))) + post not CheckW() +RULE WhitePawnBeatPromote: + [ a, b | wP { a }; b { b } | - ] + -> + [ a, b | wQ { b } | - ] + emb w, b + pre IsEight(b) and ex z (C(a, z) and (R(z, b) or R(b, z))) + post not CheckW() +RULE WhitePawnBeatRDbl: + [ | | ] \" + ... + ?..-bP + ... + ? ... + ... + wP.bP +\" -> [ | | ] \" + ... + ?... + ... + ? wP. + ... + .... +\" emb w, b post not CheckW() +RULE WhitePawnBeatLDbl: + [ | | ] \" + ... + -bP? + ... + . ?.. + ... + bP.wP +\" -> [ | | ] \" + ... + ...? + ... + wP ?.. + ... + .... +\" emb w, b post not CheckW() +RULE BlackPawnBeat: + [ a, b | bP { a }; w { b } | - ] + -> + [ a, b | bP { b } | - ] + emb w, b + pre not IsFirst(b) and ex z (C(z, a) and (R(z, b) or R(b, z))) + post not CheckB() +RULE BlackPawnBeatPromote: + [ a, b | bP { a }; w { b } | - ] + -> + [ a, b | bQ { b } | - ] + emb w, b + pre IsFirst(b) and ex z (C(z, a) and (R(z, b) or R(b, z))) + post not CheckB() +RULE BlackPawnBeatRDbl: + [ | | ] \" + ... + bP.wP + ... + ? ... + ... + ?..-wP +\" -> [ | | ] \" + ... + .... + ... + ? bP. + ... + ?... +\" emb w, b post not CheckB() +RULE BlackPawnBeatLDbl: + [ | | ] \" + ... + wP.bP + ... + . ?.. + ... + -wP? +\" -> [ | | ] \" + ... + .... + ... + bP ?.. + ... + ...? +\" emb w, b post not CheckB() +RULE WhitePawnPromote: + [ | | ] \" + ... + ... + + wP +\" -> [ | | ] \" + ... + wQ. + + . +\" emb w, b pre IsEight(a2) post not CheckW() +RULE BlackPawnPromote: + [ | | ] \" + ... + bP. + + . +\" -> [ | | ] \" + ... + ... + + bQ +\" emb w, b pre IsFirst(a1) post not CheckB() +RULE WhiteKnight: + [ a, b | wN { a }; _opt_b { b } | - ] + -> + [ a, b | wN { b } | - ] + emb w, b pre Knight(a, b) post not CheckW() +RULE BlackKnight: + [ a, b | bN { a }; _opt_w { b } | - ] + -> + [ a, b | bN { b } | - ] + emb w, b pre Knight(a, b) post not CheckB() +RULE WhiteBishop: + [ a, b | wB { a }; _opt_b { b } | - ] + -> + [ a, b | wB { b } | - ] + emb w, b pre Diag(a, b) post not CheckW() +RULE BlackBishop: + [ a, b | bB { a }; _opt_w { b } | - ] + -> + [ a, b | bB { b } | - ] + emb w, b pre Diag(a, b) post not CheckB() +RULE WhiteRook: + [ a, b | wR { a }; _opt_b { b } | - ] + -> + [ a, b | wR { b } | - ] + emb w, b pre not IsA1(a) and not IsH1(a) and Line(a, b) post not CheckW() +RULE WhiteRookA1: + [ a, b | wR { a }; _opt_b { b } | - ] + -> + [ a, b | wR { b } | - ] + emb w, b pre IsA1(a) and Line(a, b) post not CheckW() +RULE WhiteRookH1: + [ a, b | wR { a }; _opt_b { b } | - ] + -> + [ a, b | wR { b } | - ] + emb w, b pre IsH1(a) and Line(a, b) post not CheckW() +RULE BlackRook: + [ a, b | bR { a }; _opt_w { b } | - ] + -> + [ a, b | bR { b } | - ] + emb w, b pre not IsA8(a) and not IsH8(a) and Line(a, b) post not CheckB() +RULE BlackRookA8: + [ a, b | bR { a }; _opt_w { b } | - ] + -> + [ a, b | bR { b } | - ] + emb w, b pre IsA8(a) and Line(a, b) post not CheckB() +RULE BlackRookH8: + [ a, b | bR { a }; _opt_w { b } | - ] + -> + [ a, b | bR { b } | - ] + emb w, b pre IsH8(a) and Line(a, b) post not CheckB() +RULE WhiteQueen: + [ a, b | wQ { a }; _opt_b { b } | - ] + -> + [ a, b | wQ { b } | - ] + emb w, b pre (Line(a, b) or Diag(a, b)) post not CheckW() +RULE BlackQueen: + [ a, b | bQ { a }; _opt_w { b } | - ] + -> + [ a, b | bQ { b } | - ] + emb w, b pre (Line(a, b) or Diag(a, b)) post not CheckB() +RULE WhiteKing: + [ a, b | wK { a }; _opt_b { b } | - ] + -> + [ a, b | wK { b } | - ] + emb w, b pre Near(a, b) post not CheckW() +RULE BlackKing: + [ a, b | bK { a }; _opt_w { b } | - ] + -> + [ a, b | bK { b } | - ] + emb w, b pre Near(a, b) post not CheckB() +RULE WhiteLeftCastle: + [ | | ] \" + ... ... ... + wR. ... wK. +\" -> [ | | ] \" + ... ... ... + ... wK.wR ... +\" emb w,b pre not(bBeats(c1) or bBeats(d1) or bBeats(e1)) post true +RULE WhiteRightCastle: + [ | | ] \" + ... ... + wK. ...wR +\" -> [ | | ] \" + ... ... + ...wR wK. +\" emb w,b pre not (bBeats(a1) or bBeats(b1) or bBeats(c1)) post true +RULE BlackLeftCastle: + [ | | ] \" + ... ... ... + bR. ... bK. +\" -> [ | | ] \" + ... ... ... + ... bK.bR ... +\" emb w,b pre not(wBeats(c1) or wBeats(d1) or wBeats(e1)) post true +RULE BlackRightCastle: + [ | | ] \" + ... ... + bK. ...bR +\" -> [ | | ] \" + ... ... + ...bR bK. +\" emb w,b pre not (wBeats(a1) or wBeats(b1) or wBeats(c1)) post true +LOC 0 { // both can castle + PLAYER 1 { + COND 1; 5; 3; 3; 9; -1; -5; -3; -3; -9; 0.05; -0.05 + PAYOFF :(CheckB()) - :(CheckW()) + MOVES + [WhitePawnMove -> 1]; + [WhitePawnMoveDbl -> 1]; + [WhitePawnBeat -> 1]; + [WhitePawnBeatPromote -> 1]; + [WhitePawnBeatLDbl -> 1]; + [WhitePawnBeatRDbl -> 1]; + [WhitePawnPromote -> 1]; + [WhiteKnight -> 1]; + [WhiteBishop -> 1]; + [WhiteRook -> 1]; + [WhiteRookA1 -> 5]; + [WhiteRookH1 -> 3]; + [WhiteQueen -> 1]; + [WhiteLeftCastle -> 7]; + [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 1 { // both can castle + PLAYER 2 { + COND -1; -5; -3; -3; -9; 1; 5; 3; 3; 9; -0.05; 0.05 + PAYOFF :(CheckW()) - :(CheckB()) + MOVES + [BlackPawnMove -> 0]; + [BlackPawnMoveDbl -> 0]; + [BlackPawnBeat -> 0]; + [BlackPawnBeatPromote -> 0]; + [BlackPawnBeatLDbl -> 0]; + [BlackPawnBeatRDbl -> 0]; + [BlackPawnPromote -> 0]; + [BlackKnight -> 0]; + [BlackBishop -> 0]; + [BlackRook -> 0]; + [BlackRookA8 -> 16]; + [BlackRookH8 -> 8]; + [BlackQueen -> 0]; + [BlackLeftCastle -> 24]; + [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 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. + ... ... ... ... + bP.bP bP.bP bP.bP bP.bP + ... ... ... ... + ... ... ... ... + ... ... ... ... + ... ... ... ... + ... ... ... ... + ... ... ... ... + ... ... ... ... + ... ... ... ... + ... ... ... ... + wP wP.wP wP.wP wP.wP wP. + ... ... ... ... + wR.wN wB.wQ wK.wB wN.wR +\" with +D1(x, y) = ex z ( (R(x, z) and C(z, y)) or (R(y, z) and C(z, x)) ) ; +D2(x, y) = ex z ( (R(x, z) and C(y, z)) or (R(y, z) and C(x, z)) ) +") + let connect4_str = ("PLAYERS 1, 2 DATA r1: circle, r2: line, adv_ratio: 4, depth: 6 REL Row4 (x, y, z, v) = R(x, y) and R(y, z) and R(z, v) @@ -643,12 +1826,12 @@ let games = ref [ - "Breakthrough", compile_game_data breakthrough_str; - "Checkers", compile_game_data checkers_str; - (* "Chess", compile_game_data chess_str; *) - "Connect4", compile_game_data connect4_str; - "Entanglement", compile_game_data entanglement_str; - "Gomoku", compile_game_data gomoku_str; - "Pawn-Whopping", compile_game_data pawn_whopping_str; - "Tic-Tac-Toe", compile_game_data tictactoe_str; + compile_game_data "Breakthrough" breakthrough_str; + compile_game_data "Checkers" checkers_str; + (* compile_game_data "Chess" chess_str; *) + compile_game_data "Connect4" connect4_str; + compile_game_data "Entanglement" entanglement_str; + compile_game_data "Gomoku" gomoku_str; + compile_game_data "Pawn-Whopping" pawn_whopping_str; + compile_game_data "Tic-Tac-Toe" tictactoe_str; ] Modified: trunk/Toss/Server/JsHandler.ml =================================================================== --- trunk/Toss/Server/JsHandler.ml 2012-02-01 18:27:03 UTC (rev 1659) +++ trunk/Toss/Server/JsHandler.ml 2012-02-01 19:28:39 UTC (rev 1660) @@ -147,16 +147,17 @@ let game, _ = !cur_game.game_state in let state = List.hd !play_states in try + let large_iters = 100000 in let (move, _) = - Aux.random_elem (Play.maximax_unfold_choose 100000 + Aux.random_elem (Play.maximax_unfold_choose large_iters game state !cur_game.heuristic) in Play.cancel_timeout (); - let algo_iters = !Play.latest_gametree_size in + let algo_iters = large_iters - !Play.latest_unfold_iters_left in let move_id = Aux.array_argfind (fun (_, m, _) -> m = move) !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_tree_size") + Js.Unsafe.set result (js"comp_iters") (Js.number_of_float (float_of_int algo_iters)); Js.Unsafe.set result (js"comp_started") (Js.number_of_float comp_started); @@ -176,7 +177,7 @@ let set_game game_name game_str = let game_name = of_js game_name and game_str = of_js game_str in try - games := (game_name, compile_game_data game_str) :: !games; + games := compile_game_data game_name game_str :: !games; js ("Game "^game_name^" set.") with Lexer.Parsing_error s -> js ("Game "^game_name^" ERROR: "^s) Modified: trunk/Toss/WebClient/JsHandler.js =================================================================== --- trunk/Toss/WebClient/JsHandler.js 2012-02-01 18:27:03 UTC (rev 1659) +++ trunk/Toss/WebClient/JsHandler.js 2012-02-01 19:28:39 UTC (rev 1660) @@ -892,4 +892,4 @@ if( y.fun ) { x.fun = y.fun; return 0; } var i = y.length; while (i--) x[i] = y[i]; return 0; } @@ Diff output truncated at 100000 characters. @@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |