Search
Showing posts with label rules. Show all posts
Showing posts with label rules. Show all posts
Thursday, December 20, 2012
Day 132: More refactoring
One more thing that I won't need anymore: The tryToKill method called in the main loop. It will be easier for me if in the setMove method I kill the stones.
This will make me do more refactoring: Suicidal rule will change to.
Labels:
baduk,
computer go,
design,
go,
main loop,
programming,
rules,
weiqi
Wednesday, December 19, 2012
Day 131: 0.01G
Ok, this is changing fast. I am refactoring a lot. So, this is what I think now:
- The array with the game moves should be in a new class Game. It will be easier to make reference to the game moves if all the methods that manipulate the game array are there.
- I Created a new package for rules. Every rule will have a class, it is for the future. Some things should change when the engine finds a ko or a suicide.
- Some old code that I commented is now deleted.
I found console class (Good bye console!!!!!)
Labels:
baduk,
computer go,
design,
go,
igo,
ko,
programming,
rules,
weiqi
Thursday, December 13, 2012
Day 125: Starting with 0.01F
Some things that I am seeing:
- There were some variables from the pre-gtp era like a hardcoded humanColor and engineColor. With gtp it is not needed, The engine should know what to do in a given circumstance with any color.
- Engine should have an array with the moves of the game, I think this will give me more things to analize.
Getting the engine play better:
- Will start to try to make the computer see basic eyespace.
- Some things about corners.
- More about jumps. ->Will try jumps to the center.
Saturday, October 13, 2012
Day 65: L&D I
Let's begin with the most basic thing about Life and Death: Prevention of an atari.
The first approach that I see (I will correct it as long as I think of it) is:
Look at the positions that limit the stone.
If some of them have a stone of the same color, see how many liberties have that group.
If the group have 1 liberty, add that stone and count the liberties again.
If still have 1 liberty quit points, else add points.
This is a very bad approach, but I can evolve from this I think (maybe I am wrong, but... let's try).
NOTE: Ok... while trying this, a wild bug appeared! A suicidal stone was played. Do not know if this happened because the new code ruins all or if there was always that bug.
The first approach that I see (I will correct it as long as I think of it) is:
Look at the positions that limit the stone.
If some of them have a stone of the same color, see how many liberties have that group.
If the group have 1 liberty, add that stone and count the liberties again.
If still have 1 liberty quit points, else add points.
This is a very bad approach, but I can evolve from this I think (maybe I am wrong, but... let's try).
NOTE: Ok... while trying this, a wild bug appeared! A suicidal stone was played. Do not know if this happened because the new code ruins all or if there was always that bug.
Labels:
baduk,
board,
computer go,
design,
engine,
frustrating,
LifeAndDeath,
problems,
programming,
rules,
weiqi
Monday, September 10, 2012
Day 33: Implementing suicide, the hard part is comming
Sorry my programming is a little slow now, but I am adapting myself to be a father and this is a hard job (but the best one). These days I will post more and will increase productivity.
Last time I made a "Suicide Rule method". Now is time to implement it. The boolean possibleMove will be back to false after verifying ko rule (well, it can be in false when reaches this part, but who knows...). Then possibleMove=isSuicide(bla bla bla). If true, the move is not playable.
With this, rules about possible moves are over. Now I have to make the program understand "eyes", "territory", "points" and all this... The hard part is comming.
Thursday, September 6, 2012
Day 29: Suicidal rule
Until now I was filtering possible moves by two things:
Maybe tomorrow I will continue coding, or today if I have some time (I wish I can).
- Spaces with a 0 (Empty)
- There is no Ko
But, there are other spaces that could be not allowed to be played, let's see suicidal rule:
In most common ruleset, suicide is forbidden, so for now it will be for my program (maybe some day I will do something for the other rulesets).
So, there is how I will implement it:
- The number of liberties of the group if I play this move == 0?
- If not, move is allowed
- if yes, try to kill groups of the other color.
- If kills, move is allowed
- if not, this is a suicide move and can't be played.
I just created a method to see if a move is suicide (this is my first aproach, not tested yet):
Maybe tomorrow I will continue coding, or today if I have some time (I wish I can).
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.
Friday, August 24, 2012
Day 16: Ko, part III
Well, something like a ko was implemented in the program, but still couldn't test it.
First I changed tryToKill from void to integer and return number of killed stones:
Thursday, August 23, 2012
Day 15: KO. Part I
This is starting to get hard... And I know that this will be a lot harder...
Definition of KO
The program now can see groups, liberties, kill stones, etc. I think I am able to program the rule of ko. But, what is ko? Let's see...According to KGS:
The ko rule says that you can never make a capture that brings the board right back to where it was before
Here is a little example:
Here, black and white can retake a stone forever, if there is no ko rule. So, if black takes a stone, white should wait a turn to recapture.
Ideas to implement KO
First thing I notice, this is about repetition of positions, so a copy of the board for the last move of every color should be saved. Then if there is a capture of a stone a ko method should be activated to see if there is a move that repeats the saved board.
So, once this method is created it should be something like this:
- x plays.
- The board for x is saved.
- y plays and captures
- The board for y is saved.
- The program looks at all the possible moves (positions where value==0).
- the program verifies that playing a move doesn't repeat the board for x.
- If that returns false the move is kept in possible moves, else it is discarded.
- 6 and 7 are repeated for all the possible moves.
- An array with all the possible moves is returned.
In the next post... CODING!
Subscribe to:
Posts (Atom)





