HW13: Lunar Lander II

15 points; due Wed 5/21 @ 9am.

Goals

The goal of this assignment is to get some practice working with well-modularized code that follows the Model/View/Controller design principle.

Setup and Requirements

This is an individual assignment.

Make a copy of your whole lander directory from last time; maybe call it lander2. You will be further modifying the code that you wrote and worked with in the previous assignment.

Making a Better Interface

At the end of the last assignment, you had a working Lunar Lander game with a text-based interface. This is pretty cool, but also a little boring to play. Let's update it so that it uses a graphical interface.

First, change your LanderGame's constructor so that it initializes its interface to a GraphicLanderInterface. Once you've done that, you should be able to play the game using the bare-bones graphical interface.

There are a few problems with the current graphical interface, however: There's no way to set any thrust. Currently, any mouse click just inputs 0 for thrust amount. There is no display of lander information other than a shape drawn that shows a “lander” above a surface. When the lander lands, the program simply closes down in an unsatisfying way.

Fortunately, you are here to fix these problems! You will need to alter the GraphicLanderInterface class.

  1. Have two buttons appear when the user is asked for a thrust amount. Have one labeled “thrust” and the other labeled “no thrust”. Depending on which button is clicked, have the interface return 0 or 1.
  2. When the show_info() method is called, also display on the graphical window the lander's current status. Show Fuel, Velocity and Altitude.
  3. Change the end-game methods so that they move the lander shape to be on the moon's surface, and then display a short message in the graphical window. Also wait for a user mouse-click before continuing.

If you've done all that, you should have a playable grahpical lunar lander game.

Adding More

This interface is still kind of lacking, though. So, for the bulk of the points on this assignment, really spruce it up. Add some of the following things:

To get full credit for the “additional features” part of this assignment, you need to add at least four of these things.

Grading and Submission

Now that you've modified some of the interface code, be sure to add your name to the top of interfaces.py!

Zip up your lander.py and modified interfaces.py into hw13.zip, and submit it via Moodle.

This assignment originally designed by Andy Exley. Thanks for sharing, Andy!