How difficult do you all believe this to be? It wouldn't contain any images as I've never touched image manipulation, but I think an ASCII chess board would work with 2 text boxes (coordinates), 1 dropdown (piece) and a submit button.
I'm thinking at the moment it would work best with 64 functions, one for each square on the board, which are run on every move where move legality is calculated or attack is compared.
In my head at the moment it seems like it's going to be a doddle. Has anybody else attempted PHP chess before and could they tell me if it's a hard game to write.
Regards,
I'm contemplating attempting a PHP chess board.
Moderator: General Moderators
-
impulse()
- Forum Regular
- Posts: 748
- Joined: Wed Aug 09, 2006 8:36 am
- Location: Staffordshire, UK
- Contact:
I'm hoping to create it from a blank document. I like writing as much as I can myself as long as it doesn't take forever. And I'd say I'm a beginner/intermediate at PHP so I like a good challenge that makes me think of lots of ways to get around situations so I can try unfamiliar things on the way.
If I manage to finish it you will see it appear in the coding critique in the next few days
If I manage to finish it you will see it appear in the coding critique in the next few days
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Validation of chess moves is harder than it first looks. Finding out whether a player is in check, or checkmate, or stalemate is even harder still. Fortunately it's a problem lots of people have tackled before, so there's plenty of information out there. For most moves you can use a "bit board" idea ... a bit board is a 64 bit int where the 1s and 0s in the number represent a square each. You can validate moves by using bit operations to check if a move is valid. It's very clever, and it's how most modern chess applications work.
http://www.fzibi.com/cchess/bitboards.htm
http://www.fzibi.com/cchess/bitboards.htm