diff options
Diffstat (limited to 'sirtet.c')
-rw-r--r-- | sirtet.c | 39 |
1 files changed, 0 insertions, 39 deletions
@@ -1,5 +1,4 @@ #include <stdlib.h> -#include <stdio.h> #include <stdbool.h> #include <time.h> #include <locale.h> @@ -53,44 +52,6 @@ void clearfull(char** map, int mapH, int mapW) { free(cols_to_clear); } -bool placeable(char** map, struct piece* pc, int row, int col, int mapH, int mapW) { - // boundary check - if (row < 0 || row + (pc->h) > mapH || col < 0 || col + (pc->w) > mapW) - return false; - - // check if blocks to be taken by `pc` are vacant - for (int r = 0; r < pc->h; r++) { - for (int c = 0; c < pc->w; c++) { - if (map[row + r][col + c] == '+' && pc->blocks[r * pc->w + c] == '+') - return false; - } - } - - return true; -} - -void place(char** map, struct piece* pc, int row, int col) { - for (int r = 0; r < pc->h; r++) { - for (int c = 0; c < pc->w; c++) { - if (pc->blocks[r * (pc->w) + c] == '+') - map[row + r][col + c] = '+'; - } - } -} - -void freepiece(struct piece* pc) { - free(pc->blocks); - free(pc); -} - -void refillpieces(struct piece** hand, int nhand) { - // randomly select `no` pieces from `pool` to `hand` - // capacities of `hand` and `pool` are `nhand` and `npool` resp. - for (int i = 0; i < nhand; i++) { - hand[i] = randpiece(); - } -} - void sirtet() { const int H = 8; // canvas height const int W = 8; // canvas width |