This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package parser; | |
import java.util.List; | |
public class TokenParser { | |
private static int maxId = 0; | |
private static int idx = 0; | |
private static String nextToken = null; | |
private static List<String> input = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::time::SystemTime; | |
use once_cell::sync::Lazy; | |
fn main() { | |
benchmark("movegen", || { | |
println!("{}", move_gen(8)); | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub const WHITE: usize = 0; // X | |
pub const BLACK: usize = 1; // O | |
pub const FIELD: u32 = 0x1FF << 16; | |
pub const SQUARE: u32 = 0xFFFF; | |
pub const ALL_FIELDS_LEGAL: u32 = 0x1 << 25; | |
pub const DIAGS: [u32; 2] = [0o421, 0o124]; | |
pub const ROWS: [u32; 3] = [0o700, 0o070, 0o007]; | |
pub const COLS: [u32; 3] = [0o111, 0o222, 0o444]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// Main calls Bitboard.moveGen(Bitboard(), depth = 7) | |
class Bitboard(var validField: Int = ALL_FIELDS, var board: Array<IntArray> = arrayOf(IntArray(9), IntArray(9)), var turn: Int = 0) { | |
private var cachedMetaField: IntArray = intArrayOf(-1, -1) | |
private var cachedGameOver: Boolean = false | |
private var cachedMetaFieldDirty = true | |
private var cachedGameOverDirty = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// main.rs | |
use crate::bitboard::Bitboard; | |
mod bitboard; | |
use std::time::SystemTime; | |
fn main() { | |
let board = Bitboard::default(); | |
benchmark("movegen", || { | |
println!("{}", bitboard::move_gen(board, 7)); |