Sorry for the slow updates, but @tripunkt we are packed with work for the upcoming pathfinder 2 release.
I decided that it would be interesting to see how hiyace performs in java. Here are the results of my 2hr porting effort on my train ride back to Hamburg:
Positions evaluated: 197281 in 0.912 sec., that's 216347 positions/sec.
That's a whopping 3.6x speed increase compared to the c# implementation :) - wow - I didn't expect this.
some random development and tech stuff that I can't seem to fit anywhere else
Showing posts with label c#. Show all posts
Showing posts with label c#. Show all posts
Friday, September 3, 2010
Thursday, August 5, 2010
small update - search strategy and performance
Thanks to Deutsche Bahn I had an extra hour to do some small improvements on hiyace today. I implemented a minimax-strategy to determine the next move, basically that means the engine makes its assumption on the best possible move based on what it thinks would be the best move its opponent could make or as wikipedia puts it:
"A minimax algorithmis a recursive algorithm for choosing the next move in an n-player game, usually a two-player game. A value is associated with each position or state of the game. This value is computed by means of a position evaluation function and it indicates how good it would be for a player to reach that position. The player then makes the move that maximizes the minimum value of the position resulting from the opponent's possible following moves. If it is A's turn to move, A gives a value to each of his legal moves."
Unfortunately time and computing power are limited, so in reality this will get us a search depth of only a couple of moves in an agreeable amount of time. With an average of 20 different possible moves per ply we get a steep exponential growth that without further optimization results in about 20^n (n = number of plies) positions that have to be evaluated - there definitely is room for improvement, perhaps Alpha-beta pruning will give us some edge her.
To get an idea what that means performance-wise, I have programmed a small benchmarking utility, that delivers the following results (note that absolutely no code-optimization has been done so far) on my machine (Core2Duo, 2,4 GHz, currently utilizing only one core):
Please be patient...
10 ########################
09 ########################
08 ####RbNbBbQbKbBbNbRb####
07 ####PbPbPbPbPbPbPbPb####
06 ####................####
05 ####................####
04 ####................####
03 ####................####
02 ####PwPwPwPwPwPwPwPw####
01 ####RwNwBwQwKwBwNwRw####
00 ########################
01 ########################
# # A B C D E F G H # #
Positions evaluated: 197281 in 00:00:03.2921186, that's 59925 positions/sec.
hit Enterto quit...
Please be patient...
10 ########################
09 ########################
08 ####RbNbBbQbKbBbNbRb####
07 ####PbPbPbPbPbPbPbPb####
06 ####................####
05 ####................####
04 ####................####
03 ####................####
02 ####PwPwPwPwPwPwPwPw####
01 ####RwNwBwQwKwBwNwRw####
00 ########################
01 ########################
# # A B C D E F G H # #
Positions evaluated: 197281 in 00:00:03.2921186, that's 59925 positions/sec.
hit Enter
Subscribe to:
Posts (Atom)