~macaptain/lkdo-chess

ref: db758ae9dc6301925efe5a32632a557092967656 lkdo-chess/src/main.zig -rw-r--r-- 1.0 KiB
db758ae9Michael Captain Add functions for basic bitboard ops and printing the bitboard 10 months ago
                                                                                
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
const std = @import("std");
const board = @import("board.zig");

const VERSION = "0.0.1";

fn uciLoop() !void {
    const stdin = std.io.getStdIn().reader();
    const stdout = std.io.getStdOut().writer();
    var line_buf: [2000]u8 = undefined;
    while (true) {
        const uci_in = (try stdin.readUntilDelimiterOrEof(line_buf[0..], '\n'));
        if (uci_in == null) {
            return;
        } else if (std.mem.eql(u8, uci_in.?, "uci")) {
            try stdout.print("id name LKDO v{s}\n", .{VERSION});
            try stdout.print("id author macaptain\n", .{});
            try stdout.print("uciok\n", .{});
        } else if (std.mem.eql(u8, uci_in.?, "quit")) {
            return;
        } else if (std.mem.eql(u8, uci_in.?, "isready")) {
            try stdout.print("readyok\n", .{});
        }
    }
}

pub fn main() !void {
    //try uciLoop();
    var bitboard: u64 = 0;
    bitboard = board.setBit(bitboard, board.Square.e4);
    bitboard = board.setBit(bitboard, board.Square.d5);
    board.printBitboard(bitboard);
}