blob: 3c55146e7e2a3c31d83968fdaaf4a0e5309b370c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#include <stdio.h>
#include <assert.h>
#include "engine/bitboard.h"
#include "engine/moves.h"
#include "fcntl.h"
#include "ipc.c"
#include "logger/logger.h"
struct sqrstr {
char data[2];
};
struct sqrstr sqr_to_str(int i) {
assert(i < 64);
return (struct sqrstr) { .data = {(i / 10) + '0', (i % 10) + '0' } };
}
int main(void) {
mqd_t logging = mq_open("/logs", O_WRONLY);
log_infof("Hello World");
// mqd_t tx = mq_open("/engine_to_server", O_WRONLY);
// mqd_t rx = mq_open("/server_to_engine", O_RDONLY);
//
// while (1) {
// char* x = read_queue(rx);
// log_infof("Engine received: %s", x);
// free(x);
//
// send_queue(tx, "Sending", 8);
//
// moves_t moves = moves_init();
// position_t position = position_starting();
//
// get_moves(&moves, position);
// char buf[128];
// for (int i = 0; i <= moves.length / 32; i++) {
// for (int ii = 0; ii < 32; ii++) {
// if (moves.length <= 4 * i + ii) continue;
// struct sqrstr from_str = sqr_to_str(moves.moves[4 * i + ii].from);
// struct sqrstr to_str = sqr_to_str(moves.moves[4 * i + ii].to);
// buf[4 * ii + 0] = from_str.data[0];
// buf[4 * ii + 1] = from_str.data[1];
// buf[4 * ii + 2] = to_str.data[0];
// buf[4 * ii + 3] = to_str.data[1];
// }
// send_queue(tx, buf, sizeof(buf));
// }
// }
return 0;
}
#include "engine/bitboard.c"
#include "engine/moves.c"
|