This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#201 2012-05-31 13:45:29

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

Pacman, then!

Also, Pac-Mac AIs might be cool; each AI controls a Pac-Man and we let 'em loose on a big 10x10 maze with some ghosts and a coin on each empty square. When all coins are collected (or all Pac-Men ghost-eaten), the Pac-Man with the most coins wins. That will need only one round, needs a very basic framework, and is rather cool in my opinion. What do you think of that?

I think you might need a bigger maze, depending on how many players you get... Can the players hurt each other?

And I disagree that it's very basic... Hex was a lot simpler by comparison  tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#202 2012-05-31 13:59:55

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: AI Strategy Tournament: Rescheduled to June 1st

sparks wrote:

Uno?

The problem is, we don't want to deal with any chance games.  Uno would be cool; you gamble on what the next card will be based on previous cards drawn, etc.  But I think everyone wants to stick with games without random variables.  Hardmath123, please correct me if I'm wrong.

EDIT: One other cool thing about Uno: we could have more than two players working at the same time.

Last edited by amcerbu (2012-05-31 14:00:52)

Offline

 

#203 2012-05-31 14:22:41

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

MoreGamesNow wrote:

I found two people at my school playing a different variant that I thought was really cool.  The board was the same as yours, but, when each player went on a square, the opponent had to make a move on a corresponding game.  Er, that didn't make sense, diagram time:

1  2  3
4  5  6
7  8  9

If someone puts an "X" in square 3 of game 1, the opponent (who goes next) has to make their next move in game 3.  If they play 6:3, the original player has to make their next move in game 6.  This means that, when you make a move, you have to look at what options that opens for your opponent.  It also means that, if your opponent can force a win on one board, you can still win/tie the game by simply avoiding that board.

This game sounds so cool...  smile
But let's agree on python for speed of writing&executing, ok?

Offline

 

#204 2012-05-31 14:41:45

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

roijac wrote:

MoreGamesNow wrote:

I found two people at my school playing a different variant that I thought was really cool.  The board was the same as yours, but, when each player went on a square, the opponent had to make a move on a corresponding game.  Er, that didn't make sense, diagram time:

1  2  3
4  5  6
7  8  9

If someone puts an "X" in square 3 of game 1, the opponent (who goes next) has to make their next move in game 3.  If they play 6:3, the original player has to make their next move in game 6.  This means that, when you make a move, you have to look at what options that opens for your opponent.  It also means that, if your opponent can force a win on one board, you can still win/tie the game by simply avoiding that board.

This game sounds so cool...  smile
But let's agree on python for speed of writing&executing, ok?

I think the main reason that Javascript was chosen for this tournament is that a lot of people know at least the basics of it, if not more. Python, whilst still widely used is still less known on Scratch than Javascript it seems to me. Also, it requires no software installation to take part.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#205 2012-05-31 16:45:10

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

sparks wrote:

roijac wrote:

But let's agree on python for speed of writing&executing, ok?

I think the main reason that Javascript was chosen for this tournament is that a lot of people know at least the basics of it, if not more. Python, whilst still widely used is still less known on Scratch than Javascript it seems to me. Also, it requires no software installation to take part.

What Sparks said; more people know it, simply. Although I'm with you on Python being faster to write...

And JS is pretty quick nowadays; particularly if you use the right JS engine  smile

Last edited by blob8108 (2012-05-31 16:45:35)


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#206 2012-06-01 04:49:55

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

@sparks: looks like we need to postpone it again, maybe till June 15th? Anyway, please rename it to reflect that, by removing the "to ..." bit from the title. Thanks! (It's great to have a mod following your thread.  big_smile )

PacMan it is! I thunk out how it should work (blob, please read this through a couple of times before suggesting/correcting anything  tongue ):

1. Everyone codes a single function (bear with me) which takes in a board and your pacman's current position, and returns "up", "down", "left", or "right".

2. I call each function with the same board but with unique PacMen.

3. The PacMen begin along the top row, and the ghost begin on the bottom row. Whenever a ghost touches a pacman (same square), the pacman touched dies (i.e. is terminated).

4. Each empty square has a coin. When a pacman touches a square with a coin, the coin disappears and the pacman's score increments

5. When all coins are gone or all pacmen dead, the pacman with the highest score wins


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#207 2012-06-01 04:56:11

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

Also, using my ninja-skills, I can allow coding in the following languages:
JS
Python
Objective-C
BYOB

Using remote sensor connections and sockets. But I'd rather have everyone code in JS.  smile


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#208 2012-06-02 05:52:01

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: AI Strategy Tournament: Rescheduled to June 1st

What about C#?

Offline

 

#209 2012-06-02 06:23:44

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

No, sorry.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#210 2012-06-02 13:19:32

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: AI Strategy Tournament: Rescheduled to June 1st

Ah, well, it was worth a try.  I'm not going to have much time this month anyway, so it's just as well.  I'll keep checking on this forum, though.

Offline

 

#211 2012-06-03 06:34:51

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

If we've decided on PacMan (I'm assuming we have for now, if anyone disagrees please post now or forever hold your peace) I should be done with a basic framework in JS by this week; all I need is to assign "PACMAN" objects and a "MAP" array, then pass those as parameters to your motion scripts.  smile

EDIT: That was my 1900th post.  big_smile

Last edited by Hardmath123 (2012-06-03 06:35:36)


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#212 2012-06-03 11:28:58

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: AI Strategy Tournament: Rescheduled to June 1st

How are you going to make the map fair?  Will it be symmetrical? 

Also, I've had a few ideas for the ghosts (that I was thinking about the other day): 
You build a ghost class, and instantiate some number of ghost objects.  Each instance of the ghost class has a method that can calculate the path from the ghost's current position to each of the four "PacMen."  A ghost chooses to target the nearest PacMan. 

But here's the catch: a ghost can't ever make a 180-degree turn while it's in a corridor (it can if it "runs into a wall").  This would prevent the ghost from sitting still or moving quickly back and forth on the opposite side of a barrier with one of the PacMen.  So, the ghost has to keep going straight until it comes to a place where it can turn left or right.  This is legal.  However, the ghost can only turn back the direction it was coming from (180 degrees) when it reaches a wall perpendicular to the direction it was travelling in before

This will also improve performance, since the program won't have to call the computationally expensive pathfinding algorithm as often. 

I hope that made sense.

Offline

 

#213 2012-06-03 11:53:09

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

amcerbu wrote:

How are you going to make the map fair?  Will it be symmetrical? 

Also, I've had a few ideas for the ghosts (that I was thinking about the other day): 
You build a ghost class, and instantiate some number of ghost objects.  Each instance of the ghost class has a method that can calculate the path from the ghost's current position to each of the four "PacMen."  A ghost chooses to target the nearest PacMan. 

But here's the catch: a ghost can't ever make a 180-degree turn while it's in a corridor (it can if it "runs into a wall").  This would prevent the ghost from sitting still or moving quickly back and forth on the opposite side of a barrier with one of the PacMen.  So, the ghost has to keep going straight until it comes to a place where it can turn left or right.  This is legal.  However, the ghost can only turn back the direction it was coming from (180 degrees) when it reaches a wall perpendicular to the direction it was travelling in before

This will also improve performance, since the program won't have to call the computationally expensive pathfinding algorithm as often. 

I hope that made sense.

Seriously, can I at least code the ghosts on my own, without ideas from everyone?  tongue

Ghosts will be special types of cells on the (symmetrical) grid, along with Wall and Empty.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#214 2012-06-03 14:50:23

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: AI Strategy Tournament: Rescheduled to June 1st

Okay, sorry.

Offline

 

#215 2012-06-04 09:21:45

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

amcerbu wrote:

Okay, sorry.

No problem, I'm usually receptive to new opinions. It's when those opinions are better than mine that I begin to get upset...  tongue


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#216 2012-06-04 12:47:19

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

Hardmath123 wrote:

amcerbu wrote:

Okay, sorry.

No problem, I'm usually receptive to new opinions. It's when those opinions are better than mine that I begin to get upset...  tongue

So what you're saying is you like being able to ignore other people's opinions, because they're bad...  tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#217 2012-06-05 09:46:12

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

blob8108 wrote:

Hardmath123 wrote:

amcerbu wrote:

Okay, sorry.

No problem, I'm usually receptive to new opinions. It's when those opinions are better than mine that I begin to get upset...  tongue

So what you're saying is you like being able to ignore other people's opinions, because they're bad...  tongue

...

That's your opinion.  tongue


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#218 2012-06-06 10:42:57

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

Hardmath123 wrote:

blob8108 wrote:

Hardmath123 wrote:


No problem, I'm usually receptive to new opinions. It's when those opinions are better than mine that I begin to get upset...  tongue

So what you're saying is you like being able to ignore other people's opinions, because they're bad...  tongue

...

That's your opinion.  tongue

That's true. ...but now I'm confused.  tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#219 2012-06-06 10:44:34

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

tongue

Last edited by Hardmath123 (2012-06-06 10:44:44)


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#220 2012-06-11 11:44:48

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: AI Strategy Tournament: Rescheduled to June 1st

[offtopic]

On my own, I've been working on a C# implementation of an Air Hockey game with a human and a computer player.  Microsoft has a great class library, the XNA Framework, that works very well for game development (especially when it comes to loading image and sound content).  Anyway, here's a screenshot of what I have so far.  Graphics were made in Paint.NET. 

I've gotten all the physics stuff to work.  What I came here to ask: does anyone have any tips on elegant ways of programming AI behavior?  The ComputerPaddle is a static class with a few methods: PhysicsConstraints(), SetDestination(), etc.  The Puck and PlayerPaddle are also also public static classes (with most members public). 

Anyway, here's the screenshot:

View full-sized image
http://oi47.tinypic.com/1zptkpk.jpg

[/offtopic]

Last edited by amcerbu (2012-06-11 11:48:55)

Offline

 

#221 2012-06-12 06:08:25

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

amcerbu wrote:

I've gotten all the physics stuff to work.  What I came here to ask: does anyone have any tips on elegant ways of programming AI behavior?  The ComputerPaddle is a static class with a few methods: PhysicsConstraints(), SetDestination(), etc.  The Puck and PlayerPaddle are also also public static classes (with most members public).

Cool stuff! Do you mean the interface to the AI code, or the AI itself?

I use Python/Pygame; but I think the design ideas are non-language-specific. For the interface, I have an abstracted Controller class with subclasses for keyboard control, and potentially joysticks, etc, in future. The class handles things like key-to-control mappings (so the user can change the keys used for each action; but that's a separate issue).

All the controller classes share the same interface: I have get_axis() to return x,y values and get_buttons() to return a list of True/False pressed values for each button (currently only a single "fire" button). (I should probably change this to just be a single method...) Each Player object gets a Controller (subclass) instance and uses these methods to get controller input and use it in the physics stuff.

For an AI, I just make a new Controller subclass, AIController. The controller subclass gets a reference to the Player object which it can use to look up the current position, other objects, etc, to make the decision of which controls to return. The advantage of this implementation is you guarantee that the AIs have the same physics model, so it's completely fair.

For programming the actual behaviour itself; that's up to you, as it's very dependent on the game. I hope some of that is interesting/useful, anyhow  smile


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#222 2012-06-12 11:12:26

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: AI Strategy Tournament: Rescheduled to June 1st

Thanks!  I'll take your advice on implementing control input!  I may upload the project to some site when I've finished.  Since this competition is at a standstill, it might be neat to do an Airhockey AI programming challenge...

Offline

 

#223 2012-06-13 06:14:08

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

amcerbu wrote:

Thanks!  I'll take your advice on implementing control input!  I may upload the project to some site when I've finished.  Since this competition is at a standstill, it might be neat to do an Airhockey AI programming challenge...

I tried a long while ago... (please excuse the noobishness).


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#224 2012-06-25 19:33:08

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: AI Strategy Tournament: Rescheduled to June 1st

Anyway... is this competition still going on?  Did we decide on Pacman after all?

Offline

 

#225 2012-06-25 21:13:23

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: AI Strategy Tournament: Rescheduled to June 1st

Dunno.  hmm


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

Board footer