PDA

View Full Version : Chess



amp
August 28th, 2003, 04:28 PM
I'm going to create my own chess game... can someone help me with some actionscript? If you give me the code for like one piece I'll try to customize it to the other pieces. :)

[Legoman]
August 28th, 2003, 05:20 PM
I think it's a bit of a hefty project to take on if you're not too hot on actionscript, to be honest. maybe you should start with something simpler.

jingman
August 28th, 2003, 05:32 PM
like lego said it is a big project for someone new to actionscript.

Off the top of my head I would say you make an array with placeholders for each square on the board.

You make a move and check if the move for that piece is legit, then tell that square that it's occupied (with the array).

Obviously different peices would have different legitimate moves, and this is where you would just get into thick actionscript. Buy some books about flash game development.

grandsp5
August 28th, 2003, 07:19 PM
I would make 8 arrays of 8 squares each then you can reference them like a matrix using nested for loops. It would be a big big pain though...maybe make checkers?

amp
August 28th, 2003, 07:28 PM
Yeah I guess I'll study actionscript before I do this... pretty much the best I can do is make the board with AS.

mlk
August 28th, 2003, 07:42 PM
you know how long it took to program deep blue (the 'pootah who beat kasparov)-

the trouble with chess is that you use strategy - you have to think way too many turns ahead. Computers need to be thoroughly programmed to human's logic (which is sometimes impossible)... It's not simple action-reaction programming.

so i'd say - keep off chess- try tic-tac-toe first =)

zylum
August 28th, 2003, 09:11 PM
he can try making 2 player chess which doesn't require AI which would really reduce the amount of as needed...

Scootman
August 29th, 2003, 10:41 PM
i think what mlk said would be a good starter though... tic tac toe would atcually be good to start with because he will have to learn to code based upon positions of things on the board, except in this case it will be a smaller board with less options... but still a good starter project... and to add computer AI would be good a/s practice... i know someone in a class where they had to make a tic tac toe game, took a few pages of code in visual basic to get it working (although i never actually tested it) but they say it worked well... so yeah, good coding practice


oops didnt see there was another thread started for it sorry

Jubba
August 30th, 2003, 08:15 AM
Originally posted by zylum
he can try making 2 player chess which doesn't require AI which would really reduce the amount of as needed...

There is still a certain amount of AI involved in order to determine the legal moves for each piece at each movement. The best way would be to use binary trees...

ahmed
August 30th, 2003, 08:24 AM
Originally posted by Jubba
The best way would be to use binary trees... Can those be implemented in Flash? :)

Jubba
August 30th, 2003, 08:30 AM
I'm sure there's a way... but I'm sure its not easy...

ahmed
August 30th, 2003, 08:33 AM
There must be a way, but i think implementing a bitboard in Flash wouldn't be a better idea than merely using arrays.. think of the conversions and all :)

Jubba
August 30th, 2003, 08:37 AM
true. I'm still interested in attempting this but I have absolutely zero time.. :( we'll think of something.. :)

kO2n
August 30th, 2003, 04:02 PM
Couldnt be bothered to look it up porperly cos i'm sure one of the Special K's already know. But can you make a 2D array in Flash? I did a very quick search and found nothing on it. Its a real shame if you cant, cos a 2D array would of been brilliant to use, I'm creating a game (Battleships) in Java using a 2D array to identify the squares on the boards.

Viru.

P.S Just in case your not sure of what a 2D array is in Java it takes the following form:

int anArray[][]; // Note the two sets of [].

Jubba
August 31st, 2003, 02:03 AM
yes you can make multidimensional arrays in flash.

kO2n
August 31st, 2003, 12:16 PM
Ok, sweet, think i might make a battle ship game in flash, animations would be sooo much easier :D . Gonna go look up how to do it now, but can you tell me anyway since my quick search before yielded no results.

Thanks,
Viru.

Jubba
August 31st, 2003, 02:03 PM
http://www.google.com/search?hl=en&ie=utf-8&oe=utf-8&q=multidimensional+arrays+Flash

kO2n
August 31st, 2003, 03:32 PM
Ah, thanks, no wonder i was using keywords '2D array flash mx'.

Thanks again.
Viru.