Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: pimathbrainiac on October 30, 2012, 03:26:41 pm

Title: Optimization and adding AI
Post by: pimathbrainiac on October 30, 2012, 03:26:41 pm
I am making a chess program in AXE, and I need help with optimization, adding Promotion, and adding AI.

The file:
http://www.ticalc.org/archives/files/fileinfo/449/44910.html

thanks if you can help. I need to optimize first.

Edit: ticalc link no longer valid... will give new ticalc link when updated.
Edit: attatched v1.2 to this post
Edit: Updated screenshot:
(http://img.removedfromgame.com/imgs/GHESSGIF1.2.gif)
Edit: I moved this project to a different location: http://ourl.ca/17408
Title: Re: Optimization and adding AI
Post by: bored_student on November 01, 2012, 03:56:39 pm
Code: [Select]
[3844828282443800]->Pic1P9
[3244828282443800]->Pic1P10
[3244828282443800]->Pic1P11
[3244828282443800]->Pic1P12
[3244828282443800]->Pic1P13
[3244828282443800]->Pic1P14
[3244828282443800]->Pic1P15
[3244828282443800]->Pic1P16
[387CFEFEFE7C3800]->Pic2P
[387CFEFEFE7C3800]->Pic2P10
[387CFEFEFE7C3800]->Pic2P11
[387CFEFEFE7C3800]->Pic2P12
[387CFEFEFE7C3800]->Pic2P13
[387CFEFEFE7C3800]->Pic2P14
[387CFEFEFE7C3800]->Pic2P15
[387CFEFEFE7C3800]->Pic2P16
[3068A4A484483000]->Pic1B
[1058DCDCFC783000]->Pic2B
[609088482848F800]->Pic1N
[60F0F87838787800]->Pic2N
[D6D67C2828287C00]->Pic1R
[D6D67C3838387C00]->Pic2R
[9254382828287C00]->Pic1Q
[9254383838387C00]->Pic2Q
[3828EE82EE283800]->Pic1K
[3838FEFEFE383800]->Pic2K
[FFFFFFFFFFFFFFFF]->Pic3

I think this are the sprites for the pieces.
You could call them by a command like
Code: [Select]
PtnOn(X,Y,Pic1P9+I*8
where I is the number of the sprite you want to draw.


...and adding AI.

I once made a chess AI on my PC but I doubt it will be possible with Axe on calculators
The calcs are to slow and they haven't enougth memory
Title: Re: Optimization and adding AI
Post by: squidgetx on November 01, 2012, 08:51:16 pm
Code: [Select]
PtnOn(X,Y,I*8+Pic1P9)Optimized, and bugfixed at the same time ;D
Remember that placing constants at the end of expressions is optimal, and also remember Axe order of operations is straight-up left to right (unless there are parens)
Title: Re: Optimization and adding AI
Post by: TIfanx1999 on November 02, 2012, 12:48:11 pm
I once made a chess AI on my PC but I doubt it will be possible with Axe on calculators
The calcs are to slow and they haven't enougth memory
It's <a href=http://ourl.ca/9904>already been done</a> in ASM with grayscale graphics. I don't see why it couldn't be done in Axe. :)
Title: Re: Optimization and adding AI
Post by: bored_student on November 04, 2012, 01:36:22 pm
I meant the AI the program that plays against you.
If that really exist you must show me  *.*

When I did it with Delphi 5 last year my CPU (in PC) needed 30 sekunds to decide which move to do altough it only "thinks" 5 moves depht.


Optimized, and bugfixed at the same time ;D
Remember that placing constants at the end of expressions is optimal, and also remember Axe order of operations is straight-up left to right (unless there are parens)
Yes I forgot...
Title: Re: Optimization and adding AI
Post by: Eeems on November 04, 2012, 02:04:12 pm
I meant the AI the program that plays against you.
If that really exist you must show me  *.*
I believe he linked to it in his post.
http://ourl.ca/9904
Title: Re: Optimization and adding AI
Post by: bored_student on November 04, 2012, 02:20:08 pm
Yeah he really made it. So I have been wrong ::)
I will test the AI as soon as possible cause I once tried it on my one on a TI 83 Plus but I gave up after a while <_<

respect to thepenguin77  ;D
Title: Re: Optimization and adding AI
Post by: thepenguin77 on November 04, 2012, 11:33:42 pm
I once made a chess AI on my PC but I doubt it will be possible with Axe on calculators
The calcs are to slow and they haven't enougth memory
It's <a href=http://ourl.ca/9904>already been done</a> in ASM with grayscale graphics. I don't see why it couldn't be done in Axe. :)

Woah now. If we're going to link him, at least get him the most recent version. (http://www.ticalc.org/archives/files/fileinfo/443/44398.html)
Title: Re: Optimization and adding AI
Post by: pimathbrainiac on November 05, 2012, 03:36:41 pm
I have new *optimized* code, but it needs a bugfix... you can only move one pawn of each color, and nothing else.

I deleted all the piece selection
And replaced it with this (just pawns so far):
Code: [Select]
If (getKey(54))
For(X,9,16)
If ((({Lƒ+17}+1)=({L+X})) and ({Lƒ+18}={L‚+X}))
{L+X}üZ
{L‚+X}üÁ
sub(B)
Zü{L+X}
Áü{L‚+X}
End
If ((({Lƒ+17}+1)=({L„+X})) and ({Lƒ+18}={L…+X}))
{L„+X}üZ
{L…+X}üÁ
sub(A)
Zü{L„+X}
Áü{L…+X}
End
End
End
Title: Re: Optimization and adding AI
Post by: pimathbrainiac on November 05, 2012, 05:29:55 pm
Just fixed the bug... sorry for the concern
Title: Re: Optimization and adding AI
Post by: TIfanx1999 on November 05, 2012, 08:33:48 pm
@Bored_student: I did mean the AI in thepenguin's version. :)
@Thepenguin: Sorry, our search function isn't the best, and that's all I could find. Thanks for the updated link.
@pimathbrainiac: You should post a screen shot of your work soon. :)
Title: Re: Optimization and adding AI
Post by: Eeems on November 06, 2012, 11:23:50 am
Not only is our search function not the best, it also likes to eat all the cpu on the vps x.x
Title: Re: Optimization and adding AI
Post by: pimathbrainiac on November 06, 2012, 11:37:26 am
I have a screenshot on the ticalc page...
Title: Re: Optimization and adding AI
Post by: Eeems on November 06, 2012, 11:41:31 am
@pimathbrainiac: People don't always look on other sites for screenshots. Please be polite with your responses.
Title: Re: Optimization and adding AI
Post by: pimathbrainiac on November 06, 2012, 11:42:40 am
sorry... I didn't think it came off as rude... sorry
Title: Re: Optimization and adding AI
Post by: TIfanx1999 on November 06, 2012, 12:34:15 pm
I somehow missed that you had posted it on ticalc already. I though it was in such an early state that there was not a release yet. Anyhow, if you have a topic here it can't hurt to add a screen shot. ;) Projects tend to attract more interest if they have images as well.
Title: Re: Optimization and adding AI
Post by: Hayleia on November 06, 2012, 12:50:13 pm
I have a screenshot on the ticalc page...
Then it is really easy to add a screenshot on this topic, simply do this:
[img]<link to the screenshot on ticalc>[/img] ;)
Title: Re: Optimization and adding AI
Post by: pimathbrainiac on November 06, 2012, 12:51:56 pm
I'm going to add a screenshot and update soon
Title: Re: Optimization and adding AI
Post by: pimathbrainiac on November 06, 2012, 01:03:09 pm
No screenshots yet, but I reduced size tremendously! down to 10946 bytes!
Title: Re: Optimization and adding AI
Post by: pimathbrainiac on November 06, 2012, 01:31:19 pm
Done with size reduction and screenshots. Waiting to be uploaded on ticalc.
File attached

Also, how do you add a animated gif screenshot from you comp to omnimaga?
Title: Re: Optimization and adding AI
Post by: Eeems on November 06, 2012, 01:34:35 pm
Host it on a site, like dropbox or imgur. Or you could try attaching it to a post if you have a high enough post count. There might be issues with size if you do that though.
Title: Re: Optimization and adding AI
Post by: pimathbrainiac on November 06, 2012, 01:37:57 pm
screenshot (hopefully):

(https://www.dropbox.com/s/kcbr7wh6w1z39fe/CHESSGIF1.1.gif)
Title: Re: Optimization and adding AI
Post by: pimathbrainiac on November 06, 2012, 01:38:31 pm
crap: it no work!
Title: Re: Optimization and adding AI
Post by: aeTIos on November 06, 2012, 01:41:09 pm
1. you should upload the pic to img.removedfromgame.com, there you get a link.
2. You double-posted, which is frowned upon here.
Title: Re: Optimization and adding AI
Post by: pimathbrainiac on November 06, 2012, 01:43:19 pm
oops, sorry

screenshot:

(http://img.removedfromgame.com/imgs/CHESSGIF1.1.gif)
Title: Re: Optimization and adding AI
Post by: squidgetx on November 06, 2012, 03:16:29 pm
You can't see the board while selecting where to move????
Title: Re: Optimization and adding AI
Post by: pimathbrainiac on November 06, 2012, 04:32:17 pm
HUGE thing... I know. but that requires displaying every piece within the moving subroutine... that = tons of space taken up
Title: Re: Optimization and adding AI
Post by: Builderboy on November 06, 2012, 04:34:38 pm
How about you put the board display routine in a subroutine?  That way you can display it whenever you need to with minimal size increase.
Title: Re: Optimization and adding AI
Post by: pimathbrainiac on November 06, 2012, 04:38:18 pm
 *.* OMG  *.* I did not think of that! You are a ninja!  :ninja:
Title: Re: Optimization and adding AI
Post by: Eeems on November 06, 2012, 04:40:14 pm
Yes, yes builderboy is. :P
Title: Re: Optimization and adding AI
Post by: pimathbrainiac on November 06, 2012, 04:43:59 pm
http://www.ticalc.org/archives/files/fileinfo/449/44910.html

This is the ticalc page for my chess program update... submitted before Builderboy's comment... good idea builderboy! will be in next version!

Edit: the old and new versions of the file are in the archive... I must fix that