Search

Friday, November 23, 2012

Day 106: Get group size

Until now all I have is a method returning an array of stones of the same group, but any time I needed to know how many stones are in the group I needed to get the group and count the array positions. I created a new method for that, so I don't have to do this in all the methods that need a size of a group. Why? I saw that I will need something like this in methods like "Jump".

Thursday, November 22, 2012

Day 105: some changes

Well, some fuseki problems that I was seeing in the last days are being solved. giving 17 points to a fuseki position and quitting only 15 if it is a bad move (for example, playing komoku in a corner with a hoshi played by the same color) is something wrong, because it still have 2 points + random number (1,5).

So, first I changed 15 to 25, but still there was something I needed to change: quitting 25 points putting the integer 25 is kind of hardcoding now, so I added a variable in my weightValues class "badFusekiMove" or something like that, giving the value 25.

 So, this is how it played now:


(;FF[4]CA[UTF-8]AP[GoGui:1.4.5] KM[6.5]PW[Evil Tesuji]DT[2012-11-22] ;B[pp];W[dq];B[dd];W[cp];B[nc];W[qq];B[qd];W[cc];B[dc];W[pc] ;B[qc];W[co];B[cj];W[eq];B[qj];W[oc];B[nd];W[bc];B[ob];W[fq] ;B[pb];W[iq];B[pd];W[mq];B[pq];W[po];B[qp];W[nq];B[qr];W[rq])
It is not something to be proud of, but... is slight better.

Wednesday, November 21, 2012

Day 104: Playing 0.01C

I just played some moves against Evil Tesuji 0.01C. I see I still fail in some things at fuseki stage. I thought it should work with latest changes but still... Well, here is the thing:


(;FF[4]CA[UTF-8]AP[GoGui:1.4.5] KM[6.5]PW[Evil Tesuji]DT[2012-11-21] ;B[pd];W[cp];B[qp];W[eq];B[qj];W[cd];B[jc];W[cq];B[cj];W[pq] ;B[qq];W[po];B[qo];W[dp];B[cg];W[nq];B[jp];W[qc];B[qd];W[dc] ;B[cm];W[pp];B[qn];W[cc];B[pn];W[dq])
Will try to solve fuseki problems first, that last move hurted.

Friday, November 16, 2012

Day 99: Extending

This is just an idea, but, extending from a stone is something usefull to create a wall and to escape from a contact stone.

I know this method will change a lot but let's begin with a simple idea. If a stone contacts a limiting stone of my color, I will add a couple of points to this one.

For example:

       X
     E0

I am 0 and E is the move I am evaluating. I will add a couple of points to the evaluated move. Maybe a random between 1 and 3.

This is the first approach:

/** * If someone puts a stone that quits a liberty maybe it needs to extend. * @param move The move * @param board The Actual board * @param color The color of the move * @return */ public int extend(int move, Board board, int color){ //this will make that any contact move makes the player extend. boolean trueAdjacent=false; int points=0; Random rand=new Random(); if(board.getMove(move-1)==color){ trueAdjacent=searchAdjacent(move-1,board,1,color); if(trueAdjacent==true){ points=rand.nextInt(4); trueAdjacent=false; } } if(board.getMove(move+1)==color){ trueAdjacent=searchAdjacent(move+1,board,1,color); if(trueAdjacent==true){ points=rand.nextInt(4); trueAdjacent=false; } } if(board.getMove(move+board.getBoardSize()+1)==color){ trueAdjacent=searchAdjacent(move+board.getBoardSize()+1,board,1,color); if(trueAdjacent==true){ points=rand.nextInt(4); trueAdjacent=false; } } if(board.getMove(move-(board.getBoardSize()+1))==color){ trueAdjacent=searchAdjacent(move-(board.getBoardSize()+1),board,1,color); if(trueAdjacent==true){ points=rand.nextInt(4); trueAdjacent=false; } } return points; }
I need to create the searchAdjacent method, so this is what I thought:

/** * Search for x stones adjacents to one stone. * @param move The move * @param board the actual board * @param number The number of stones that are searched * @param color The color of the stone analized * @return returns true is number=number of stones ajacents */ public boolean searchAdjacent(int move, Board board,int number, int color){ boolean adjacents=false; int counter=0; int opponentColor; if(color==1){ opponentColor=2; }else{ opponentColor=1; } if(board.getMove(move+1)==opponentColor){ counter++; } if(board.getMove(move-1)==opponentColor){ counter++; } if(board.getMove(move+board.getBoardSize()+1)==opponentColor){ counter++; } if(board.getMove(move-(board.getBoardSize()+1))==opponentColor){ counter++; } if(counter==number){ adjacents=true; } return adjacents; }
Of course I still did not test this... maybe later.

Day 99: Writing code on blogger

It is hard to post code on blogger, until now I just made some HTML tricks, so I was needing to do something else.

I am trying now BlogTrog, let's try with getGroup method:

/** * Gets all the groups by a color * @param board The board where the game is played * @param color The color that wants to be analyzed. */ public void getGroups(Board board,int color){ Ruleset ruleset=new Ruleset(); ArrayList<Integer> group; ArrayList<Integer> liberties; //Console console=new Console(); for(int i=0;i<board.getMainBoard().size();i++){ if(board.getMove(i)==color){ group=ruleset.getGroup(i, board); liberties=ruleset.getLiberties(group, board); } } }
Wow, it is good. Let's keep it for now.
BlogTrog website

Wednesday, November 7, 2012

Day 90: To Git or not to Git, that is the question

This last days I was thinking if it is a good idea to upload the code to github or something like that. There are some points:

  • The need of sharing code. 
  • I don't want to have in the future 1000's of clones running on KGS like GnuGo, I don't care about people modifying code and uploading them, but why does KGS have only clones? 
  • It will be easier for me to document code. 
  • Will have to read about licences, I will obviously choose some really open licence, but have to read a lot.

If you have more pro/cons, just tell me.

Monday, November 5, 2012

Day 88: Returning and Javadocs

Returning after some days is hard with not well documented code, so, these days I will be doing some javadocs. Here is a video (in spanish)of Javadocs in NetBeans In such a big program is good to have this VERY well documented. This is not the only thing that I will be doing, because on Dec. 15th. this bot will make his first games on KGS. So, I need to work hard.