Index of /Software/aspectj/aspectj1.0.4/examples/spacewar

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory  -  
[   ]demo.lst2012-11-01 12:13 308  
[   ]debug.lst2012-11-01 12:13 21  
[TXT]Timer.java2012-11-01 12:13 1.4K 
[TXT]SpaceObject.java2012-11-01 12:13 3.1K 
[TXT]Ship.java2012-11-01 12:13 9.3K 
[TXT]SWFrame.java2012-11-01 12:13 2.7K 
[TXT]Robot.java2012-11-01 12:13 7.3K 
[TXT]RegistrySynchronization.java2012-11-01 12:13 2.0K 
[TXT]Registry.java2012-11-01 12:13 3.8K 
[TXT]Player.java2012-11-01 12:13 3.6K 
[TXT]Pilot.java2012-11-01 12:13 1.1K 
[   ]Makefile2012-11-01 12:13 154  
[TXT]GameSynchronization.java2012-11-01 12:13 1.9K 
[TXT]Game.java2012-11-01 12:13 6.3K 
[TXT]EnsureShipIsAlive.java2012-11-01 12:13 1.0K 
[TXT]EnergyPacketProducer.java2012-11-01 12:13 1.8K 
[TXT]EnergyPacket.java2012-11-01 12:13 1.2K 
[TXT]Display2.java2012-11-01 12:13 4.1K 
[TXT]Display1.java2012-11-01 12:13 6.8K 
[TXT]Display.java2012-11-01 12:13 5.1K 
[TXT]Debug.java2012-11-01 12:13 6.6K 
[TXT]Bullet.java2012-11-01 12:13 1.3K 

Space War

© Copyright 1997-2001 Xerox Corporation. All rights reserved.

Last updated: January 10, 2001

 

Exploring the Spacewar Example

The code in this directory is an implementation of the classic video game Spacewar.

The Spacewar game is intended to provide a modest-sized example of a program that uses aspects. The code for this example is evolving, as we add new features to AspectJ and come up with a better understanding of how to use the features.

In order to compile and run this example, make sure to have the latest version of AspectJ correctly installed. If you're not sure you do, try the helloworld example first by following the instructions in Primer section Getting Started.

Compiling Spacewar

Running Spacewar

When the game starts up you will see two different displays. These are the two built-in display aspects of the game. In each you will see a single white ship and two red ships. The white ship is yours to control; the red ships are an enemy robots. Your ship is controlled with the four arrow keys to turn, thrust and stop; the spacebar fires. As you play, the game will be displayed in both windows.

You can quit the game with ctl-Q.

Exploring the Code

There is one other built-in configurations for the Spacewar game. Try it by typing ajc @spacewar\debug.lst. This compiles in an elaborate debugging aspect for the game.

We recommend you explore the Spacewar source code and look at the aspects that it uses. You will find several of them, of different scales and different degrees of cross-cutting. Remember that these represent our evolving understanding of how to use AspectJ to implement Spacewar. If you believe we should be doing something differently, then please let us know.