{ "metadata": { "name": "", "signature": "sha256:374900202f4f7c3f157762c0d012b597cc502efce4de220013e3cc9cd8dfc896" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Hangman 1: set a puzzle\n", "\n", "A fairly traditional hangman game. The computer chooses a word, the (human) player has to guess it without making too many wrong guesses. You'll need to find a list of words to chose from and develop a simple UI for the game (e.g. text only: display the target word with underscores and letters, lives left, and maybe incorrect guesses). \n", "\n", "## Data structures\n", "\n", "* What do we need to track?\n", "* What operations do we need to perform on it?\n", "* How to store it?\n", "\n", "## Creating a game\n", "* 'List' of words to choose from\n", " * Pick one at random\n", "\n", "## Game state\n", "\n", "
Data | \n", "\n", " | Operations | \n", "
---|---|---|
\n", "\n", "* Target word\n", "* Discovered letters\n", " * In order in the word\n", "* Lives left\n", "* Wrong letters?\n", "\n", " | \n", "\n", " | \n", "\n", "* Get a guess\n", "* Update discovered letters\n", "* Update lives\n", "* Show discovered word\n", "* Detect game end, report\n", "* Detect game win or loss, report\n", "\n", " | \n", "