summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaume Delclòs Coll <cosa@cosarara.me>2024-05-08 13:08:47 +0000
committerJaume Delclòs Coll <cosa@cosarara.me>2024-05-08 13:08:47 +0000
commit4e61d1e8c83b92a0e5f791cc9ca9e968447261b5 (patch)
treee37078ea911a5b9dde0650a6250afc1f9385a335
parent700a054974068b7cc886e3d0a4701eddcbdc59cb (diff)
promotion to queen
-rw-r--r--chess.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/chess.c b/chess.c
index b6c6671..ecf46fe 100644
--- a/chess.c
+++ b/chess.c
@@ -6,7 +6,7 @@
#include <keyboard.h>
// Missing features
-// promotion
+// underpromotion
// display checkmate and stalemate
// arrows to go back and forward in history
// show moves better
@@ -275,6 +275,12 @@ do_move(int board[8][8], Point src, Point dst, MoveType move_type) {
}
BRDPT(victim) = empty;
}
+ if (move_type == Normal && BRDPT(dst) == bP && dst.y == RANK(1)) {
+ BRDPT(dst) = bQ;
+ }
+ if (move_type == Normal && BRDPT(dst) == wP && dst.y == RANK(8)) {
+ BRDPT(dst) = wQ;
+ }
Point rook_src, rook_dst;
switch (move_type) {
case BlackLongCastle: