diff options
author | kdx <kikoodx@paranoici.org> | 2023-07-24 13:23:02 +0200 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-07-24 13:23:02 +0200 |
commit | b988b13efdc01a73881c1b24db3c79b3f1df83ee (patch) | |
tree | 0179a69297659e4eae38b577bcdca8d9f6761b2c | |
parent | 5eb3cc4175e788680f7b67ef8648431f2294a025 (diff) | |
download | egecs-b988b13efdc01a73881c1b24db3c79b3f1df83ee.tar.gz |
castle
-rw-r--r-- | egecs.golem | 103 | ||||
-rw-r--r-- | iron.golem | 2 | ||||
-rw-r--r-- | pieces.golem | 4 |
3 files changed, 59 insertions, 50 deletions
diff --git a/egecs.golem b/egecs.golem index 4bc775c..378bdeb 100644 --- a/egecs.golem +++ b/egecs.golem @@ -16,61 +16,70 @@ cls() { } egecs_cycle() { - local from, to; + local from, to, repeat; loop { - board_display(NULL); - col_green(); - from = geadline("> "); - if (white(board_get(from))) - break; - if (from) { - free(from); - from = NULL; + loop { + board_display(NULL); + col_green(); + from = geadline("> "); + if (white(board_get(from))) + break; + if (from) { + free(from); + from = NULL; + } } - } - loop { - board_display(from); - col_green(); - to = geadline("> "); - if ((to != NULL) & (board_get(to) != INVALID) & (white(board_get(to)) == 0)) - break; - if (to) { - free(to); - to = NULL; + loop { + board_display(from); + col_green(); + to = geadline("> "); + if ((to != NULL) & (board_get(to) != INVALID) & (white(board_get(to)) == 0)) + break; + if (to) { + free(to); + to = NULL; + } } + repeat = [to + 2] == '.'; + board_set(to, board_get(from)); + board_set(from, EMPTY); + free(to); to = NULL; + free(from); from = NULL; + if (repeat == 0) + break; } - board_set(to, board_get(from)); - board_set(from, EMPTY); - free(to); to = NULL; - free(from); from = NULL; - loop { - board_display(NULL); - col_red(); - from = geadline("> "); - if (black(board_get(from))) - break; - if (from) { - free(from); - from = NULL; + loop { + board_display(NULL); + col_red(); + from = geadline("> "); + if (black(board_get(from))) + break; + if (from) { + free(from); + from = NULL; + } } - } - loop { - board_display(from); - col_red(); - to = geadline("> "); - if ((to != NULL) & (board_get(to) != INVALID) & (black(board_get(to)) == 0)) - break; - if (to) { - free(to); - to = NULL; + loop { + board_display(from); + col_red(); + to = geadline("> "); + if ((to != NULL) & (board_get(to) != INVALID) & (black(board_get(to)) == 0)) + break; + if (to) { + free(to); + to = NULL; + } } - } - board_set(to, board_get(from)); - board_set(from, EMPTY); - free(to); - free(from); + repeat = [to + 2] == '.'; + board_set(to, board_get(from)); + board_set(from, EMPTY); + free(to); + free(from); + if (repeat == 0) + break; + } } @@ -59,7 +59,7 @@ free_tab(tab) } free(tab); } -define HEAP_SIZE = 0x8000; +define HEAP_SIZE = 0x4000; global heap[HEAP_SIZE] = 0; define PADDING_SIZE = 4; diff --git a/pieces.golem b/pieces.golem index 5952344..7110398 100644 --- a/pieces.golem +++ b/pieces.golem @@ -1,13 +1,13 @@ global str_pieces[16] = 0; init_str_pieces() { [str_pieces + EMPTY] = "□ "; - [str_pieces + (WHITE | KING)] = "♔ "; + [str_pieces + (WHITE | KING)] = "🗿"; [str_pieces + (WHITE | QUEEN)] = "♕ "; [str_pieces + (WHITE | ROOK)] = "♖ "; [str_pieces + (WHITE | BISHOP)] = "♗ "; [str_pieces + (WHITE | KNIGHT)] = "♘ "; [str_pieces + (WHITE | PAWN)] = "♙ "; - [str_pieces + (BLACK | KING)] = "♚ "; + [str_pieces + (BLACK | KING)] = "🤓"; [str_pieces + (BLACK | QUEEN)] = "♛ "; [str_pieces + (BLACK | ROOK)] = "♜ "; [str_pieces + (BLACK | BISHOP)] = "♝ "; |