Author Topic: Chess  (Read 42307 times)

0 Members and 1 Guest are viewing this topic.

Offline ikemike

  • LV3 Member (Next: 100)
  • ***
  • Posts: 67
  • Rating: +4/-0
  • Hmm.
    • View Profile
Re: Chess
« Reply #120 on: April 05, 2011, 11:45:50 pm »
I agree with that, I was playing today and I realized that the main reason that it fails so bad is that it has a poor opening. The hard part is telling the AI how to move towards the center because moving towards the center should never put the piece itself in danger, and this is a possibility if I give center moves a value. Also, whatever system is in place should probably only last about 10 moves, because especially in a 3 piece checkmate situation, it is pointless.

One thing I'm going to do to fix this is make the AI consider more move choices, right now it only looks at the last best 4, which is why black always moves the rightmost two pawns. I might also give the move a bonus if it moves a piece away from a wall, but it would have to be small so that it wouldn't put the piece in danger.

--
Bullet chess at the moment is not possible because to be fast, the AI would suck really bad.

Chess960 is a maybe, if I could work out the castling situation it would be pretty easy though.

Swappable piece sets will definitely be done. I'll probably also have just a plain letter set too for maximum readability.

I still think a basic opening database would be extraordinarily helpful. I don't imagine (I don't know, though) it would enlarge the file much, and therefore it would act more human in that respect. Also, what do you mean by "only looks at the last best 4"?

Also, in bullet chess, thinking is not necessarily significant for much of it. But the AI would have to be highly specialized to counter easy mates for it to be decent, which may make it either significantly enlarge the program or be a separate file, and is probably a lot of work... Yeah, it's probably not worth it. =)

Another quick thing— I've done some (in-class) testing, and once or twice it hasn't recognized it could checkmate me. Is checkmate priority at max?
Anonymous Legend

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Chess
« Reply #121 on: April 06, 2011, 05:54:08 pm »
I still think a basic opening database would be extraordinarily helpful. I don't imagine (I don't know, though) it would enlarge the file much, and therefore it would act more human in that respect. Also, what do you mean by "only looks at the last best 4"?

Also, in bullet chess, thinking is not necessarily significant for much of it. But the AI would have to be highly specialized to counter easy mates for it to be decent, which may make it either significantly enlarge the program or be a separate file, and is probably a lot of work... Yeah, it's probably not worth it. =)

Another quick thing— I've done some (in-class) testing, and once or twice it hasn't recognized it could checkmate me. Is checkmate priority at max?

For opening moves, I think I've figured it out. I'm not going to implement it until I can get some major speed increases, but I think that if the number of moves available before and after the move is made are counted, then it should make some pretty good moves. Obviously using this system, the best first moves would either be the queen or king pawn, which is exactly what we want. Plus, moving a piece to the center of the board opens up a lot of moves, and while the AI doesn't realize it, it is taking a powerful position.

When I do the AI, it keeps a running list of the four best moves it's seen so far. Each move gets a rating and if it is better or equal to the lowest on the list, it boots it off and takes its place. This of course causes a problem when all moves are rated the same (first move) which is why the right two pawns are always moved first.

With the version you have, checkmate is not even considered. But on my newest version, if one of the moves is checkmate, it gets a rating of like 4000. Speaking of which: I lost to the AI today. I both failed and succeeded at the same time. I made an AI that could beat me, and I lost to a calculator AI. Oh well, it just keeps getting better.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Chess
« Reply #122 on: April 09, 2011, 05:09:20 pm »
Which is the latest? Is it uploaded already?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Chess
« Reply #123 on: April 09, 2011, 08:33:04 pm »
With the version you have, checkmate is not even considered. But on my newest version, if one of the moves is checkmate, it gets a rating of like 4000. Speaking of which: I lost to the AI today. I both failed and succeeded at the same time. I made an AI that could beat me, and I lost to a calculator AI. Oh well, it just keeps getting better.

Beat by your own creation... Robot wars just around the corner. And thanks to thepenguin77, humans are gonna lose D:

But seriously, that is awesome. It keeps getting better and better!
« Last Edit: April 09, 2011, 08:33:23 pm by Deep Thought »




Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Chess
« Reply #124 on: April 11, 2011, 05:19:17 am »
I only played once, and it was with the original AI, hence I won.

I'd like to try the most recent one, so I can see if I lose :P

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Chess
« Reply #125 on: April 11, 2011, 04:47:43 pm »
Might as well post the most recent as I haven't worked on it in a while.

Updates look like:
  • Fixed a glitch with best move selection (if there were two great moves instead of one, it might not pick neither)
  • If one of the AI moves is checkmate, it will take it
  • AI is faster


It is pretty amazing, the only thing I did to make this faster was replace all the ldir's with a big ldi \ ldi \ ldi loop and I made a 25% speed increase. Who would have thought? But this version will beat you if you're lazy, so watch out.
« Last Edit: April 11, 2011, 04:48:34 pm by thepenguin77 »
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline ikemike

  • LV3 Member (Next: 100)
  • ***
  • Posts: 67
  • Rating: +4/-0
  • Hmm.
    • View Profile
Re: Chess
« Reply #126 on: April 11, 2011, 05:05:11 pm »
Might as well post the most recent as I haven't worked on it in a while.

Updates look like:
  • Fixed a glitch with best move selection (if there were two great moves instead of one, it might not pick neither)
  • If one of the AI moves is checkmate, it will take it
  • AI is faster


It is pretty amazing, the only thing I did to make this faster was replace all the ldir's with a big ldi \ ldi \ ldi loop and I made a 25% speed increase. Who would have thought? But this version will beat you if you're lazy, so watch out.
Neat! Now it's actually a threat (sorta)!

Personally, I think it'd be awesome if you defaulted the first move to e4/d4. As the program is right now, I still can't show it to my chess buddies without them mocking it for it's opening. As a temporary solution, I don't imagine programming this in would be particularly difficult (what do I know, though), and it would make the AI "presentable" for the duration where center-priority AI is still not there. I know how hard it can be to motivate yourself to program (I've got a whole bucketload of assets for a "Every Day the Same Dream" port, but I have no motivation to make it), but if you could set a date to have center-prioritizing AI done, I think all of us would really like it...

All I'm saying is I'm really excited for this particular project, and would really, really like to see it done or appear so. =)
Anonymous Legend

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Chess
« Reply #127 on: April 11, 2011, 05:41:58 pm »
I'll get the center moving stuff done eventually, it's the next AI improvement I'm going to do. But first I have to rearrange some other stuff to make it happen, like two byte move scores. The other problem is that I need to optimize some other stuff too because counting the moves is going to take a serious toll on it's decision making time.


The reason I'm not getting it done is not because I'm not motivated to work on it. It's because I don't have the time. I get home from track at 5:30 and I have to start on homework by 8:30 so I don't end up going to bed at like 1. That leaves 3 hours of free time, 1.5 of which will be wasted on something random, like omnimaga for instance. (Not saying omnimaga is waste of time, just in this sense it's not programming) Then comes the problem of how long it takes to actually make changes. After I made the changes above, I tried to make it faster in another way. But that actually made it slower. So making it took about 1.5 hrs, debugging took another half, and getting rid of it took about 1. That right there is two days.

Not to mention I have track meets tuesday and thursday which I get home at 9 from.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline Compynerd255

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +53/-4
  • Betafreak Games
    • View Profile
    • Betafreak Games
Re: Chess
« Reply #128 on: April 11, 2011, 05:46:44 pm »
Personally, I think it'd be awesome if you defaulted the first move to e4/d4. As the program is right now, I still can't show it to my chess buddies without them mocking it for it's opening. As a temporary solution, I don't imagine programming this in would be particularly difficult (what do I know, though), and it would make the AI "presentable" for the duration where center-priority AI is still not there. I know how hard it can be to motivate yourself to program (I've got a whole bucketload of assets for a "Every Day the Same Dream" port, but I have no motivation to make it), but if you could set a date to have center-prioritizing AI done, I think all of us would really like it...

Although taking the center is what you usually want to do, there are several openings that are useful that don't take the center, such as the Grob. Although your chess buddies might decide that not moving the king's pawn is a terrible idea, the AI's opening might surprise them.
« Last Edit: April 11, 2011, 05:46:51 pm by Compynerd255 »
The Slime: On Hold, preparing to add dynamic tiles

Axe Eitrix: DONE

Betafreak Games: Fun filled games for XBox and PC. Check it out at http://www.betafreak.com



Offline ikemike

  • LV3 Member (Next: 100)
  • ***
  • Posts: 67
  • Rating: +4/-0
  • Hmm.
    • View Profile
Re: Chess
« Reply #129 on: April 11, 2011, 06:22:37 pm »
Sorry thepenguin77— I forgot that was a reason too. =| Anyways, great work. At least this won't take as long as Spencer's Zelda... This has already gotten a significant amount of progress in 1.5 months, and I guess I should be happy about that. xD

Compynerd255— Irregular openings can be surprising, and may end up taking the win, but it's not good practice for tournaments to play against an AI that doesn't take the center... I'd go as far to say 99% of competitive chess games start with white taking the center in some fashion, whether it be e4/d4/c4/nc3/nf3.
Anonymous Legend

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Chess
« Reply #130 on: April 11, 2011, 06:53:30 pm »
It is pretty amazing, the only thing I did to make this faster was replace all the ldir's with a big ldi \ ldi \ ldi loop and I made a 25% speed increase. Who would have thought? But this version will beat you if you're lazy, so watch out.

That's a big optimization :D The AI is starting to get good, and to think it's on a calculator O.O




Offline Compynerd255

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +53/-4
  • Betafreak Games
    • View Profile
    • Betafreak Games
Re: Chess
« Reply #131 on: April 11, 2011, 08:39:30 pm »
I'd like to see variable strength AI that you can set, so that this game wouldn't be limited to 2-player setups or chess players of a certain strength. It would also be cool if the game adapted to your strengths and fought you where it knew you were weak.
The Slime: On Hold, preparing to add dynamic tiles

Axe Eitrix: DONE

Betafreak Games: Fun filled games for XBox and PC. Check it out at http://www.betafreak.com



Offline ikemike

  • LV3 Member (Next: 100)
  • ***
  • Posts: 67
  • Rating: +4/-0
  • Hmm.
    • View Profile
Re: Chess
« Reply #132 on: April 12, 2011, 04:27:06 pm »
Some bugs in the new version:
- Checkmate is only recognized as "check".
- When the checkmate condition is realized, the opponent loses the ability to move. However, you can still move.
- Once the opponent loses all their pieces, it is then recognized as "checkmate".
- It also recognizes certain conditions as "checkmate", even when it isn't. The particular condition it this this to me was when the king was against the wall and it only had one possible move.

Another thing: I finally got around to giving this game to my friend, and he played it a couple times. His opinion, which is mine as well, is that the game would benefit enormously from an opening database. I know I've already said this too many times, but please consider it when the optimization is done...
« Last Edit: April 12, 2011, 04:29:56 pm by ikemike »
Anonymous Legend

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Chess
« Reply #133 on: April 12, 2011, 08:55:46 pm »
Sorry, about the checkmate thing. That was probably when I got rid of the that bad optimization I talked about, I must have messed that up because it used to work flawlessly. I'll get it fixed.

And the opening move database is definitely not happening. It is useless code with too many conditionals. What if the opponent responds in an unusual way? You have to make a new set, but what if they do another unusual move... This ends up with >1000 lines of code that will soon become obsolete.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline ikemike

  • LV3 Member (Next: 100)
  • ***
  • Posts: 67
  • Rating: +4/-0
  • Hmm.
    • View Profile
Re: Chess
« Reply #134 on: April 12, 2011, 09:14:27 pm »
And the opening move database is definitely not happening. It is useless code with too many conditionals. What if the opponent responds in an unusual way? You have to make a new set, but what if they do another unusual move... This ends up with >1000 lines of code that will soon become obsolete.

I suppose. I'm not exactly sure how it could be done, but I envisioned it drawing moves from an appvar, choosing moves randomly from its opening database depending on the opponent's move, and if the opponent did something that wasn't in the repository, it'd start going on its own. It'd be an entirely different system before the AI kicks in, though, and I can imagine why you're reluctant. I'm just afraid this game won't be as human-like as it could without an opening database, as that's essentially what human players are— opening books before the opponent does something unusual.
Anonymous Legend