Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 21st, 2005, 1:18 PM   #1
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,885
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
Binary Game Challenge

Okay, I've got a challenge for you people experienced or wanting to be experienced in programming an AI.

The task is to write a program that will try to defeat the other AI in a test of logical thinking in a mathematical game.

The game is as follows:
- The board is a random string of binary, 10 characters long.
- When it's your turn you can change any 0 to 1 (but not a 1 to 0), and reverse a number to the left of the first if you choose.
Before: 0110011001
Valid Turns: 1110011001, 0111111001, 0110011101
- The winner is the one who makes the binary strand all 1s

The program when run must:
- Read the board from 'board.dat' in the same folder as the exe (it will be stored as the number stated plainly: 1010101010 for example).
- Execute one valid move.
- Replace the board in 'board.dat' with the updated one in the same format.
- The program will then end.

It can be programmed in any language, as long as it can be run as an exe without any prompts.

The judging program will randomize a board and save it to board.dat, then simultaneously run each program until the board is 1111111111. Then with the same combination change who went first and run again. It will repeat this 100 times and summarize the report.

I will post the reports for fun in this thread so you can see who your AI can beat.

This is all just for fun on your own time. No contest, but you can treat it as one if you wish.

Just submit the program any time if you wish (along with the source). I guarantee you you'll learn something new about AIs :o (unless you're an expert, you know who you are).

Good luck. :banana:
Sane is offline   Reply With Quote
Old Dec 21st, 2005, 2:06 PM   #2
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
Seems like doing this over stdin and stdout would be faster and allow thinking about more than the current situation.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Old Dec 21st, 2005, 2:13 PM   #3
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,885
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
Well, if you think about it, all the program needs is the current situation.

If you play the game, you'll notice each turn will need to think for its own. The strategy is to make the best move for your current situation.

Think of it like tic-tac-toe. Given a board mid-point in game, you can make the perfect move without knowing what has been done or what should be done in the future, given your knowledge of the game is sufficient.

So if you teach the program enough about the Binary Game, it will be able to result in a perfect move out of every situation without any prerequesites (if there is such thing as a perfect game).

Mind you, I haven't studied very far in to this game. Maybe a perfect game is very easy, we'll have to find out.

Edit: PLUS, I want this to be open to any language. Even something as simple as BASIC or OOT.
Sane is offline   Reply With Quote
Old Dec 21st, 2005, 3:05 PM   #4
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
Using stdin and stdout wouldn't affect the ability of languages to participate. Console I/O is equally as common as file I/O.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Old Dec 21st, 2005, 3:50 PM   #5
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 644
Rep Power: 4 Jessehk is on a distinguished road
Exactly. Stdin stands for standard input (usually a keyboard) and stdout stands for standard output (usually your monitor). (saves you having to search)
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS!
Jessehk is offline   Reply With Quote
Old Dec 21st, 2005, 4:04 PM   #6
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
You can redirect them on Windows by setting some special process start parameters (Super easy in C#) or in *nix by...forking isn't it?
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Old Dec 21st, 2005, 4:53 PM   #7
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by Sane
The judging program will randomize a board and save it to board.dat, then simultaneously run each program until the board is 1111111111. Then with the same combination change who went first and run again. It will repeat this 100 times and summarize the report.
Just to clarify; the program that wins is the one that makes the board 1111111111 first? Also, the board does not wrap around, such that the number to the left of the first number is the last number?
Arevos is offline   Reply With Quote
Old Dec 21st, 2005, 9:02 PM   #8
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,885
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
Dameon, that still seems a little out of the way to do. =/

Arevos, correct and correct. There is no number left of the first.
Sane is offline   Reply With Quote
Old Dec 21st, 2005, 9:07 PM   #9
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
The way i see it is the difference is...

program.exe data.dat

program.exe < data.dat

As for programming it, it's just about as far apart in most languages as well... I think Sane's original idea -- reading from a file -- will do just as well since we won't be sending it more than one situation or doing any real time analysis...

My todo list for the very close future is the thing for element, and doing something in C for this...
__________________

tempest is offline   Reply With Quote
Old Dec 21st, 2005, 11:20 PM   #10
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
Quote:
Originally Posted by Sane
and reverse a number to the left of the first if you choose.
Could there be some clarification on that point?
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:28 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC