Search

Showing posts with label go board. Show all posts
Showing posts with label go board. Show all posts

Tuesday, August 20, 2013

Creating a go program, day 6

Well, there are 2 videos I didn't add to the blog, here is the one for day 6, some Data was added that day in a class that will content all the "constants" of the program.


Friday, August 16, 2013

Evil Tesuji, day 3, Board representation

Me again in video! I took ideas from my old posts about board representation and compiled them in the video:



Well, I think that this video log is a good idea, right now I am more concentrated on the program.

Tuesday, December 4, 2012

Day 117: Readers always are right

On my day 99 post, a reader, Steve, pointed at something that is right. I am using a lot up, down, left and right, so, it is better to create methods for that. I will create them in board class.

public int up(int move){ int play; play=this.getMove(move-this.getBoardSize()+1); return play; } public int down(int move){ int play; play=this.getMove(move+this.getBoardSize()+1); return play; } public int left(int move){ int play; play=this.getMove(move-1); return play; } public int right(int move){ int play; play=this.getMove(move+1); return play; }

Thursday, October 11, 2012

Day 63: Some fuseki things II -San San-

Forget what I posted yesterday about san san, that was all wrong, let's supose again (but according to the array) the 9x9 board:

00 01 02 03 04 05 06 07 08 09
10 11 12 13 14 15 16 17 18 19

20 21 22 23 24 25 26 27 28 29
30 31 32 33 34 35 36 37 38 39

40 41 42 43 44 45 46 47 48 49
50 51 52 53 54 55 56 57 58 59

60 61 62 63 64 65 66 67 68 69
70 71 72 73 74 75 76 77 78 79

80 81 82 83 84 85 86 87 88 89
90 91 92 93 94 95 96 97 98 99
00 01 02 03 04 05 06 07 08 09 10

San San points are 33,37,73 and 77

I can say that point 33 can be reached by the formula (n+1)*3+3 (n is the size in this case 9)= 33.
Point 37 can be reached with formula (n+1)*4-3.

Point 73 can be reached with formula (n+1)*(n-2)+3= 10*7+3=73.
Point 77 can be reached with formula (n+1)*(n-1)-3= 10*8-3=77.

Now, let's see if this works for other sizes:

In a 6x6 board:

00 01 02 03 04 05 06
07 08 09 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 32 33 34
35 36 37 38 39 40 41
42 43 44 45 46 47 48
49 50 51 52 53 54 55 56

San san points are: 24, 25, 31 and 32 (a square in the board).

(n+1)*3+3 = 7*3+3=24
(n+1)*4-3 = 7*4-3=25
(n+1)*(n-2)+3 = 7*4+3=31
(n+1)*(n-1)-3 = 7*5-3=32

In 19x19 San san points (yes, yo lazy to "draw" the board) are 63, 77, 343 and 357


(n+1)*3+3 = 20*3+3=63
(n+1)*4-3 = 20*4-3=77
(n+1)*(n-2)+3 = 20*17+3=343
(n+1)*(n-1)-3 = 20*18-3=357


Right now I think this will work.

So, I will make a method in a class "ShapeRecognizer" called sanSan.





public boolean sansan(int move,Board board){

        boolean isSanSan=false;

        Translator translator=new Translator();

        int n=board.getBoardSize();

        if(move==(n+1)*3+3 || move==(n+1)*4-3 || move==(n+1)*(n-2)+3 || move==(n+1)*(n-1)-3){

            isSanSan=true;

        }

        return isSanSan;

    }






I know is not the best way to do it, but, with time and complexity this will change.

Let's see the result:


Saturday, September 1, 2012

Day 24: Stupid errors, the most common and hard.



I really think that the stupid errors the most obvious are sometimes the hardest to find and correct. In the old days a ";" were a problem and now some "logic" errors in big messes are a big deal. As I said I was changing all the main loop (and will change more things to organize and make code clearer) and implementing GTP commands. When I ran the program using GoGui it sent me inexistent positions in the board and when I ran the program using my console the result was good. After a lot of research of "what the hell is going on", the error was that I implemented the clear board command using boardInitialize of my board class and it added more positions to the arrayList. So, now I can play with goGui randomly and not using the suicide rule.

Thursday, August 23, 2012

Day 15: Killing groups


Now that the engine can see groups and count liberties (and see where are the liberties), the obvious step is to see if a group is killed. Basically when someone plays the board will look using the ruleset if any group have 0 liberties. If it is the case, all those positions becomes empty (value of the position = 0), and the number of dead stones should increase to a "dead stones" variable for the outsider or the engine.

This is the "search for liberties" method (I didn't publish it yesterday, you have it now):



I need a new method in the ruleset that analizes a group and if it have 0 liberties will return true. Else will return false.




And, the board should be the responsible of killing the stones. So, in the board class, I create a method that given a color It should see if there is any group without liberties:



And the last step: in the main board, when someone plays something (that is not "pass" or "resign") it should first see if there is something dead for the opposite color that is played and kill it.

Friday, August 17, 2012

Day 9: Midnight reflection.


Midnight, I can't sleep, my go sucks, barely won my third game, and because my opponent mada a big mistake (bigger than all the mistakes I made). Well, a list of things for the future days:


  1. Send the possibleMoves method to the rules (and then delete Actors class).
  2. Start saving all the moves done in the game and show them in the console class. Right now some println are in the main loop.
  3. Start searching for groups.
  4. When I can find groups, I need to count liberties.
  5. If liberties=0 then kill.
  6. KO.
  7. Eyes (?)
  8. GTP.
  9. Seki
  10. Montecarlo.
  11. Conquer the world.
A video about computer go:


Saturday, August 11, 2012

Day 3: Changes in board...


While I was thinking how to start with the engine I saw that some changes were needed. For example, I need a Board object for the engine, but at start I don't know the size of the board, so I created an empty constructor and then I assign the board that the game flow uses. A good idea (maybe, I am not sure yet, but let's believe in intuition), was to quit the board initializacion from the parametrized constructor, so I created a method boardInitialization(int). It is now like this:
Another thing that I changes was the main class. The game loop should not be in the main class, the main class only calls a "game loop" class, so now I have gameLoop class. And main now is this: