AJSS: CodeInvaders!

During the 2006 ACM-ICPC World Finals in San Antonio, Texas, there is an intermediate programming contest sponsored by IBM.  The Java Challenge showcases the latest offerings from IBM and try it out in a tournament style.  The name of the tournament was CodeInvaders.  It was released in the IBM AlphaWorks site last June 2006.  Here is a short description from its AlphaWorks page:

CodeInvaders is a Javaâ„¢-based, real-time programming game based on the Eclipse platform. It uses the Eclipse platform and a simple API that allows users unfamiliar with Java to easily compete while they learn the language. CodeInvaders Challenge gives users the opportunity to pit their Java programming skills against other players in a battle of space conquest. Each player writes a Java class that represents and controls a spaceship. Each ship (class) is placed in a simulated battle along with ships from other players.

One of our ACM coaches, Dr. Vergara realized that this platform can be used to teach Java and object oriented programming for kids in the high school range.  This summer, we teamed up (Akie Mejia, me,Doc V) will conduct a Java programming workshop for the Ateneo Junio Summer Seminar (AJSS).  I installed Eclipse and the CodeInvaders plugin into Doc V’s computer and demonstrated how to use the program.  Then we will meet sometime next week to discuss how we plan to approach the workshop and have some fun programming our own spaceships.

In preparation, I made improvements to our initial solution in the ACM which uses a rent-seeking economy paradigm.  In the game, you get points if your spaceships beam energy to their home planets.  So the Linden BoyZ simply beamed all the energy of the mothership and drones to the home planet and obtained the maximum possible score of 280 points.  Most of the contestants during the World Finals used this approach.  Everybody in the tournament arena just laughed when all teams used this strategy at the same time.

The main improvement compared to our previous strategy is that I applied a “look before you leap” approach.  For the spaceships to move around the field, it requires some key units of energy.  Before the game starts, each ship has a pre allocated amount of energy.  Other energy sources are randomly scattered in the field which can be obtained by the ships.  Therefore, in order to increase the maximum possible score, the programmer must design the ships to gather energy.   The energy consumed from traveling in space is used by the ship’s thrusters.  For every amount of thrust used, energy is used per unit of time. 

The thrust will them change the ship’s accelaration a.  Assuming that the ships will have an initial velocity v of 0 to go to the energy source, the time t to reach  the source can be computed through the kinematic equation

[tex] d = \frac{1}{2} a t^2 [/tex]

where d is the distance from the ship to the energy source.  The energy consumed to travel this distance and back is then computed by dimensional analysis.

Results:

Creating a simulation of 6 teams using my strategy gave me the following scores:

As evidently observed from the screenshot, I was able to surpass the maximum possible score of 280!  The sourcecode for the MySpaceShip.java will be posted later on (the participants of AJSS) might use it.😀

Technorati Tags:

7 Responses to “AJSS: CodeInvaders!”


  1. 1 Chachic 2007 3月 24 1:52 am

    Ang nerdoks mo eh! Madmodez teacher version ka na.

  2. 2 Allan Espinosa 2007 3月 24 1:59 am

    Hehehe. Sobrahan! dami na ngang pinapaayo sa akin ung Dept, pero wala pa akong ID. hahaha

  3. 3 Timothy 2007 9月 10 1:37 pm

    Hi, can I have a sample of your code you mentioned in your blog? I tried to programme but the max score I have is only around 200

  4. 4 Allan Espinosa 2007 9月 10 1:47 pm

    Sure timothy. I will email you my code.

  5. 5 Leo 2007 9月 10 5:44 pm

    Hi allan, izzit possible that u send me your myspaceship.java codes? I’m trying to improve it.

  6. 6 Allan Espinosa 2007 9月 10 7:37 pm

    Hi guys. I uploaded my MySpaceShip.java . Please see the recent entry I posted in response to this post.


  1. 1 My CodeInvaders strategy at R-squared 2007 9月 10 7:35 pmトラックバック より

コメントを残す

以下に詳細を記入するか、アイコンをクリックしてログインしてください。

WordPress.com ロゴ

WordPress.com アカウントを使ってコメントしています。 ログアウト / 変更 )

Twitter 画像

Twitter アカウントを使ってコメントしています。 ログアウト / 変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト / 変更 )

Google+ フォト

Google+ アカウントを使ってコメントしています。 ログアウト / 変更 )

%s と連携中





%d人のブロガーが「いいね」をつけました。