| View previous topic :: View next topic |
| Author |
Message |
Sven Schüle
Joined: 15 May 2008 Posts: 2244 Location: Berlin, Germany
|
Post subject: Re: Project help required: Bitboard Fruit 2.1 Posted: Thu May 10, 2012 11:06 pm |
|
|
| ZirconiumX wrote: |
Ten quick tests aborted early becuase the bitboard version lost. Badly. (-3 =0 +0)
I am really confused. |
Again, I suggest to implement a "perft" function (original Fruit does not have it yet) and find the move generator bugs.
This is an example of a "perft" implementation for Fruit which I wrote:
| Code: |
// perft.cpp
#include "attack.h"
#include "board.h"
#include "colour.h"
#include "list.h"
#include "move.h"
#include "move_check.h"
#include "move_do.h"
#include "piece.h"
#include "search.h"
#include "sort.h"
#include "util.h"
uint64 perft(board_t * board, int depth, int height)
{
int trans_move;
uint64 nLeaves;
int move;
attack_t attack[1];
sort_t sort[1];
undo_t undo[1];
ASSERT(board!=NULL);
ASSERT(depth_is_ok(depth));
ASSERT(board_is_legal(board));
// init
SearchCurrent->node_nb++;
SearchInfo->check_nb--;
if (depth == 0) return 1;
// more init
attack_set(attack,board);
// move generation
trans_move = MoveNone;
sort_init(sort,board,attack,depth,height,trans_move);
// move loop
nLeaves = 0;
while ((move=sort_next(sort)) != MoveNone) {
// recursive search
move_do(board,move,undo);
nLeaves += perft(board, depth - 1, height + 1);
move_undo(board,move,undo);
}
return nLeaves;
}
uint64 perft_root(list_t * list, board_t * board, int depth, int height)
{
uint64 nLeaves;
int move;
int i;
attack_t attack[1];
undo_t undo[1];
ASSERT(list_is_ok(list));
ASSERT(board!=NULL);
ASSERT(depth_is_ok(depth));
ASSERT(list==SearchRoot->list);
ASSERT(board==SearchCurrent->board);
ASSERT(board_is_legal(board));
// init
SearchCurrent->node_nb++;
SearchInfo->check_nb--;
if (depth == 0) return 1;
// more init
attack_set(attack,board);
// move loop
nLeaves = 0;
for (i = 0; i < LIST_SIZE(list); i++) {
move = LIST_MOVE(list,i);
// recursive search
move_do(board,move,undo);
nLeaves += perft(board, depth - 1, height + 1);
move_undo(board,move,undo);
}
return nLeaves;
} |
| Code: |
// perft.h
#ifndef PERFT_H
#define PERFT_H
// includes
#include "util.h"
// forward declarations
struct board_t;
// functions
extern uint64 perft_root(list_t * list, board_t * board, int depth, int height);
#endif // !defined PERFT_H
// end of perft.h |
| Code: |
// protocol.cpp
// ...
#include "perft.h"
#include "move_gen.h"
#include "sort.h"
// ...
// loop_step()
// ...
} else if (string_start_with(string,"perft ")) {
const char * ptr = strtok(string," "); // skip "perft"
ptr = strtok(NULL," ");
int depth = atoi(ptr);
SearchCurrent->node_nb = 0;
send("starting perft(%d)", depth);
// SearchInput
gen_legal_moves(SearchInput->list,SearchInput->board);
// SearchRoot
list_copy(SearchRoot->list,SearchInput->list);
// SearchCurrent
board_copy(SearchCurrent->board,SearchInput->board);
my_timer_reset(SearchCurrent->timer);
my_timer_start(SearchCurrent->timer);
sort_init();
// standard sort
list_note(SearchRoot->list);
list_sort(SearchRoot->list);
uint64 nLeaves = perft_root(SearchRoot->list,SearchCurrent->board, depth, 0);
my_timer_stop(SearchCurrent->timer);
search_update_current();
send("perft(%d)=%I64u, %I64u nodes, time=%.3f",
depth, nLeaves, SearchCurrent->node_nb, my_timer_elapsed_real(SearchCurrent->timer));
} |
It is possible that I did something wrong. But with the implementation above I get:
| Code: |
perft(2)=320 .....
perft(3)=4758 .....
perft(4)=71813 .....
perft(5)=1011120 .....
perft(6)=14463120 ..... |
for the start position which is clearly wrong (way too low).
I used the same "perft" for the original Fruit, it produces the correct numbers for the start position. So there must be a problem in your move generator changes or your make/unmake move changes.
Sven |
|
| Back to top |
|
 |
|
| Subject |
Author |
Date/Time |
Project help required: Bitboard Fruit 2.1 |
Matthew R. Brades |
Tue May 08, 2012 3:20 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Robert Hyatt |
Tue May 08, 2012 3:31 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Matthew R. Brades |
Tue May 08, 2012 5:06 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Ronald de Man |
Tue May 08, 2012 6:43 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Evert Glebbeek |
Tue May 08, 2012 8:34 pm |
Re: Project help required: Bitboard Fruit 2.1 |
H.G.Muller |
Tue May 08, 2012 8:41 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Tue May 08, 2012 8:43 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Tue May 08, 2012 10:09 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Ronald de Man |
Tue May 08, 2012 10:15 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Tue May 08, 2012 10:21 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Ronald de Man |
Tue May 08, 2012 10:59 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Wed May 09, 2012 11:33 am |
Re: Project help required: Bitboard Fruit 2.1 |
Robert Hyatt |
Sun May 13, 2012 5:11 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Sun May 13, 2012 10:13 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Robert Hyatt |
Mon May 14, 2012 2:17 am |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Mon May 14, 2012 10:19 am |
Re: Project help required: Bitboard Fruit 2.1 |
H.G.Muller |
Mon May 14, 2012 10:53 am |
Re: Project help required: Bitboard Fruit 2.1 |
Mincho Georgiev |
Mon May 14, 2012 12:19 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Mon May 14, 2012 12:28 pm |
Re: Project help required: Bitboard Fruit 2.1 |
H.G.Muller |
Mon May 14, 2012 3:10 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Mon May 14, 2012 4:25 pm |
Re: Project help required: Bitboard Fruit 2.1 |
H.G.Muller |
Mon May 14, 2012 4:34 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Mon May 14, 2012 4:46 pm |
Re: Project help required: Bitboard Fruit 2.1 |
H.G.Muller |
Mon May 14, 2012 5:05 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Mon May 14, 2012 8:51 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Robert Hyatt |
Mon May 14, 2012 10:43 pm |
Re: Project help required: Bitboard Fruit 2.1 |
H.G.Muller |
Tue May 15, 2012 5:41 am |
Re: Project help required: Bitboard Fruit 2.1 |
Matthew R. Brades |
Tue May 15, 2012 2:45 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Matthew R. Brades |
Tue May 15, 2012 4:04 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Evert Glebbeek |
Tue May 15, 2012 4:41 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Robert Hyatt |
Mon May 14, 2012 10:41 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Mincho Georgiev |
Mon May 14, 2012 6:22 am |
Re: Project help required: Bitboard Fruit 2.1 |
Robert Hyatt |
Sun May 13, 2012 5:09 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Ronald de Man |
Tue May 08, 2012 10:11 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Tue May 08, 2012 10:18 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Robert Hyatt |
Sun May 13, 2012 5:14 pm |
Re: Project help required: Bitboard Fruit 2.1 |
H.G.Muller |
Sun May 13, 2012 6:35 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Matthew R. Brades |
Sun May 13, 2012 8:24 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Sun May 13, 2012 10:22 pm |
Re: Project help required: Bitboard Fruit 2.1 |
H.G.Muller |
Mon May 14, 2012 6:56 am |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Sun May 13, 2012 10:18 pm |
Re: Project help required: Bitboard Fruit 2.1 |
H.G.Muller |
Tue May 08, 2012 4:12 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Lucas Braesch |
Wed May 09, 2012 5:01 am |
Re: Project help required: Bitboard Fruit 2.1 |
Lucas Braesch |
Wed May 09, 2012 5:13 am |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Wed May 09, 2012 11:35 am |
Re: Project help required: Bitboard Fruit 2.1 |
Matthew R. Brades |
Wed May 09, 2012 2:50 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Matthew R. Brades |
Wed May 09, 2012 2:57 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Wed May 09, 2012 3:27 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Matthew R. Brades |
Thu May 10, 2012 1:32 pm |
Re: Project help required: Bitboard Fruit 2.1 |
H.G.Muller |
Thu May 10, 2012 2:47 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Matthew R. Brades |
Thu May 10, 2012 3:11 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Matthew R. Brades |
Thu May 10, 2012 3:14 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Thu May 10, 2012 11:06 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Matthew R. Brades |
Fri May 11, 2012 10:14 am |
Re: Project help required: Bitboard Fruit 2.1 |
H.G.Muller |
Fri May 11, 2012 10:28 am |
Re: Project help required: Bitboard Fruit 2.1 |
Lucas Braesch |
Fri May 11, 2012 11:26 am |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Sat May 12, 2012 2:06 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Matthew R. Brades |
Sat May 12, 2012 3:54 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Evert Glebbeek |
Sat May 12, 2012 4:20 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Matthew R. Brades |
Sat May 12, 2012 5:00 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Matthew R. Brades |
Sat May 12, 2012 5:15 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Sat May 12, 2012 5:32 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Sat May 12, 2012 8:54 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Sven Schüle |
Sat May 12, 2012 5:21 pm |
Re: Project help required: Bitboard Fruit 2.1 |
H.G.Muller |
Thu May 10, 2012 3:25 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Matthew R. Brades |
Thu May 10, 2012 3:06 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Ronald de Man |
Thu May 10, 2012 6:42 pm |
Re: Project help required: Bitboard Fruit 2.1 |
Lucas Braesch |
Thu May 10, 2012 10:51 am |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|