PDA

View Full Version : Flash chess engine + source


jacquesmc
09-24-2006, 12:42 PM
Hello all,

It's still in a very early stage, and could be greatly improved. Graphics are temporary & ugly.

But here it is:
http://www.jacquesmalchance.com/chess

Note:
There's no detection for check or mate yet, but the computer will never leave itself in check (unless it is mate). Castling is supported, 'en passant' isn't. It's slow and not really strong and most people should win from it.

For those who know something about computer chess (I knew nothing when I wrote it):
Apparently it uses some kind of improvised alpha-beta optimization, with very primitive move sorting. It has a fixed PLY of 4 (PLY can be changed in the source code).

In the meanwhile I've read a bit about computer chess, and would like to rewrite the whole thing using 'bitboards' (but I don't know if bitwise calculations in AS are fast enough), variable PLY, better evaluation and better move sorting. Does anyone have experience with this?

All suggestions welcome, and thanks for checking!

- Bram

sunlis
09-29-2006, 03:26 AM
Looks like the basics of the system are there, but it's a bit slow.
At least it's easy to beat!

EDIT: After playing another game, the opponent seemed to take about 3 turns during 1 turn. They got my King because of it, but the game kept going.

Flash Gordon
09-29-2006, 04:01 AM
Nice job!

btw, when the computer is "thinking" it maxes out my CPU the entire time.

actionone
09-30-2006, 11:04 PM
I love this chess game. I was still playing after I lost my king. What is that called if your king is taken off the board and you are still playing chess? I am not that good at chess?:)

sunlis
09-30-2006, 11:11 PM
I love this chess game. I was still playing after I lost my king. What is that called if your king is taken off the board and you are still playing chess? I am not that good at chess?:)
That's what you call a coding error. When you lose your king, you're supposed to lose.

Assertnfailure
10-01-2006, 12:14 AM
aren't bitwise calculations always supposed to be the fastest level of computation or something? I believe bitwise operations are the lowest level of data manipulation

jacquesmc
10-06-2006, 12:53 PM
Thanks for your reactions!

actionone: :) jup, it's a bug: there's no check detection yet.

Assertnfailure: this is true for lower-level languages, but I'm not so sure about AS. AS doesnt seem to have a binary data type.

actionone
10-15-2006, 09:13 PM
I really like this game just how it is because you can play with no king. I bet other people would like it too.

pixelwit
10-15-2006, 10:14 PM
Wow!

I've considered making a board to display a chess game using other people's non-Flash engines but never even considered making the WHOLE thing in Flash. That's quite an accomplishment for both you and Flash. Nice.

-PiXELWiT
http://www.pixelwit.com

Assertnfailure
10-16-2006, 01:39 AM
Someone posted one a while back where, whenever it was the computers turn, it would go through the whole recursive process of analyzing movements, and would draw lines on the screen to show its thought process. It was neat to see high concentrations of lines in areas of particular significance.

Flexer
11-03-2006, 01:26 AM
Hi jacquesmc, all,

I am very impressed with your chess game its really nice. I am actually very interested myself in developing my own flash chess game with clean and structured code.

I just finished a big project in AS 2.0 and interested in learning AS 3.0 and I thought what better way to learn but to develop my favourite game using AS3.0 and Flex especially that it would be a lot faster to compute mathematical equations. although the main purpose for my game is for multiplayer and not a single player, I still don't mind doing a single player version.

but I want to enforce all the chess rules offcourse including check mate and the way the pieces move.

so I am wondering if anyone can help me with whatever flash chess resources they have, I would really appreciate it.

like links to cool chess games made in flash + chess logic that I can have a look at and understand and maybe use.

Kind Regards,

Thank you all in advance

Flexer

jacquesmc
11-03-2006, 11:15 AM
Hello Flexer,
These links may be useful (unfortunately I went googling AFTER my prog was almost finished, and the optimizations I found out about where added later in an unstructured and buggy way):
http://chess.verhelst.org/1997/03/10/search/
http://www.frayn.net/beowulf/theory.html

This teminology site may help you assigning logical variable names:
http://www.logicalchess.com/info/reference/glossary.html

And the only other flash chess I'm aware of is this one, but it's not open source. Much better than mine though:
http://www.media-division.com/flashgames/flashchess/chess.htm

Checking wether moves are valid is the easy part.
The function getValidMoves and the pieceMoves array in my code might help you get started.

Good luck, and keep me informed!

Flexer
11-03-2006, 11:37 AM
Good luck, and keep me informed!


Thank you very much, I will do. it may take me sometime though.

Thanks once again.

Souldier77
07-26-2007, 07:36 PM
Someone posted one a while back where, whenever it was the computers turn, it would go through the whole recursive process of analyzing movements, and would draw lines on the screen to show its thought process. It was neat to see high concentrations of lines in areas of particular significance.

Was this was you were referring to? :-)
http://turbulence.org/spotlight/thinking/chess.html