# Chess

**URL:** <https://forum.kirupa.com/t/chess/29625>\
**Category:** programming\
**Created:** [August 28, 2003, 8:28pm UTC](https://forum.kirupa.com/t/chess/29625 "2003-08-28T20:28:01Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![amp1](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@amp1](https://forum.kirupa.com/u/amp1)\
**Post date:** [August 28, 2003, 8:28pm UTC](https://forum.kirupa.com/t/chess/29625/1 "2003-08-28T20:28:01Z")

</div>

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. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 9:20pm UTC](https://forum.kirupa.com/t/chess/29625/2 "2003-08-28T21:20:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 9:32pm UTC](https://forum.kirupa.com/t/chess/29625/3 "2003-08-28T21:32:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 11:19pm UTC](https://forum.kirupa.com/t/chess/29625/4 "2003-08-28T23:19:29Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 11:28pm UTC](https://forum.kirupa.com/t/chess/29625/5 "2003-08-28T23:28:45Z")

</div>

Yeah I guess I’ll study actionscript before I do this… pretty much the best I can do is make the board with AS.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 28, 2003, 11:42pm UTC](https://forum.kirupa.com/t/chess/29625/6 "2003-08-28T23:42:58Z")

</div>

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 =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 29, 2003, 1:11am UTC](https://forum.kirupa.com/t/chess/29625/7 "2003-08-29T01:11:16Z")

</div>

he can try making 2 player chess which doesn’t require AI which would really reduce the amount of as needed…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 30, 2003, 2:41am UTC](https://forum.kirupa.com/t/chess/29625/8 "2003-08-30T02:41:47Z")

</div>

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

[edit]  
oops didnt see there was another thread started for it sorry  
[/edit]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 30, 2003, 12:15pm UTC](https://forum.kirupa.com/t/chess/29625/9 "2003-08-30T12:15:35Z")

</div>

> \*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…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 30, 2003, 12:24pm UTC](https://forum.kirupa.com/t/chess/29625/10 "2003-08-30T12:24:23Z")

</div>

> \*Originally posted by Jubba \*  
> \*\*The best way would be to use binary trees… \*\*  
> Can those be implemented in Flash? 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 30, 2003, 12:30pm UTC](https://forum.kirupa.com/t/chess/29625/11 "2003-08-30T12:30:01Z")

</div>

I’m sure there’s a way… but I’m sure its not easy…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 30, 2003, 12:33pm UTC](https://forum.kirupa.com/t/chess/29625/12 "2003-08-30T12:33:00Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 30, 2003, 12:37pm UTC](https://forum.kirupa.com/t/chess/29625/13 "2003-08-30T12:37:12Z")

</div>

true. I’m still interested in attempting this but I have absolutely zero time… ☹ we’ll think of something… 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 30, 2003, 8:02pm UTC](https://forum.kirupa.com/t/chess/29625/14 "2003-08-30T20:02:15Z")

</div>

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 [].

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 31, 2003, 6:03am UTC](https://forum.kirupa.com/t/chess/29625/15 "2003-08-31T06:03:50Z")

</div>

yes you can make multidimensional arrays in flash.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 31, 2003, 4:16pm UTC](https://forum.kirupa.com/t/chess/29625/16 "2003-08-31T16:16:04Z")

</div>

Ok, sweet, think i might make a battle ship game in flash, animations would be sooo much easier 😃 . 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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 31, 2003, 6:03pm UTC](https://forum.kirupa.com/t/chess/29625/17 "2003-08-31T18:03:32Z")

</div>

[http://www.google.com/search?hl=en&ie=utf-8&oe=utf-8&q=multidimensional+arrays+Flash](http://www.google.com/search?hl=en&ie=utf-8&oe=utf-8&q=multidimensional+arrays+Flash)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 31, 2003, 7:32pm UTC](https://forum.kirupa.com/t/chess/29625/18 "2003-08-31T19:32:33Z")

</div>

Ah, thanks, no wonder i was using keywords ‘2D array flash mx’.

Thanks again.  
Viru.
