views:

304

answers:

4

Hi All,

I am a CS student and I'd love to make a command line chess game. Ideally I would be able to ping my moves directly to my opponent and just for fun I would rather use ASCII art to print the board (No memory chess) at the command line.

I have a 4 year computer science degree under my belt and I'm just starting work as a Java programmer. I want to go back to basics for a bit of fun but I'm stumped on how to start.

What kind of a connection would you establish and how? What language would you use and what would be the most difficult thing about this project in your opinion.

2 linux machines on the same network, I can ping the machine easy.

Cheers,

Gav

EDIT

What thoughts do I have on a possible approach? I could do it in Java easily and maybe that's the best option for me. Make an executable Jar and run it from the command line. I was just hoping to learn a new language or skill with a scripting language or similar. I just don't know anything about setting up a connection in Python for example.

Sorry, I know the question was a bit vague but I was just looking for a couple of pointers, nothing in depth. What technology would you use.

+1  A: 

If you're using Java, you can use Java sockets. I've heard that it is really easy to build the connection between the two.

On a quick Google search, I came up with this: http://www.devarticles.com/c/a/Java/Socket-Programming-in-Java/

That might be helpful.

GIGGAS2
Use TCP for the actual communication, but I'd recommend trying to use a UDP broadcast or maybe even a local multicast channel to "discover" the other player. A bit overkill for this, but it's good practice.
kwatford
A: 

If you do do a socket connection between the machines think about testing.

It would be much easier to test if they send text moves to each other then you can test it manually with telnet rather than some complex remote object thing (although there are probably lots of tools for testing/monitoring a J2EE type system).

Martin Beckett
+1  A: 

I have done something similar for my online chess site at: www.geekswithchess.com.

I implemented my chess system in C# using a client server architecture. I used Microsoft Silverlight for the client and Windows Communication Foundation (WCF) Services for the server.

You could go with a client to client desingn but than each client would have to keep it's own information like score, wins profile. This would make it very easy to hack and for example modify your score.

I would strongly suggest an online client is for security reasons. You can limit the domain name that has access to your web services and prevent any unauthorized access to your server. If you make a distributed client than it will be far more difficult to secure since anyone can download the client and access your services. You also have to consider that in this design someone can make their own client that cheats by using a computer chess engine.

If you need more help feel free to lookup my contact info on my web page.

If you would like to learn more about writing a chess engine and download some free source code visit my blog: www.chessbin.com

Adam Berent
A: 

I have done a command line chess game using Java. However I have not implemented an online mode. But Java would probably be the best language to use.

Roi