[Toss-devel-svn] SF.net SVN: toss:[1193] trunk/Toss
Status: Beta
Brought to you by:
lukaszkaiser
|
From: <luk...@us...> - 2010-11-23 09:56:39
|
Revision: 1193
http://toss.svn.sourceforge.net/toss/?rev=1193&view=rev
Author: lukstafi
Date: 2010-11-23 09:56:32 +0000 (Tue, 23 Nov 2010)
Log Message:
-----------
Alpha-beta bug fix. adv_ratio lowered to 2.
Modified Paths:
--------------
trunk/Toss/Client/Wrapper.py
trunk/Toss/Play/Game.ml
trunk/Toss/Play/GameTest.ml
Modified: trunk/Toss/Client/Wrapper.py
===================================================================
--- trunk/Toss/Client/Wrapper.py 2010-11-23 01:44:43 UTC (rev 1192)
+++ trunk/Toss/Client/Wrapper.py 2010-11-23 09:56:32 UTC (rev 1193)
@@ -396,7 +396,7 @@
# "EVAL LOC MOVES advancement_ratio location TIMEOUT time_in_sec iters_or_depth_limit method optional_playout_horizon"
# syntax variant 2:
# "EVAL LOC MOVES [{0: heuristic_player_0_loc_0; 1: heuristic_player_1_loc_0}; {0: heuristic_player_0_loc_1; 1: heuristic_player_1_loc_1}] advancement_ratio location TIMEOUT time_in_sec iters_or_depth_limit method optional_playout_horizon"
- m = self.msg ("EVAL LOC MOVES 5.0 " + str(loc) +" TIMEOUT 1200 "+ str(no_iters) + " alpha_beta_ord")
+ m = self.msg ("EVAL LOC MOVES 2.0 " + str(loc) +" TIMEOUT 1200 "+ str(no_iters) + " alpha_beta_ord")
self.set_time (ts, t)
msg = [s.strip() for s in m.split(';')]
emb = dict()
Modified: trunk/Toss/Play/Game.ml
===================================================================
--- trunk/Toss/Play/Game.ml 2010-11-23 01:44:43 UTC (rev 1192)
+++ trunk/Toss/Play/Game.ml 2010-11-23 09:56:32 UTC (rev 1193)
@@ -225,8 +225,7 @@
cooperative = false ;
}
-(* At least 5th degree monotonic heuristic needed for Gomoku. *)
-let default_adv_ratio = 5.0
+let default_adv_ratio = 2.0
let default_heuristic ?struc advance_ratio
@@ -736,7 +735,8 @@
let state = models.(pos) in
let sub_heur =
maximax_tree player new_betas (depth-1) state in
- if now_pruning && sub_heur.(player) >= betas.(player)
+ (* note strong inequality: don't lose ordering info *)
+ if now_pruning && sub_heur.(player) > betas.(player)
then (
(* {{{ log entry *)
if !debug_level > 2 && (depth0 > 2 || !debug_level > 6) &&
Modified: trunk/Toss/Play/GameTest.ml
===================================================================
--- trunk/Toss/Play/GameTest.ml 2010-11-23 01:44:43 UTC (rev 1192)
+++ trunk/Toss/Play/GameTest.ml 2010-11-23 09:56:32 UTC (rev 1193)
@@ -753,7 +753,7 @@
\"" 1 in
(* TODO: replace with easy_case after monotonic heur done *)
easy_case state 1 "Q should block straight"
- (fun mov_s -> "2{1:a1}" = mov_s);
+ (fun mov_s -> "2{1:b1}" = mov_s);
);
"tictactoe suggest win" >::
@@ -845,6 +845,31 @@
easy_case state 0 "W should beat the lower B" (* or medium *)
(fun mov_s -> "3{1:e3, 2:f3, 3:e4, 4:f4}" = mov_s));
+ "breakthrough suggest adv_ratio" >::
+ (fun () ->
+ let state = update_game breakthrough_game
+"[ | | ] \"
+ ... ... ... ...
+ B B..B B..B B..B B..
+ ... ... ... ...
+ B.. ... -B.B B..B
+ ... ... ... ...
+ ... ...+B ... ...
+ ... ... ... ...
+ ...B ... B.. ...
+ ... ... ... ...
+ ... ...W ... ...
+ ... ... ... ...
+ ... ... ... ...
+ ... ... ... ...
+ W W.. W..W W.. W..
+ ... ... ... ...
+ W..W W..W W..W W..W
+\"" 0 in
+ (* white move should beat the lower black *)
+ easy_case state 0 "W should play cool"
+ (fun mov_s -> mov_s <> "3{1:e4, 2:f4, 3:e5, 4:f5}"
+ && mov_s <> "2{1:d4, 2:e4, 3:d5, 4:e5}"));
"gomoku8x8 avoid endgame" >::
@@ -1009,7 +1034,7 @@
);
]
-let a =
+let a =
let file_from_path p =
String.sub p (String.rindex p '/'+1)
(String.length p - String.rindex p '/' - 1) in
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|