Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (121)
games submitted by our members
Games in WIP (577)
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  
  Beginner Pong AI contest proposal  (Read 1932 times)
0 Members and 1 Guest are viewing this topic.
Offline sponge

Senior Newbie




Ek is Java.


« Posted 2004-11-09 15:12:13 »

I had recently begun learning C++, and I wrote a Pong clone again, and as I got to the computer controlled paddle, I realized that, if you really try, you can pretty much make it unbeatable.  So then I thought, wouldn't it be cool to have a Pong 'AI' competition? Somebody writes a standard engine (i'd be happy to), and then everybody who wants to compete writes a class extending a standard Paddle class with their AI code.

Obviously there would be a maximum speed that the paddle is allowed to move every frame and so on, but if you write the basic engine well enough, checking it won't even be necessary.  So what do you think?  Especially for beginners.  I've never heard of this kind of competition before, maybe we can try it with a different kind of game even?
Offline cfmdobbie

Senior Duke


Medals: 1


Who, me?


« Reply #1 - Posted 2004-11-09 15:33:22 »

I think that's pretty much a solved problem, isn't it?  With a fixed paddle speed and a predictable ball speed, it's just down to simple mathematics:

If the ball is heading your way: if you can reach it in time, go to point of intersection, else go to centre of field.
If the ball is heading away from you: go to centre of field, or alternatively predict where the ball might be heading next and offset accordingly.

Pong is only interesting for imperfect human opponents - computers just don't make mistakes and never need to gamble on a particular outcome.

Now, writing an AI that plays Connect 4, for instance - that would be a worthy challenge! Grin

Hellomynameis Charlie Dobbie.
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #2 - Posted 2004-11-09 19:34:13 »

Why not just try your skill at JRobots ?

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

JGO Coder


Medals: 2


pixels! :x


« Reply #3 - Posted 2004-11-09 22:11:13 »

> Now, writing an AI that plays Connect 4, for instance - that
>would be a worthy challenge!

Actually it's not. That problem is "solved".

Nevertheless I was really proud of my imperfect AI back in 1998 Wink

It was able to prevent you from getting your chance, weighted doing a connected 4 line higher than everything else and it could look one step ahead. And all that without 2d arrays, because I hadn't known how to use em... and I used pixel lookups instead haha Grin

(TurboC's integrated help system could only show me some method names etc, but not that basic stuff. I also didn't noticed that I could use a 1D array for 2D stuff.)

弾幕 ☆ @mahonnaiseblog
Offline fire_ant16

Senior Newbie




GTA: san andreas is the worst game!!


« Reply #4 - Posted 2004-11-10 01:53:01 »

why don't all just play pinball for the first time in your life?? Grin Grin Grin
Offline cfmdobbie

Senior Duke


Medals: 1


Who, me?


« Reply #5 - Posted 2004-11-10 07:00:36 »

Quote
Actually it's not. That problem is "solved".


Really?  I had no idea.  While the rules are extremely simple and the problem domain very restricted, I thought there would have been enough scope for some off-the-wall tactics.

Alright...

How about chess?  Anyone solved that yet? Grin

Hellomynameis Charlie Dobbie.
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #6 - Posted 2004-11-10 07:50:08 »

Quote


Really?  I had no idea.  While the rules are extremely simple and the problem domain very restricted, I thought there would have been enough scope for some off-the-wall tactics.

Alright...

How about chess?  Anyone solved that yet? Grin


4x4 has 30 squares, with one of two states. That means you can fit every possible end-of game state into a single int. That really isn't much. Especially seeing as every end-of-game state fully stores all states leading up to it (although it loses the ordering, which requires a tiny bit of extra storage). The route to any end state is largely deterministic (i.e. very few alternatives to analyse)

By comparison, chess has a huge number of possible end-states and a mind-boggling number of ways of getting to each, with very very little determinism along the way (i.e. masses of information to analyse at every single step).

Hence, whilst Chess is unpredictable on modern computers, Connect-4 can be fully predicted in-memory by a VB program.

Of course, there is room for manoeuvre in making a c-4 that tries to "win" as opposed to "not lose".

malloc will be first against the wall when the revolution comes...
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #7 - Posted 2004-11-10 15:48:17 »

Quote


4x4 has 30 squares, with one of two states. That means you can fit every possible end-of game state into a single int.


Not true. each square has 3 states, unoccupied, filled with player 1 's piece, or filled with player 2's piece.

Unless your int is stored on a trinary computer, 30 bits aren't enough Smiley. Hey, on a trinary computer should we say the int has 32 tits instead of 32 bits?  Shocked

Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #8 - Posted 2004-11-10 16:11:57 »

Quote


Not true. each square has 3 states, unoccupied, filled with player 1 's piece, or filled with player 2's piece.

Unless your int is stored on a trinary computer, 30 bits aren't enough Smiley. Hey, on a trinary computer should we say the int has 32 tits instead of 32 bits?  Shocked



I typed a longer post originaly, then cut it down to that because it looked boring.

At the end of the game, you can fill in all unfilled spaces with any piece and not ADD any additional possible end states. In practice, the number of actual end states is going to be considerably less because a single blank removes all the bits above it from consideration at all.

So, as an upper bound, 2^30 is OK, no?

malloc will be first against the wall when the revolution comes...
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #9 - Posted 2004-11-10 18:47:59 »

I assumed you meant that each of the 30 bits within the int would be 0 or 1 depending on which player's piece was in that position, but of course that can't work as a model for representing the game state.  That was my point.

If you pretended the blanks were all filled in with something after the game had been won, then you would destroy the game state (there may be more winning runs of 4 at that point).

I would use 2 ints, one to indicate occupied or not, the other to indicate the color that occupies it.

The upper bound on the number of possible game states I will leave as an exercise for the terminally bored.  

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

Senior Duke




Java for games!


« Reply #10 - Posted 2004-11-14 14:52:38 »

Isn't it actually a 6x7 board? And you forgot to analyze the search space and appropriate search algorithms.  Roll Eyes

Xith3D Getting Started Guide (PDF,HTML,Source)
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.

theagentd (20 views)
2014-10-25 15:46:29

Longarmx (53 views)
2014-10-17 03:59:02

Norakomi (47 views)
2014-10-16 15:22:06

Norakomi (35 views)
2014-10-16 15:20:20

lcass (39 views)
2014-10-15 16:18:58

TehJavaDev (69 views)
2014-10-14 00:39:48

TehJavaDev (69 views)
2014-10-14 00:35:47

TehJavaDev (61 views)
2014-10-14 00:32:37

BurntPizza (74 views)
2014-10-11 23:24:42

BurntPizza (47 views)
2014-10-11 23:10:45
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!