Landing on the Moon with Large Language Models

Overview


In this part, we walk through creating a version of the classic Lunar Lander game heavily relying on Large Language Models. The Lunar Lander game involves controlling a spacecraft that must land safely on the moon’s surface. The player controls the thrust and potentially direction of the spacecraft to manage the descent and to avoid crashing.

The chapters in this part are centered around prompting a Large Language Model to create a Lunar Lander game in Python using PyGame. The model used is GPT-4o. The structure of this part is as follows.

  • In Requirements Gathering, we prompt the large language model to identify requirements for the Lunar Lander game (skipping the majority of the requirements engineering process, which is normally a crucial part of software development).

  • In Application Design, we prompt the large language model for a class-level design of the game.

  • In Implementation, we prompt the large language model for the actual implementation based on the design.

  • In Landing with AI, we prompt the large language model to generate an AI controller plays the Lunar Lander game.

  • In Landing with Learning AI, we prompt the large language model to generate an AI controller that learns to play the Lunar Lander game through practice.

Note that the interaction may feel a bit chaotic at times, as the model may not always understand the context or the constraints of the problem. However, the goal is to show how large language models can be used to generate code for a game, and to implicitly highlight challenges and opportunities that come with it.

In the first version of the course, before the release of e.g. GPT-4o, creating a lunar lander game was significantly trickier. Although this is now easier, there are still some challenges with building a learning AI, as we observe later.