PDA

View Full Version : Chess game


JAVAEOC
03-27-2004, 05:30 PM
Can somebody give me soem ideas on how to write a SMART and LEARNING chess game

liorean
03-27-2004, 05:39 PM
Chess is a very complicated game, with lots of rules and special cases, and very many variables. Writing a JavaScript chess AI is doable, but the browser and the JavaScript engine isn't made for the type of programming. It'll be either stupid or indurably slow. I would recommend you to start off with simply making a movement validator or whatever you'd call it, that checks whether movements are valid or not. When you have that down, especially with edge cases such as <http://www.conservativebookstore.com/chess/enpass.htm> or <http://www.conservativebookstore.com/chess/castling.htm>, you can start looking at an AI.

shlagish
03-27-2004, 05:40 PM
What do you mean when you say "learning"?
You do realize that a smart chess game will be incredibly hard to code...


I personnaly have no clue on how to go about this, but I'm guessing it would use an incalculatable amount of if statments...
Maybe you could wirght them out using a loop going through arrays and stuff like that, just to make it faster to write out...

And just so you know:
The number of possible ways of playing the first four moves per side in a game of chess is 318,979,564,000.

So, what I'm saying is: Good luck!

jkd
03-27-2004, 11:46 PM
Learning capabilities would require some sort of neural net. I've never heard of Javascript being used to write one, though I guess it wouldn't be too bad... (just finding mins and maxes of a 3-dimensionally plot...)

Willy Duitt
03-28-2004, 12:41 AM
Jopie wrote one several years ago. And this thread (http://www.webxpertz.net/forums/showthread.php3?s=&threadid=19092&highlight=chess+game) may provide you some insight into the difficulties.

.....Willy

JAVAEOC
03-28-2004, 01:39 PM
Willy: Your link doesnt work :(, but can u show me this chess game, cause I would be very interested :D?


shlagish: haha :D, i like your wording "incalculatable amount of if statments...", sounds like a whole lot :)


liorean: Yes I will do a chess game first where you play agaisnt somebody esle, tho on the same pc.

Is it possible to do something with javascript over the internet?
I mean is it possible to play chess with somebody, who is not on the same pc as you are?

JAVAEOC
03-28-2004, 01:50 PM
ohhh, where could i find pictures of chess figuers?

Nightfire
03-28-2004, 02:24 PM
Is it possible to do something with javascript over the internet?
I mean is it possible to play chess with somebody, who is not on the same pc as you are?
You'll need a serverside language for that, can't do it with javascript alone and I think it would probably be better to do it in flash or java if it gets to that stage anyway

Willy Duitt
03-28-2004, 02:25 PM
Hmmm;

I looked that link up yesterday when I posted.
However, I just noticed they upgraded the forum software and may have misplaced the thread. Attached is a copy of Jopies script including the images you wanted :)

.....Willy

mex
03-28-2004, 03:51 PM
Hey cool script man..... but the pictures are not loading!!! anyway help..... I have the screenshot as an attachment. have a look.

Willy Duitt
03-28-2004, 04:46 PM
That copy may be broke. P/M me with your email address and
I will forward the latest release which is too big to post here.

.....Willy

brothercake
03-28-2004, 07:18 PM
I wrote a Chess Game (http://www.brothercake.com/chess/) (IE only) a while ago, but it's not complete. It doesn't validate kings (a king can move into check or through a check line) and there are a couple of obscure move combinations that make it go wrong. But it recognises most things - en passent, conversion - and it can even visually highlight which move is valid from where you are.

It also imports PGN data, records games in real time, has an annotation and commentary log, and you can export your game in Smith notation.

It has no brain though - it just validates moves, you can't play against it. I wouldn't know where to start - it took me 3 months full-time to write that one, and even I don't understand how it all works - I think I went into a bit of a trance when I made that ...

JAVAEOC
03-28-2004, 08:22 PM
Very nice brother cake

shlagish
03-29-2004, 02:47 AM
I must agreed. If you don't have AI, it is indeed more possible to acheive...

JAVAEOC
03-29-2004, 10:03 PM
I must agreed. If you don't have AI, it is indeed more possible to acheive...

yes, but then what would make ur chess game different from the million others out there :D

shlagish
03-29-2004, 10:08 PM
Maybe adding the ability to cheat :)

JAVAEOC
04-01-2004, 09:43 PM
Haha, i would always win :D

kingofgame
04-18-2005, 12:34 AM
plz send me the fixed chess file to smartypm@yahoo.com