[jgogears commit] r53 - in trunk/jgogears: doc jgogears jgogears/engine

0 views
Skip to first unread message

codesite...@google.com

unread,
Mar 9, 2008, 6:52:01 PM3/9/08
to jgog...@googlegroups.com
Author: syeates
Date: Sun Mar 9 15:51:10 2008
New Revision: 53

Modified:
trunk/jgogears/doc/TODO
trunk/jgogears/jgogears/Board.java
trunk/jgogears/jgogears/BoardI.java
trunk/jgogears/jgogears/Game.java
trunk/jgogears/jgogears/engine/Engine.java
trunk/jgogears/jgogears/engine/ModelTest.java
trunk/jgogears/jgogears/engine/Scorer.java
trunk/jgogears/jgogears/engine/SufogoEngineTest.java
trunk/jgogears/jgogears/engine/Trainer.java

Log:
TODOs and tweaks

Modified: trunk/jgogears/doc/TODO
==============================================================================
--- trunk/jgogears/doc/TODO (original)
+++ trunk/jgogears/doc/TODO Sun Mar 9 15:51:10 2008
@@ -4,9 +4,12 @@
Short Term
* trace lack of symmetry in testTrainedModelEmptyBoard
* work on ASCIIToBoard -> BoardI round triping
-* update javacc generated files in svn (eclipse javacc plugin is
preventing this happening)
+* update javacc generated files in svn (eclipse javacc plugin is
preventing this happening via eclipse)
* commandline program to play jgogears against gnugo
* commandline program to guess moves from real games
+* change training to only train on winning moves rather than all moves
+* decided whether to dual licence under the Apache 2 license
+* find a decent training corpus

SGF Support
* parse tt in SGF files

Modified: trunk/jgogears/jgogears/Board.java
==============================================================================
--- trunk/jgogears/jgogears/Board.java (original)
+++ trunk/jgogears/jgogears/Board.java Sun Mar 9 15:51:10 2008
@@ -206,14 +206,4 @@
this.board[row][column] = colour;
}

- /*
- * (non-Javadoc)
- *
- * @see jgogears.BoardInterface#toString()
- */
- @Override
- public String toString() {
- return BoardToASCII.Transform(this);
- }
-
}

Modified: trunk/jgogears/jgogears/BoardI.java
==============================================================================
--- trunk/jgogears/jgogears/BoardI.java (original)
+++ trunk/jgogears/jgogears/BoardI.java Sun Mar 9 15:51:10 2008
@@ -385,4 +385,14 @@
this.zobrist = zobrist;
}

+ /*
+ * (non-Javadoc)
+ *
+ * @see jgogears.BoardInterface#toString()
+ */
+ @Override
+ public String toString() {
+ return BoardToASCII.Transform(this);
+ }
+
}

Modified: trunk/jgogears/jgogears/Game.java
==============================================================================
--- trunk/jgogears/jgogears/Game.java (original)
+++ trunk/jgogears/jgogears/Game.java Sun Mar 9 15:51:10 2008
@@ -153,6 +153,8 @@
* @return the boardlist
*/
public final LinkedList<BoardI> getBoardlist() {
+ if (this.boardlist == null)
+ getBoards();
return this.boardlist;
}

@@ -162,7 +164,7 @@
* @return an iterator
*/
public Iterator<BoardI> getBoards() {
- if (this.boardlist != null) {
+ if (this.boardlist == null) {

Iterator<Move> moves = this.getMoves();
this.boardlist = new LinkedList<BoardI>();
@@ -232,7 +234,7 @@
}

/**
- * get the movelist.
+ * get the movelist
*
* @return the movelist
*/

Modified: trunk/jgogears/jgogears/engine/Engine.java
==============================================================================
--- trunk/jgogears/jgogears/engine/Engine.java (original)
+++ trunk/jgogears/jgogears/engine/Engine.java Sun Mar 9 15:51:10 2008
@@ -26,7 +26,7 @@
Model model = new Model();
System.out.println("about to train model");

- new Trainer().trainNFiles(100, model);
+ new Trainer().trainFiles(100, model);
System.out.println("model trained");

SufgoEngine black = new SufgoEngine();

Modified: trunk/jgogears/jgogears/engine/ModelTest.java
==============================================================================
--- trunk/jgogears/jgogears/engine/ModelTest.java (original)
+++ trunk/jgogears/jgogears/engine/ModelTest.java Sun Mar 9 15:51:10 2008
@@ -28,7 +28,7 @@
public ModelTest() throws IOException {
if (model == null) {
model = new Model();
- new Trainer().trainNFiles(10, model);
+ new Trainer().trainFiles(10, model);
}
}


Modified: trunk/jgogears/jgogears/engine/Scorer.java
==============================================================================
--- trunk/jgogears/jgogears/engine/Scorer.java (original)
+++ trunk/jgogears/jgogears/engine/Scorer.java Sun Mar 9 15:51:10 2008
@@ -6,7 +6,7 @@
import jgogears.*;

/**
- * TODO
+ * Class to calculate scores using a model and a board.
* @author syeates
*
*/

Modified: trunk/jgogears/jgogears/engine/SufogoEngineTest.java
==============================================================================
--- trunk/jgogears/jgogears/engine/SufogoEngineTest.java (original)
+++ trunk/jgogears/jgogears/engine/SufogoEngineTest.java Sun Mar 9
15:51:10 2008
@@ -25,10 +25,9 @@
*/
public void testSimple() throws Exception {

- // TODO make sure this terminates
GTPState state = new GTPState();
Model model = new Model();
- new Trainer().trainNFiles(10, model);
+ new Trainer().trainFiles(10, model);

SufgoEngine black = new SufgoEngine();
black.setModel(model);

Modified: trunk/jgogears/jgogears/engine/Trainer.java
==============================================================================
--- trunk/jgogears/jgogears/engine/Trainer.java (original)
+++ trunk/jgogears/jgogears/engine/Trainer.java Sun Mar 9 15:51:10 2008
@@ -15,20 +15,33 @@
*/
public class Trainer {
static final private boolean DEBUG = false;
+ private int minBranchSize = 20;
+ private int defaultNumberOfFiles = 100;

-
- /**
- * Train n files.
- *
- * @param count
- * the count
- * @param model
- * the model
- * @return the model
- * @throws IOException
- * Signals that an I/O exception has occurred.
- */
- public Model trainNFiles(int count, Model model) throws IOException {
+ /**
+ * Train on files.
+ *
+ * @param model
+ * the model
+ * @return the model
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
+ */
+ public Model trainFiles( Model model) throws IOException {
+ return trainFiles(defaultNumberOfFiles, model);
+ }
+ /**
+ * Train on files.
+ *
+ * @param count
+ * the count
+ * @param model
+ * the model
+ * @return the model
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
+ */
+ public Model trainFiles(int count, Model model) throws IOException {
Stack<String> files = new Stack<String>();
files.push("sgf/2004-12");

@@ -117,13 +130,15 @@
* are we expanding?
* @param depth
* the depth to expand to
+ * @param root
+ * the root of the model
* @param playeda
* the played
*/
public void train(Node root, VertexLineariser linear, boolean
playeda, boolean expand, int depth) {
if (depth <= 0)
expand = false;
- if (root.getNotPlayed() + root.getPlayed() < 100)
+ if (root.getNotPlayed() + root.getPlayed() < minBranchSize)
expand = false;
depth--;
if (playeda)

Reply all
Reply to author
Forward
0 new messages