Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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 1741 times)
0 Members and 1 Guest are viewing this topic.
Offline saucymeatman
« Posted 2013-12-05 21: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: 154
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #1 - Posted 2013-12-05 21: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: 62
Projects: 3
Exp: 5 years


Make code not war!


« Reply #2 - Posted 2013-12-05 21: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 01: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: 253
Projects: 11
Exp: 2 years


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


« Reply #4 - Posted 2013-12-06 03: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 03: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: 253
Projects: 11
Exp: 2 years


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


« Reply #6 - Posted 2013-12-06 03: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 06: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: 27
Exp: 18 years


Computers can do that?


« Reply #8 - Posted 2013-12-06 12: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 12: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

JGO Coder


Medals: 3
Projects: 2
Exp: 1 year


The one and only.


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

1  
2  
3  
OtherAI = null;
System.err.println("SwordsMiner has won");
System.exit(0);


I win.

If I made you laugh, helped you at all, or did something cool, I only ask that you smash that appreciate button with your nose.
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.

BurntPizza (21 views)
2014-09-19 03:14:18

Dwinin (35 views)
2014-09-12 09:08:26

Norakomi (62 views)
2014-09-10 13:57:51

TehJavaDev (87 views)
2014-09-10 06:39:09

Tekkerue (42 views)
2014-09-09 02:24:56

mitcheeb (65 views)
2014-09-08 06:06:29

BurntPizza (47 views)
2014-09-07 01:13:42

Longarmx (35 views)
2014-09-07 01:12:14

Longarmx (40 views)
2014-09-07 01:11:22

Longarmx (36 views)
2014-09-07 01:10:19
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

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

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

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!