rename base.h -> engine.h and fix bugs in codegen

This commit is contained in:
2025-12-19 04:19:00 +01:00
parent abb32d118a
commit 66feaab027
6 changed files with 10 additions and 6 deletions

View File

@@ -30,5 +30,5 @@ mbb_rook.h: codegen
mbb_bishop.h: codegen mbb_bishop.h: codegen
./codegen ./codegen
tests: tests.c mbb_rook.h mbb_bishop.h base.h tests: tests.c mbb_rook.h mbb_bishop.h engine.h
$(CC) -o $@ $(CFLAGS) tests.c $(CC) -o $@ $(CFLAGS) tests.c

View File

@@ -1,5 +1,7 @@
#define CODEGEN #define CODEGEN
#include "base.h" #include "engine.h"
#include "libc-lite.h"
#include "board_print.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@@ -64,7 +66,7 @@ int main()
/* brute force the magic number */ /* brute force the magic number */
for (;;) { for (;;) {
bitboard magic = rand64() & rand64() & rand64(); bitboard magic = my_rand64() & my_rand64() & my_rand64();
bitboard atk = 0ULL; bitboard atk = 0ULL;
for (bitboard test = 0; test < (1ULL<<rook_relevant_bits_count); test++) { for (bitboard test = 0; test < (1ULL<<rook_relevant_bits_count); test++) {
@@ -120,7 +122,7 @@ int main()
/* brute force the magic number */ /* brute force the magic number */
bitboard magic = 0ULL; bitboard magic = 0ULL;
for (;;) { for (;;) {
magic = rand64() & rand64() & rand64(); magic = my_rand64() & my_rand64() & my_rand64();
bitboard atk = 0ULL; bitboard atk = 0ULL;
for (bitboard test = 0; test < (1ULL<<bishop_relevant_bits_count); test++) { for (bitboard test = 0; test < (1ULL<<bishop_relevant_bits_count); test++) {

View File

View File

@@ -1,4 +1,6 @@
#pragma once
#include <limits.h> #include <limits.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>

View File

@@ -2,7 +2,7 @@
#define _XOPEN_SOURCE 500 #define _XOPEN_SOURCE 500
#include <unistd.h> /* usleep */ #include <unistd.h> /* usleep */
#include "base.h" #include "engine.h"
#include "board_print.h" #include "board_print.h"
#include <stdio.h> #include <stdio.h>

View File

@@ -1,5 +1,5 @@
#include "base.h" #include "engine.h"
#include <stdint.h> #include <stdint.h>