Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  AI Contest : Chess  (Read 1598 times)
0 Members and 1 Guest are viewing this topic.
Offline saucymeatman
« Posted 2013-12-05 22:22:37 »

How cool would it be if we built chess AI's around a central chess framework (Board data, and such) and then had them compete? Yea, I know its like that movie "ComputerChess" but I still think it would be fun.

Chess is a great game and I think it would be a real challenge to build a good chess AI that could beat other chess AI's.

This would be a contest because your AI would be competing with the other contestants AI's. Yes I am suggesting a contest.
Offline opiop65

JGO Kernel

Medals: 153
Projects: 7
Exp: 3 years

JumpButton Studios

« Reply #1 - Posted 2013-12-05 22:27:41 »

So... Why is this in the contest board? Are you suggesting a new contest for creating AI for chess?

Offline ags1

JGO Ninja

Medals: 46
Projects: 2
Exp: 5 years

Make code not war!

« Reply #2 - Posted 2013-12-05 22:34:41 »

I've got a Java chess app lying around with three AIs implemented - dumb, dumber and dumbest :-) The game was called Tiny Chess because it was meant to be tiny - maybe I will enter it in the 4K competition.

If I recall correctly I modeled the board and the rules, so that for any board position I could get all possible moves.

The AIs then simply rank the moves according to various systems.

DUMBEST simply picks a move at random - it is officially the worst chess player in the world. You can play worse deliberately of course.

DUMBER is actually quite clever and can beat me. It loops through all its possible moves and scores the board: you get points for every move available to your pieces in the new position, you lose points for every possible move your enemy has, you get points for every piece you defend and every enemy piece you threaten (and vice-versa for the enemy). Then DUMBER simply takes the highest scoring move.

DUMB is exactly the same but looks two moves ahead and tries to instead of picking the move based on highest scoring position, it plays the next enemy move and scores its own move by the enemy's score - I don't know if it was an improvement, it was just too slow.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline saucymeatman
« Reply #3 - Posted 2013-12-06 02:53:40 »

Thats pretty cool. For the DUMB or DUMBER you should have it increase the score also if the move to be made is a center controlling move.

Opiop, I edited the post to make myself more clear, but the answer is yes I'm suggesting a contest.
Offline HeroesGraveDev

JGO Kernel

Medals: 239
Projects: 11
Exp: 2 years

┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻

« Reply #4 - Posted 2013-12-06 04:29:20 »

I don't have the time to make an AI myself (maybe tomorrow), but I can share what I think is the general idea.

1. Opening moves. Obviously working out all the possible combinations of even the first 2 moves won't do you any good, so have a strategy defined to use all the time (or pick randomly from multiple).

2. General play. This is the main challenge. My idea here would be to take the value of each piece (1 = Pawn, 3 = Knight/Bishop, 5=Rook, 9=Queen, 1000=King), and then brute force all the possible (valid, but that should go without saying) outcomes for the next 2 moves. Add numbers for the value of each piece you take, and subtract for each piece you lose. Make sure to average the opponents moves so you end up with a result close to halfway between best and worse case scenarios. Also add/subtract points for putting/getting in check. Then take the best outcomes, and compare how many moves the opponent has. The less moves available to them, the better. Then you can pick randomly from the available options, and do the first move of that sequence.

3. Finishing moves. When you have taken out most of the opponents pieces, the previous techniques won't work. II'm not entirely sure how to do this part, but you can figure this out your own way.

The reason above for having the king at such a value is to sway the AI away from moves that have any chance whatsoever of leading to checkmate (unless of course there is also a chance of putting the other player in checkmate).

I think this system is a good place to start, but would need lots of tweaking to have a chance in a proper game.

Offline Agro
« Reply #5 - Posted 2013-12-06 04:35:24 »

I'd probably just write a rating algorithm for all possible moves. It would probably factor in things like what pieces you're getting closer to, if its opening up "better" moves, if it captures a piece(should also take in what piece it captures), whether you can/will get taken afterwards, if it guards another piece etc.

would be cool if you guys also did some machine learning stuff :O

you need to organize a team to write the base for the chess app tho, i would be interested in helping, i got a free 7th period at school Cheesy

Offline HeroesGraveDev

JGO Kernel

Medals: 239
Projects: 11
Exp: 2 years

┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻

« Reply #6 - Posted 2013-12-06 04:48:00 »

The base chess app should be a server so you can link up a bot and a bot, a bot and a human, or a human and human depending on the client. It would also require minimal effort if we also programmed a basic client.

I've already started working on something, and might be able to get it running in the next few hours.

EDIT: Nope, not going to get it done today. Someone else should do it instead. I'm too lazy.

Offline Agro
« Reply #7 - Posted 2013-12-06 07:24:54 »

well, scratch networking for now. Just write a Chess game with an API that'll let you make moves, analyze board etc. then make a plugin system that allows people to load AI, networking comes later.

Offline delt0r

JGO Knight

Medals: 26
Exp: 18 years

Computers can do that?

« Reply #8 - Posted 2013-12-06 13:22:07 »

There are already quite a few such AI plugin frameworks out there for chess. Perhaps not in java, but the interfaces don't prevent java AFAIK. AI in chess is more or less a done deal with a min/max tree pruning being the way to do it.

I think it is perhaps less interesting that some other games like Go, or Stratego.

I have no special talents. I am only passionately curious.--Albert Einstein
Offline Damocles
« Reply #9 - Posted 2013-12-06 13:37:11 »

I have made a simple minimax depthsearch Chess AI a while ago.
It did not handle all rules yet (like Castling), but was in a playable state.
(the cutoff heuristic was simply the value of pieces on the board, like 100 for the queen and 10 for a pawn)

For a competition, you just need to define an interface to talk to
-reset board
-assigned color
-move from - move to
-special actions like turning pawn, checkmate etc.

then each ai gets a runcommand and the recent parameters.

could also define a maximum time allowed to process for each AI to keep it fair

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline SwordsMiner

Senior Member

Medals: 2
Projects: 2
Exp: 1 year

Head of the Indie Developing team Revereor.

« Reply #10 - Posted 2014-01-21 01:06:40 »

OtherAI = null;
System.err.println("SwordsMiner has won");

I win.

- The one and only, SwordsMiner.
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.


Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (26 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (13 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (44 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!