Java Programming 2003-2004 Assignment 1 Pong is a simple computer game based on table tennis (ping/pong). The objective of this assignment is for you to produce an Applet to simulate the game for a single user. In the ‘full’ game of Pong two players compete against each other. Each player has control of a paddle, one located on the right hand side of the screen the other on the left. In the single player game of Pong a single paddle is used to return the ball into a three sided playing area. The paddle can be controlled by the mouse or the ??key (up) and?? key (down). This assignment covers elements of learning outcomes 1, 2, 3 and 6 on the module descriptor http://www.uclan.ac.uk/facs/destech/tech/moddes/EL2405.pdf More specifically it will demonstrate your ability to write a graphical applet using threads and listeners to control an animation. The following notes give an outline of the assignment, they then outline a structure for the code (and marking scheme). The action of the ball will be implemented as an autonomous Thread. It will move over the canvas in diagonal paths. It will be deflected by the walls and, in the case of a hit, the paddle. Initially the ball will be positioned in the centre of the playing area. However its initial direction will be random (1 of four eg. Northwest, Northeast, Southwest, Southeast). In the event of a miss by the paddle a beep will be emitted and the ball will be repositioned at the start position, once again the initial direction will be random. You must produce the following classes:- i) class Ball extends Canvas implements Runnable This will move the ball over the surface of the Canvas. It will detect whether or not a wall has been hit and use an instance of the Monitor class to detect whether or not the paddle has been hit. Whenever necessary it will reset the position of the ball to the centre of the playing area. ii) class Paddle extends Canvas This will contain a KeyListener to reposition the paddle in response to presses of the up/down keys. It will inform an instance of the monitor of any change in the paddle position. iii) class Monitor This will record the position of the paddle. It will contain a synchronised method to ensure mutual exclusion of access to the paddle position iv) interface Configuration This will contain global configuration data (e.g. ball size, canvas size etc). v) The applet itself. This will instantiate instances of the above classes, initialise the game and start any threads. Assessment This will be based largely on the quality (readability and reliability) of your code. More specifically marks will be awarded for demonstrating an understanding of:- 1) Java Applets 2) Java Classes 3) Java Interfaces 4) Java Threads 5) The Canvas class Recommendations on the overall class structure (e.g. see above) and instructions on aspects of the language not so far covered will be given during lectures and laboratory sessions as appropriate.