Assignment 3: Adventure Game

Due: Tuesday, 9/29/26, before class.

Goal

Build a small text-based adventure game: a world made of rooms that the player can walk around in. Everything the player sees should be generated by JavaScript from data you write (objects and arrays) and rendered onto the page, exactly the way the in-class Adventure Game Demo does it, just with a bigger world and your own writing.

The core of this assignment is the demo's pattern, plus at least one of the Challenges at the bottom of this page. The requirements get you a working game; the challenges are where you push past what the demo handed you, so a top grade means several of them, done well. One rock-solid challenge beats three half-finished ones.

This assignment intentionally restricts you to a small, specific toolbox (below). The point isn't necessarily the game itself; it's leaving this assignment able to understand everything in the toolbox. A flashier game built with tools outside the list is not what I am looking for.

Requirements

  1. A world of rooms
    One JavaScript object, keyed by room id, holding at least 4 rooms. Each room needs a name, a description, and a linkedRooms array holding the ids of the rooms you can travel to from there. Rooms should connect in both directions, so the player can never get stuck in a dead end.
  2. One render function
    A single function that takes a room object and draws it: a heading for the name, a paragraph for the description, and one button per linked room. Everything is built with createElement and append into one container div. There should be no room content typed into your HTML file.
  3. Working navigation
    Clicking an exit button moves the player to that room. Use addEventListener with a "click" handler, and figure out which room was picked from e.target, like the demo does. Keep track of which room the player is currently in with a variable.
  4. Styling
    Box model (padding, margin, border, border-radius), flexbox for layout, and consider using :hover on buttons, all in style.css.
  5. At least one challenge
    Pick one from the Challenges list below and build it into your game. One is the minimum for a complete assignment. Doing several is what separates a good submission from a top one.

Allowed Tools

This assignment is graded partly on staying inside this list. It is, on purpose, just about exactly what the demo uses.

Challenges

You must complete at least one of these. Which one is up to you, and they're in no particular order, so pick whatever sounds fun for the game you're building. Each one goes past what the demo showed you, so expect to work something out on your own. We'll cover all of them in class before long.

One challenge, finished and working, is a complete assignment. Getting into the top of the grade range means several of them, integrated into the game rather than bolted on the side. Quality counts more than count here: two challenges that genuinely work beat four that are half-wired.

Challenges are the one place you may reach past the Allowed Tools list, but only for what they actually need: .push(), .value, input type="text", classList, and "mouseover" listeners. Everything else still applies: let/const, classic for loops, the function keyword, and no libraries.

A Note on Generative AI

Do not use ChatGPT, Copilot, Claude, or any other generative AI tool to write any part of this assignment. The whole point of the restricted toolbox above is to build real fluency with these exact foundational aspects of front end programming. We'll get to fancy stuff soon enough.

File and Folder Setup

Same rules as before: folder and file names must match exactly. This assignment needs three files, all inside a new 03-adventure-game folder:

csc336-fall2026/
└── assignments/
    └── 03-adventure-game/
        ├── index.html
        ├── style.css
        └── script.js

Once pushed, your assignment will be visible at:
https://<your-username>.github.io/csc336-fall2026/assignments/03-adventure-game/

Helpful Resources

What to Submit

Nothing to submit directly. Your assignment should be publicly available at the address in File and Folder Setup above once you've committed and pushed.