/*
* Test board mask calculation functions.
* Copyright © 2022-2023 Nick Bowler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
#include
#include "game.h"
enum { display_width = 12 };
static void show_patterns(const char *name, uint_fast32_t func(int))
{
unsigned long vals[5];
int i, row, labelw = display_width;
for (i = 0; i < 5; i++) {
printf("%*s", display_width-labelw, "");
labelw = printf("%2s(%d)", name, i);
vals[i] = func(i);
}
putchar('\n');
for (row = 0; row < 5; row++) {
putchar(' ');
for (i = 0; i < 25; i++) {
unsigned long val;
val = vals[i/5];
vals[i/5] >>= 1;
if (i && i % 5 == 0)
printf("%*s", display_width-5, "");
putchar(val & 1 ? '@' : '.');
if (i == 24)
putchar('\n');
}
}
}
int main(void)
{
show_patterns("left", board_left);
putchar('\n');
show_patterns("right", board_right);
putchar('\n');
show_patterns("above", board_above);
putchar('\n');
show_patterns("below", board_below);
return 0;
}