Simplified checkers (AI)

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

Post Reply
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Simplified checkers (AI)

Post by MarauderIIC »

So in case you're wondering why you haven't heard from me in news posts or heard of my work in the Adventures in Game Development videos lately, it is because I have spent the last month or so programming this checkers game here (that and my job). I think I included all the necessary dependencies. Hopefully everything is right 'cause I'm all tired here.
Zip is here http://www.mediafire.com/file/znntjijjh ... eckers.zip
The write-up (not in zip) is here http://www.mediafire.com/file/xhjrjm1tt5m/checkers.doc msword format 7 pgs single-spaced and shouldnt be hard to understand

You may get some sort of 'application configuration is incorrect' error. Let me know so I know if I should bother to try and compile with g++ or use MSVS redistribute-stuff-the-right-way mode, or something. Only one person has to post that.

Edit: Source is here (below): http://elysianshadows.com/phpBB3/viewto ... 563#p28563
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Checkers

Post by Falco Girgis »

Great, can't download that attachment at work. I'll play around with it when I come home tonight. :)
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Checkers

Post by MarauderIIC »

Oh yeah, the version I sent you is slightly dumber than the version posted here. Also for those who didn't know it's simplified checkers (per assignment), once a player gets a king, that player wins.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Simplified checkers (AI)

Post by MarauderIIC »

I guess I should mention that this implements artificial intelligence via alpha-beta search (aka alpha beta pruning).

Edit: Executable is here (OP): http://elysianshadows.com/phpBB3/viewto ... 296#p28296
Source (except for the SDL files) is attached. You'll need SDL, SDL_image, and SDL_ttf in order to compile it. Source may not totally correspond to the executable but it should since I think all I took out were my comments.

http://www.libsdl.org/download-1.2.php
http://www.libsdl.org/projects/SDL_image/
http://www.libsdl.org/projects/SDL_ttf/

Edit: Uploaded fixed source, depth should now be able to be infinite w/o crashing your machine, but behavior is not tested yet.
Attachments
CS_463_Source_Fixed.zip
(375.81 KiB) Downloaded 125 times
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Simplified checkers (AI)

Post by Falco Girgis »

There is an executable there, right? I still plan on playing/screwing with it. I just have a final today. =(
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Simplified checkers (AI)

Post by MarauderIIC »

Executable in OP.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Simplified checkers (AI)

Post by dandymcgee »

That's pretty sweet Marauder. It's good fun actually, haha I got owned on 7 though and 10 froze my CPU :P. It's more fun to not enter -1 for player at all and just have the computer play itself lol.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Simplified checkers (AI)

Post by MarauderIIC »

I updated this a while ago so the memory handling is correct, but I haven't posted it yet. It allows infinite depth d:
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
sparda
Chaos Rift Junior
Chaos Rift Junior
Posts: 291
Joined: Tue Sep 23, 2008 3:54 pm

Re: Simplified checkers (AI)

Post by sparda »

Pretty tight man, I like it a lot. I've been messing around with it and seems to run well; no crashes. I got my ass whooped though, as I have not played this game in ages (not set -1). I haven't looked in depth at all the code, so I was curious as to why you commented out the entire system::init function definition.

It's interesting to see how this relates to what I'm also doing in school, BTW.

For instance, a while ago (before all these goddamn finals that I have right now) I had to write a proggie that treated the 8x8 Chess board as a undirected connected simple graph, where all inner nodes/vertices were to be considered strongly-regular and squares were represented by these very nodes/vertices. The main (and only) objective was this: given a specific set of chess pieces already aligned on a hypothetical board (this would be set by the program initiation), you were to use the queen's current position to find the best possible next move using, specifically, a backtracking algorithm. Other problems included: using a brute-force algorithm to prove that the peterson graph has no Hamiltonian circuit, a computational solution for the knight's tour, and also the 8-queen's puzzle. Pretty cool stuff, I'd say.

I'll take a read at the design documentation and give you some constructive criticism if you'd like.
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: Simplified checkers (AI)

Post by eatcomics »

sparda wrote:Pretty tight man, I like it a lot. I've been messing around with it and seems to run well; no crashes. I got my ass whooped though, as I have not played this game in ages (not set -1). I haven't looked in depth at all the code, so I was curious as to why you commented out the entire system::init function definition.

It's interesting to see how this relates to what I'm also doing in school, BTW.

For instance, a while ago (before all these goddamn finals that I have right now) I had to write a proggie that treated the 8x8 Chess board as a undirected connected simple graph, where all inner nodes/vertices were to be considered strongly-regular and squares were represented by these very nodes/vertices. The main (and only) objective was this: given a specific set of chess pieces already aligned on a hypothetical board (this would be set by the program initiation), you were to use the queen's current position to find the best possible next move using, specifically, a backtracking algorithm. Other problems included: using a brute-force algorithm to prove that the peterson graph has no Hamiltonian circuit, a computational solution for the knight's tour, and also the 8-queen's puzzle. Pretty cool stuff, I'd say.

I'll take a read at the design documentation and give you some constructive criticism if you'd like.
funny how that stuff works out huh? :shock2:
Image
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Simplified checkers (AI)

Post by MarauderIIC »

Updated source ( http://elysianshadows.com/phpBB3/viewto ... 563#p28563 )
sparda wrote:Pretty tight man, I like it a lot.
Thanks.
I was curious as to why you commented out the entire system::init function definition.
There's a couple I commented out =) I refactored that part, I think, out to some part of Renderer.
use the queen's current position to find the best possible next move using, specifically, a backtracking algorithm. Other problems included: using a brute-force algorithm to prove that the peterson graph has no Hamiltonian circuit, a computational solution for the knight's tour, and also the 8-queen's puzzle. Pretty cool stuff, I'd say.
I had to look up most of the terms but then I remembered them from my algorithm design class =) Yeah, neat stuff. We focused a lot on prepositional logic modeling in my AI class, and modeled n-queens :)
I'll take a read at the design documentation and give you some constructive criticism if you'd like.
It's more of a report for the professor. You can if you want to, doesn't make any difference anymore, though (got a 94 in the class).
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Post Reply