←  Games

ComputerCraft | Programmable Computers for Minecraft

»

Minecraft Chess

nitrogenfingers's Photo nitrogenfingers 14 Apr 2012

I've been working on expanded networks and operating systems on and off for about a month now. The forums here seem ablaze with similar activity and debugging it is a very painful process so I've taken a free day to do something a bit different.



As of this point, Chess is by in large complete, with a few caveats and not a lot of testing. Please report any bugs in this thread, or by personal message.

- A nice UI
- Command parsing to move pieces- uses standard long notation without a piece identifier (e.g. e2-e4, g2xh5, with "quit" and "exit" to quit)
- A list of each move made
- Logic constricting piece movement to standard chess rules
- Local multiplayer (on the same machine)
1100 15/4/2012
- Restrictions on piece movements- all pieces now can only move or take according to standard chess rules
- Support for en passant and castling
- Support for pawn promotion
1400 16/4/2012
- Check acknowledgement
2200 16/4/2012
- A GUI for accessing local and network play, and displaying instruction
0300 19/4/2012
- Monitor support for observation of the board
- Network multiplayer using p2p
- Hook-in for the monitor interface with the rest of the game (6x6 bigscreen)
0000 21/11/2012
- Colour support for the client

Planned updates
- Identifying checkmates and stalemates

I've got an upload of the code on mediafire here:
CLIENT: http://www.mediafire...vy76al1qfttfn3d
MONITOR: http://www.mediafire...s8d4tvxsh780qeu

This might be fun if you want a break from zombie slaying and creeper repairs, and would like a nice gentleman's game to play.
Quote

Ludburghmdm's Photo Ludburghmdm 14 Apr 2012

Whoa! EPIC!!!
Quote

kamnxt's Photo kamnxt 14 Apr 2012

Maybe you could make multiplayer client-server-client, so you could connect a monitor to the server?
Quote

nitrogenfingers's Photo nitrogenfingers 14 Apr 2012

View Postkamnxt, on 14 April 2012 - 10:05 AM, said:

Maybe you could make multiplayer client-server-client, so you could connect a monitor to the server?

That may be the best way. I wanted to avoid a server situation because that sort of makes updates a complicated process and I'm absolutely sick of message parsing- was planning a simple peer-to-peer host join system that would just fire off moves as a message, and each computer keeps a local copy of the data rather than having a central repository that has to be queried. It's a messy solution but it's far easier to code...

But you may be right. I'll ponder on it, but focussing on local multiplayer for the moment.
Quote

lukeplechaty's Photo lukeplechaty 14 Apr 2012

the link is broke it say Invalid or Deleted File.
Quote

nitrogenfingers's Photo nitrogenfingers 14 Apr 2012

Thanks for the heads up. I'm not sure why, mediafire mesbehaving. Once I've got... well some of the rules of Chess working correctly I'll try reuploading it and providing a fresh link.
Quote

lukeplechaty's Photo lukeplechaty 14 Apr 2012

that ok hope you get one up soon
Quote

Turtle's Photo Turtle 14 Apr 2012

Congratz, you just put up a middle-finger to the whole CC-Chess team.

(Incase you don't get it, its not ment seriusly, it's just that you sort of annoyed us by making a working chess code)

Cool code dude, as CC-Chess is broken atm (1 damn error i can't fix, and seemingly , no-one wants to fix), you currently own the only working code for chess in CC
Quote

Cloudy's Photo Cloudy 14 Apr 2012

Why would you be annoyed? Surely a little competition is good?
Quote

Wolvan's Photo Wolvan 14 Apr 2012

I maybe could help with the rednet play
You can do it like this: You can send the commands (eg. e2-e3) via rednet and the local computer can run it. I could help..Maybe :)/>
Quote

Ludburghmdm's Photo Ludburghmdm 14 Apr 2012

Try using Dropbox or you can try to install MediaFire Express to upload
Quote

FuzzyPurp's Photo FuzzyPurp 14 Apr 2012

Looks awesome, can't wait to play it.
Quote

Leo Verto's Photo Leo Verto 15 Apr 2012

This is awesome! Did you implement winning yet?
Quote

nitrogenfingers's Photo nitrogenfingers 15 Apr 2012

View PostDino2306, on 14 April 2012 - 08:10 PM, said:

Congratz, you just put up a middle-finger to the whole CC-Chess team.

Dino2306, I'm really sorry mate I had NO idea there was another team working on computercraft chess!

If it makes you feel any better all I've managed to get so far is some of the rules working (as of right now pieces move on constraints). It's not been an easy job, really it was something a friend suggested on a whim and it sounded like fun. It sort of has been....

I actually haven't posted any of my network code for exactly that reason (among others), I really don't want to tread on anyone's toes.

View PostWolvan, on 14 April 2012 - 09:40 PM, said:

I maybe could help with the rednet play
You can do it like this: You can send the commands (eg. e2-e3) via rednet and the local computer can run it. I could help..Maybe :)/>
Wolfran, if you'd like to take a look at network enabling this game, awesome, one less job for me! I had planned to do it exactly as you suggest- I have an isLegal function and a makeMove function. How I imagine the program to run is the player will ask if the move is legal, then submit a rednet command so both computers (or all three if I get monitors working) will execute that move. It should be pretty simple I'm hoping at least, but yeah send me an email or a message or something and we'll figure it out.


View PostLeo Verto, on 15 April 2012 - 12:24 AM, said:

This is awesome! Did you implement winning yet?
I genuinely have no idea how I'm going to implement checkmate yet. Check is easy- you just iterate through the board (I'm using a board-relative rather than piece-relative perspective), check the movement of each piece and see if moving to the king's square is a legal move, but mate... I'll have to check, well taking the checking piece, the path between the checking piece and the king and moving the king too. hm...

I've added a new update with hopefully a working mediafire link that displays movement rules being enforced by the underlying engine. Checking, checkmating and castling are all that's missing right now. Cool to see a few people interested, genuinely expected little-no interest on this one.
Quote

Turtle's Photo Turtle 15 Apr 2012

@Nitrogen, it's not really an issue, the code is broken pretty badly, mainly some gui issues (printing random stuff instead of what is supposed to be printed)
But we DO have got the whole system, board, pieces etc running, im currently fixing the connection via rednet, :)/>
if you want to look at the code, https://docs.google....TIBAFm7crE/edit
Just please do not copy-paste code, you are however allowed to use idea's from this code, as we're trying to reach a common goal.
Quote

Turtle's Photo Turtle 15 Apr 2012

View PostCloudy, on 14 April 2012 - 08:55 PM, said:

Why would you be annoyed? Surely a little competition is good?

It's annoying to work for over a month, and still having the code broken, to then see someone doing it perfectly, it makes you feel stupit, but as I tried to say, its annoying, but not really an issue.
Quote

nitrogenfingers's Photo nitrogenfingers 15 Apr 2012

View PostDino2306, on 15 April 2012 - 08:02 AM, said:

@Nitrogen, it's not really an issue, the code is broken pretty badly, mainly some gui issues (printing random stuff instead of what is supposed to be printed)

I've had a flip over it, myself and your team went about this in wildly different ways! Where you seem to have gone for a piece-centric model I've gone for a board-centric one. I went for that because it meant a bit less looping. Are you using classes? I didn't even know lua had them, this almost looks like C++ code. Something I didn't know..
No idea what's causing the bugs you mentioned but even then I'm so embarrassed I wouldn't dare give you advice at this point!

Oh out curiosity (mingled with self-interest) have you managed to get checkmates working? I can't see any computationally efficient way to do it....
Quote

nitrogenfingers's Photo nitrogenfingers 16 Apr 2012

I've just added support for checking (and just need to update this code to be reflected in castling as well), but it seems to be going well. The Checkmate and Stalemate algorithms I've decided to combine- rather than the insane idea I previously had of searching for king movement, blocking paths and taking other pieces, I'm going to use the stalemate rule: If there are no legal moves for any pieces then if the king is in check it's checkmate, otherwise its stalemate. It's far less computationally efficient I know, but I need to do it for stalemate anyway so may as well kill 2 birds with one stone.

While I've been unit testing this program right through development, which has been surprisingly easy thanks to the nice compartmentalization of the game logic (piece logic rarely interferes with one another), I haven't done much large-scale testing simply out of lack of time. If you like the look of the program so far please give it a try and if you'd be so good please report any/all errors you come across. The GUI and parser are both pretty rock solid at this point, so I'm mainly interested in the game logic- the game reporting checks where they're not happening, disallowing illegal moves, allowing illegal ones and so on.
Quote

lukeplechaty's Photo lukeplechaty 16 Apr 2012

you know this is bad im still geting Invalid or Deleted File.
Quote

nitrogenfingers's Photo nitrogenfingers 16 Apr 2012

I have no idea what's going on- when I copy the link and paste it in the URL window it seems to run fine, it's only the embedded link that's having problems. Try doing the same:
http://www.mediafire...n4y9vy72woqmbqs
Quote