Search

Friday, September 28, 2012

Day 51: More code deleted and state


As I said some days before, "human" class didn't have any more sense in the program. Now I saw that "console" class have the same problem. The only console I need is the gtp console, so console class can be out of here (but I will make a backup of the class, just in case some day for some weird reason I want to add a parameter to show the game in console).

Now, this is how classes are right now:


So, one part of the boring update is on, now, let's continue logging. Next post will have a log.


Thursday, September 27, 2012

Day 50: Back to work!

After some days without touching code, I am back!


Now is time for some boring work:


  • Log everything in the system. I just want that all what the machine "thinks" keeps logged. That is because it is hard to find bugs in another way. 
  • Redo the class draw. I really love coding and sometimes being a lot analyzing how it should work is boring. BUT NEEDED.

Tuesday, September 18, 2012

Day 41: Deleting unused code

A lot of things changed when I decided to use GTP. Human class is not needed anymore, so I am deleting it.  I had lots of problems with code, so these days I made some changes, reorganized and fixed some bugs.

I am slow nowadays, raising a baby, working and returning to university having 34 years is hard, but I promise that in 2 days I will be back with more computer go.

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:


  • 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:

  1. The number of liberties of the group if I play this move == 0?
  2. If not, move is allowed
  3. if yes, try to kill groups of the other color.
  4. If kills, move is allowed
  5. 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). 

Monday, September 3, 2012

Day 26: Logging


To see if all what I want to control on the engine is working the way I like, I need to log all that it does. This is the first approach to this:

Important: In Windows 7 you need to run GoGui in Administrator Mode.
I made methods to:


  1. Log any String I want.
  2. Log the date and time
  3. Log the board as it is in the moment.

 

I have to make some changes but the basic idea works. Now I can delete console class and replace it with this.

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.

Day 24: The reason of my absence.

Four days without appearing here! I had the best time of my life, my first Daughter was born. Right now I feel like the happiest man on the world, she is the most beautiful baby I've ever seen. This is a short post because I don't have the words to describe how happy am I.