T-106.1212 Grundkurs i programmering

Rond 10, uppgift 2

Nivå och poängvärde:B 120
Kort beskrivning:Vi kompletterar ett textäventyrsspel med föremål och kommandon relaterade till dem.
Vad vi lär oss:Att gestalta större programhelheter, användning av avbildningar, slingor och strängar.
Frihet i implementationen:Medel. Programmets allmänna struktur är definierad men lösningen kan och bör man hitta på själv.
Realism:Hög. Här försöker man skapa en klass enligt en viss specifikation, vilket är ett vanligt uppdrag.
Utmaning:Svår. Det är inte lätt att förstå en större programhelhet och det tar en tid att vänja sig vid avbildningar också.
Arbetsmängd:Tämligen mycket. Även om man inte behöver skriva så många rader kod, tar det tid att planera, skriva och testa metoderna. De flesta behöver kanske fem timmar, men det kan vara bra att reservera lite till tid.

Uppgiftsbeskrivning

I projektet Adventure finns en implementation av ett enkelt textäventyrsspel. Er uppgift är att komplettera spelet med föremål. Närmare bestämt:

Ni måste lägga till några metoder i de givna klasserna för att implementera sakerna ovan. Mer detaljerad information finns (som alltid) i dokumentationen.

Nedan finns ett exempel på hur spelet ska se ut när ändringarna är gjorda.

Inlämning

Lämna in koden i Goblin som vanligt.

Råd och tips

Exempel

Spelarens kommandon är rödfärgade.

You are lost in the woods. Find your way back home.
Better hurry, 'cause Buffy's on real soon now. And you can't miss Buffy, right?


Forest
------
You are somewhere in the forest. There are a lot of trees here.
Birds are singing.

Possible directions: west east north south


Command: go east
You go east.


Tangle of Bushes
----------------
You are in a dense tangle of bushes. It's hard to see exactly where you're going.

Possible directions: west east north south


Command: go east
You go east.


Home
----
Home sweet home! Now the only thing you need is a working remote control...

Possible directions: west


Command: inventory
You are empty-handed.


Home
----
Home sweet home! Now the only thing you need is a working remote control...

Possible directions: west


Command: go east
You can't go east.


Home
----
Home sweet home! Now the only thing you need is a working remote control...

Possible directions: west


Command: go west
You go west.


Tangle of Bushes
----------------
You are in a dense tangle of bushes. It's hard to see exactly where you're going.

Possible directions: west east north south


Command: get remote
There is no remote here to pick up.


Tangle of Bushes
----------------
You are in a dense tangle of bushes. It's hard to see exactly where you're going.

Possible directions: west east north south


Command: go west
You go west.


Forest
------
You are somewhere in the forest. A tangle of bushes blocks further passage north.
Birds are singing.

Possible directions: west east south


Command: go west
You go west.


Forest Clearing
---------------
You are at a small clearing in the middle of forest.
Nearly invisible, twisted paths lead in many directions.
You see here: battery

Possible directions: west east north south


Command: examine battery
If you want to examine something, you need to pick it up first.


Forest Clearing
---------------
You are at a small clearing in the middle of forest.
Nearly invisible, twisted paths lead in many directions.
You see here: battery

Possible directions: west east north south


Command: get battery
You pick up the battery.


Forest Clearing
---------------
You are at a small clearing in the middle of forest.
Nearly invisible, twisted paths lead in many directions.

Possible directions: west east north south


Command: inventory
You are carrying:
battery


Forest Clearing
---------------
You are at a small clearing in the middle of forest.
Nearly invisible, twisted paths lead in many directions.

Possible directions: west east north south


Command: examine battery
You look closely at battery.
It is a small battery cell. Looks new.


Forest Clearing
---------------
You are at a small clearing in the middle of forest.
Nearly invisible, twisted paths lead in many directions.

Possible directions: west east north south


Command: go south
You go south.


Forest
------
The forest just goes on and on.
You see here: remote

Possible directions: west east north south


Command: get remote
You pick up the remote.


Forest
------
The forest just goes on and on.

Possible directions: west east north south


Command: examine remote
You look closely at remote.
It is the remote control for your TV.
What it was doing in the forest, you have no idea.
Problem is, there's no battery.


Forest
------
The forest just goes on and on.

Possible directions: west east north south


Command: inventory
You are carrying:
battery
remote


Forest
------
The forest just goes on and on.

Possible directions: west east north south


Command: go east
You go east.


Tangle of Bushes
----------------
You are in a dense tangle of bushes. It's hard to see exactly where you're going.

Possible directions: west east north south


Command: drop remot
You don't have that!


Tangle of Bushes
----------------
You are in a dense tangle of bushes. It's hard to see exactly where you're going.

Possible directions: west east north south


Command: drop remote
You drop the remote.


Tangle of Bushes
----------------
You are in a dense tangle of bushes. It's hard to see exactly where you're going.
You see here: remote

Possible directions: west east north south


Command: drop remote
You don't have that!


Tangle of Bushes
----------------
You are in a dense tangle of bushes. It's hard to see exactly where you're going.
You see here: remote

Possible directions: west east north south


Command: go east
You go east.


Home
----
Home sweet home! Now the only thing you need is a working remote control...

Possible directions: west


Command: go west
You go west.


Tangle of Bushes
----------------
You are in a dense tangle of bushes. It's hard to see exactly where you're going.
You see here: remote

Possible directions: west east north south


Command: get remot
There is no remot here to pick up.


Tangle of Bushes
----------------
You are in a dense tangle of bushes. It's hard to see exactly where you're going.
You see here: remote

Possible directions: west east north south


Command: get remote
You pick up the remote.


Tangle of Bushes
----------------
You are in a dense tangle of bushes. It's hard to see exactly where you're going.

Possible directions: west east north south


Command: go east
You go east.

Home at last... and phew, just in time! Well done!