Taso ja pistearvo: | B 120 |
---|---|
Lyhyesti: | Täydennetään tekstiseikkailupeliä esineillä ja niihin liittyvillä käskyillä. |
Mitä opitaan: | Isomman ohjelmakokonaisuuden hahmottamista, sanakirjojen (eli "mäppien" tai hakemistorakenteiden) käyttöä, silmukoiden ja merkkijonojen hyödyntämistä. |
Toteuttamisen vapaus: | Keskitasoa. Ohjelman rakenteen isot linjat ja ratkaistava ongelma on ennalta määrätty tarkasti, mutta ongelman ratkaisutavan voi ja pitääkin päättää itse. |
Realistisuus: | Työskentelytavan osalta korkea. Tässä pyritään luomaan spesifikaation mukaisesti toimivia luokkia, mikä on tyypillinen oikeankin elämän ohjelmointitehtävä. |
Haastavuus: | Haastava. Vähän isomman ohjelmakokonaisuuden hahmottaminen ei ole helpoin mahdollinen tehtävä ja sanakirjojen käyttöönkin pitää vähän totutella. |
Työläys: | Suhteellisen aikaavievä tehtävä. Vaikka kirjoitettavaa koodia ei ole erityisen paljon, vaadittujen metodien suunnitteluun, kirjoittamiseen ja testaukseen menee aikaa. Useimmat aloittelijat selviävät tästä alle viidessä tunnissa, mutta aikaa kannattaa varata varmuuden vuoksi enemmänkin. |
Projektissa Adventure on toteutus yksinkertaiselle tekstiseikkailupelille. Tehtävänne on täydentää peliä esineillä. Tarkemmin sanoen:
Item
,
mutta muut luokat eivät vielä hyödynnä sitä.
Teidän täytyy lisätä muutamia metodeja annettuihin luokkiin saadaksenne ylläolevan toteutettua. Tarkemmat tiedot löytyvät annetusta dokumentaatiosta.
Alempana on esimerkki siitä, miten pelin pitäisi toimia, kun muutokset on tehty.
Palauttakaa koodi Gobliniin tuttuun tapaan.
dictionary
) on merkittävää apua
esineiden tallentamisessa. Huomatkaa, että tässä pelissä esineillä on yksiselitteiset nimet eli kahdella
esineellä ei voi olla samaa nimeä.
Pelaajan antamat komennot on korostettu punaisella.
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!