• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Chess project

poopsiedoodle

Gibe moni plos
Joined
Nov 23, 2011
Messages
2,452
Reaction score
580
Location
Georgia
soooooooooooo I dunno where I should put this, but I'm programming chess for school, and I'm gonna post updates on the project here I reckon, and I was wondering if maybe someone could possibly help me test an online version of it (once I finish the offline version) because I don't have the password for the routerlogin dealio to forward ports or anything so I can't quite test anything out with that
anyway, have a video and a screenshot

so far, I have functionality for moving pawns (including moving 2 spaces if it's the first move), rooks, and knights, capturing pieces, adding to the score, and "queening" a pawn when they get to the other side of the board.

UPDATE: Bishop pathing is also done

UPDATE: Queen pathing is also working ayyyyyy
YfWDd64.png
 
Last edited:
gonna bump this back to the activity bar because #yolo

EDIT:
Does anyone have any ideas on anti-check measures so that you can't make a move that will put you in check? Just thought about that today and I'm not quite sure how it should be handled.
 
Last edited:
How could we give you an idea for how to do that when we don't even know what language you are writing the program in?
 
Maybe you can store the available moves of the opponent in something like a table or something that stays in the RAM, and save more specifically the list updated to where any of the opponents pieces can move, then when going to move the king, do a check to make his avaialable moves list only allow places that the opponent can't attack right now....
 
o damn that's a really good idea actually
I was just gonna have it cycle through each enemy piece though and see if he's in their path each time it checks to see where the king can move tho instead of just doing a table but good idea tho :*
 
You should only have to check the "enemy" path when doing a "castle". Since a king cannot enter into check, when doing the castle you still have to view it as the king moving each space one at a time, so any spot between him and his destination, that has enemy path on it, would cause the king to enter into check, so they cannot castle :D

Looks good so far btw
 
well I would still have to check each enemy path whenever the king is moved to make sure that the player can't move themselves into check
 
UPDATE: The pathing for kings is now fully functional.
oGQJr0q.png

I have also started working on anti-check measures, and after that, I will start working on adding support for castling the king.
EDIT: It also now has a background and an icon
CqMUbk6.png
 
Last edited:
Doesn't look like it's working.

The king should not be able to move to his right on the screenshot with him in the middle'sh area. It shows 8 tiles around him, and shows all 8 as available moves, but in reality, the king cannot move one space to the right, because then the enemies pawn can attack him.
 
One way you can check if a move puts your king in check is by keeping an array of pieces in memory and replace every possible legal counter-move (including capturing moves) with a #. If the king is not on the board anymore, the move would've put your king in check and thus be illegal :p Check my old github project that addresses this problem: https://github.com/dennisvink/php-random-chess-move-generator
 
I once wrote a Chess application (though that was for an AI algorithms course and the UI was just "for the looks" ;)). A few things that I encountered when writing that thing:
-don't try to do this in a stricte OOP style... because the performance will suck (though I didn't check what language you're writing it in)
-there's a rare legal move that a lot of people forget about, it's called an "en passant capture"
-using bitboards slightly simplifies some move checking, though you will need to read up on some "dark magic" bit manipulation ;)
 
-there's a rare legal move that a lot of people forget about, it's called an "en passant capture"
Love it :D
So many people think I am lying when I do that move, sooo many people don't know how to really play chess :D
 
Back
Top