Basic Chess Engine (unsmart bot)

I created a basic chess platform you can use.

Now I will try creating a bot to play against.
Keyword: try

Edit:

Update Log

2026-04-27T21:10:00Z - Published the project. You can move any piece whenever you want. Their are no turns, castling, checks, checkmate, stalemate, or en passant.

2026-04-27T21:15:00Z - Implemented turns. Once white moves a piece, they can no longer move, black must make their move.

2026-04-28T10:28:00Z - Implemented check detection. If you try to move a piece that puts or keeps your king in check, it will not let you. Therefore, you cannot move any piece if you are in checkmate (yet!).

2026-04-28T13:03:00Z - Implemented checkmate detection. If you try moving into check 5 times in a row, the program will check if your king if checkmated. If it is, it will end the game. If you aren’t mated, the game will continue like normal, and the program will not check for mate until the next time you move into check 5 times in a row, starting next turn.

2026-04-28T13:54:00Z - Implemented stalemate detection. If checkmate detection starts and reports false (the player is not in checkmate), then stalemate detection begins. If the player is stalemate, the game will end in a Tie. Otherwise, the game will continue on as normal.

2026-04-29T12:44:00Z - Implemented en passant. If your opponent moves their pawn 2 square, and it land right next to your pawn, you can capture that pawn by moving your own pawn behind your opponent’s pawn.

2026-04-29T17:50:00Z - Implemented castling. If your king has not moved yet, and your target rook hasn’t moved, and the spaces between your king and your rook are empty, you can castle by moving your king 2 spaces. When you do, your rook will automatically jump over to the space next to the king.

2026-04-29T18:52:00Z - Started to create a bot to play against. Currently, the bot will make random moves, and it will favor moves that gain the most material (pawn = 1, bishop and knight = 3, rook = 5, queen = 9, king = 999).

This works great! (I love using the queen to annihilate the entire board)
Nice work!

Now time to be evil and implement turns so you can’t use the queen to annihilate the board! >: )

(I had to add a space in the emoticon, otherwise, it would have done this: >:slight_smile: )

then I counter that with doing each turn on each side myself! >; D
(Also, I’m really looking forward to seeing this complete!)

maybe for the check detection for a player you could check if (Legal Moves of Every Piece) or (legal moves of every piece \n \(without checks\) ::#769656) has a piece moving from someplace to the (positions [] ::#769656) of said player’s king

I absolutely love playing this!, although. If the king is “defeated”, the script errors. Still very cool!

(You should add check/checkmate detection!)

That is currently what I am attempting to do right now. I am trying to make a block, <is [White V] in check on @list ?::#769657>, which checks if the king is in check by checking the possible moves of the opposite color, and if any of the pieces are attacking the space with the chosen color’s king.

(Wow, that’s a lot of checks!)

There is check detection now… sort of. While it can successfully tell you when the piece is in check, it doesn’t let you know until after you see that the piece you tried moving hasn’t moved. I am now gonna work on checkmate detection!

Edit:
I made a block to detect checkmate, but it takes around 13-14 seconds on my end to run if the play is in checkmate. What I’m planning to do is that if a player tries to move into a check 5 or so times, it will run the detection, and if they are in checkmate, it will stop the main script and tell the player that they lost.

for me the mate block takes ~8-9 seconds

I mean I’m on a school Chromebook, so that may be it.

I’m also on a school chromebook

Use <:~) (bh emoticons :~))

I honestly prefer emoticons without noses :)

Huh, I just realized that I can use preformatted text for emoticons!

;D D; D: all work just fine

:)

BTW, en passant works now

Castling is now implemented!

Edit:
I made a bot you can play against, but… I wouldn’t really call smart.

the bot made a move that put his king into check by a queen, then moved into a check by a pawn and called it ok, I captured the king with my pawn and this happened
Screen recording 2026-04-29 15.51.23
(sorry for terrible gif quality)

Could I have some clarification?

uhh…no idk what u mean by “clairification” :\