[gnome-chess] engines.conf: use simpler format for UCI options



commit 09bd6938b2557278a3c94d2fb44fa92bed71acab
Author: Michael Catanzaro <mike catanzaro gmail com>
Date:   Fri Aug 2 21:44:52 2013 -0500

    engines.conf: use simpler format for UCI options

 data/engines.conf         |   18 +++++++++---------
 src/chess-engine-uci.vala |    8 +++++++-
 2 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/data/engines.conf b/data/engines.conf
index 032fab2..cd35b49 100644
--- a/data/engines.conf
+++ b/data/engines.conf
@@ -10,9 +10,9 @@ option-hard-0=hard
 [Stockfish]
 protocol=uci
 binary=stockfish
-option-easy-0=name Skill Level value 0
-option-normal-0=name Skill Level value 5
-option-hard-0=name Skill Level value 20
+option-easy-0=Skill Level 0
+option-normal-0=Skill Level 5
+option-hard-0=Skill Level 20
 
 [Phalanx]
 protocol=cecp
@@ -76,12 +76,12 @@ option-hard-0=hard
 [Glaurung]
 protocol=uci
 binary=glaurung
-option-easy-0=name Aggressiveness value 50
-option-easy-1=name Cowardice value 200
-option-normal-0=name Aggressiveness value 130
-option-normal-1=name Cowardice value 100
-option-hard-0=name Aggressiveness value 200
-option-hard-1=name Cowardice value 50
+option-easy-0=Aggressiveness 50
+option-easy-1=Cowardice 200
+option-normal-0=Aggressiveness 130
+option-normal-1=Cowardice 100
+option-hard-0=Aggressiveness 200
+option-hard-1=Cowardice 50
 
 [Diablo]
 protocol=uci
diff --git a/src/chess-engine-uci.vala b/src/chess-engine-uci.vala
index f7a6708..8998756 100644
--- a/src/chess-engine-uci.vala
+++ b/src/chess-engine-uci.vala
@@ -128,7 +128,13 @@ public class ChessEngineUCI : ChessEngine
     private void configure ()
     {
         foreach (var o in options)
-            write_line ("setoption %s".printf (o));
+        {
+            var line = o.split (" ");
+            var option_value = line[line.length - 1];
+            line = line[0:line.length-1];
+            var option_name = string.joinv (" ", line);
+            write_line ("setoption name %s value %s".printf (option_name, option_value));
+        }
         write_line ("isready");
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]