summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-07-24 13:23:02 +0200
committerkdx <kikoodx@paranoici.org>2023-07-24 13:23:02 +0200
commitb988b13efdc01a73881c1b24db3c79b3f1df83ee (patch)
tree0179a69297659e4eae38b577bcdca8d9f6761b2c
parent5eb3cc4175e788680f7b67ef8648431f2294a025 (diff)
downloadegecs-b988b13efdc01a73881c1b24db3c79b3f1df83ee.tar.gz
castle
-rw-r--r--egecs.golem103
-rw-r--r--iron.golem2
-rw-r--r--pieces.golem4
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;
+ }
}
diff --git a/iron.golem b/iron.golem
index 997c70e..0f4e3cf 100644
--- a/iron.golem
+++ b/iron.golem
@@ -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)] = "♝ ";