The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Writing Pong Players in Smalltalk

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Keith Ray

Posts: 658
Nickname: keithray
Registered: May, 2003

Keith Ray is multi-platform software developer and Team Leader
Writing Pong Players in Smalltalk Posted: Apr 29, 2006 9:57 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by Keith Ray.
Original Post: Writing Pong Players in Smalltalk
Feed Title: MemoRanda
Feed URL: http://homepage.mac.com/1/homepage404ErrorPage.html
Feed Description: Keith Ray's notes to be remembered on agile software development, project management, oo programming, and other topics.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by Keith Ray
Latest Posts From MemoRanda

Advertisement

Andres Valloud writes about how he won a coding contest for software that played Tennis Pong, Football Pong, Hockey Pong, Multiball Pong, and Super Pong some snips:

[...] The first phase of the contest was about implementing an autonomous player for 4 different versions of Pong. The games ran in a server, which would provide the status of the game in ascii, and accept commands via an URL with arguments.

All this stuff suggests a collaboration of multiple Smalltalk processes. [...] the strategy, which encapsulates the perception process [...] and the action process [...]

[...] the eyes, which take the latest raw status from the perception process and reify objects like balls, bats, the field, the scorecard, etc. [...]

[...] the strategy. It pulls the objects reified by the eyes and produces objectives based on the kind of game and whatever relationships it can perceive between the objects in play. The strategy then pushes objectives for the hands to meet [...]

[...] raw commands are queued by the hands at the interface by means of pushing. The action process pulls these raw commands out of the queue and pushes them to the game server.

All this is great except that the server was designed to not answer a status request until the next frame would start. This means that VW would lock until there was a new status [...]

Since the process scheduler and the processes themselves were nicely written, I changed the inner workings from 5 concurrent Smalltalk threads into 1 by reimplementing one method. Immediately, things started working much better. [...]

Since VW was quite fast even on this slow machine, I could bring up the server and fork off two players. Thus, I could see them play against themselves. I debugged the implementation by looking at the server display. Not the most time efficient manner, but it had to do.

[...]

We had 2 hours to implement this, but I had two Super Pong players competing against each other in about 30 minutes. Overall, I had created a strategy class with a few methods, an objective class with one method, and I had also pushed up a method in the strategy hierarchy. I spent quite a bit of time making sure they would not crash. And the final phase of the contest came to an end.

Read: Writing Pong Players in Smalltalk

Topic: Mocking Static Classes and Members Previous Topic   Next Topic Topic: Dr. Dobbs at the Seaside

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use