move input whitch predikt

This commit is contained in:
vova-rs committed 2026-10-15 20:51:29 +03:00
1 parent 2c2ccd6770
commit 27fd785034
3 files changed
+112 -25

No files matched your search

+20 -20
View File
@@ -1,4 +1,4 @@
#[derive(Clone, Copy)]
pub enum BoardColor {
Solid(char),
Checkerboard(char, char),
@@ -21,29 +21,29 @@ pub fn render_u64(a: u64) {
pub fn render_board(background: BoardColor, layers: Vec<(u64, char)>){
let mut p: u64 = 1 << 56;
for y in 0..8 {
for x in 0..8 {
if let Some((_, ch)) = layers.iter().find(|(a, _)| (p << x as u64) & a > 0) {
print!("{}", ch)
} else {
match background {
BoardColor::Solid(a) => {
pub fn render_board_row(background: BoardColor, layers: &[(u64, char)], row: u8) {
let p: u64 = 1 << 56 >> (row as u64 * 8);
for x in 0..8 {
if let Some((_, ch)) = layers.iter().find(|(a, _)| (p << x as u64) & a > 0) {
print!("{}", ch)
} else {
match background {
BoardColor::Solid(a) => print!("{}", a),
BoardColor::Checkerboard(a, b) => {
if (x + row as usize) % 2 == 0 {
print!("{}", a)
},
BoardColor::Checkerboard(a, b) => {
if (x + y) % 2 == 0 {
print!("{}", a)
} else {
print!("{}", b)
}
} else {
print!("{}", b)
}
}
}
}
p = p >> 8;
print!("\n")
}
print!("\n");
}
pub fn render_board(background: BoardColor, layers: &[(u64, char)]) {
for row in 0..8 {
render_board_row(background.clone(), layers, row);
}
}