add pet to queen transformation
authorLaurent Mazet <mazet@softndesign.org>
Thu, 4 Jul 2024 22:35:29 +0000 (00:35 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Thu, 4 Jul 2024 22:35:29 +0000 (00:35 +0200)
c.chk [new file with mode: 0644]
checkers.c
function.c
function.h

diff --git a/c.chk b/c.chk
new file mode 100644 (file)
index 0000000..c19f331
--- /dev/null
+++ b/c.chk
@@ -0,0 +1,4 @@
+width: 10
+height: 10
+tab: " . 0 0 0 01 0 0 0 0  0 0 0 0 .0 0 . . 0  . . 0 0 0. 1 1 1 .  . 1 . . 11 1 1 1 .  1 1 1 1 01 1 1 1 . "
+turn: 1
index 001c45367e847638998783b390a31d5b2226110d..86b9759db4af60ed4bf758b32252fdb7764a30fb 100644 (file)
@@ -344,6 +344,7 @@ int main (int argc, char *argv[])
                 player = (player == 0) ? 1 : 0;
                 emptycache (cache);
                 cleanafterjump (board);
+                pettoqueen (board);
                 mode = 0;
             }
             break;
index 75b353883dd94e22237a71e9fc3099c37153eaf2..0d02412520c6e0966c44c7e121cc66790cfce4de 100644 (file)
@@ -340,6 +340,22 @@ void cleanafterjump (board_t *board)
     }
 }
 
+void pettoqueen (board_t *board)
+{
+    int i;
+    char *cell = NULL;
+    for (i = 0; i < board->width; i++) {
+        cell = getcell (board, i, board->height - 1);
+        if (*cell == '0') {
+            *cell = '6';
+        }
+        cell = getcell (board, i, 0);
+        if (*cell == '1') {
+            *cell = '7';
+        }
+    }
+}
+
 int testjump (board_t *board, int x, int y, int mode)
 {
     int ret = 0;
index 74f2ff93e5054254a361edd29e526800510646dc..f72e8ef06481bd89fa381c56bbe5ad65489e9c05 100644 (file)
@@ -47,6 +47,8 @@ void dopetmove (board_t *board, int *x, int *y, int mode);
 
 void cleanafterjump (board_t *board);
 
+void pettoqueen (board_t *board);
+
 int testjump (board_t *board, int x, int y, int mode);
 
 int testalljumps (board_t *board, int x, int y);