DOM Tutorial Monopoly Questions (Medium)

From Progzoo
Jump to navigation Jump to search

These question concern the monopoly documents. Your code is tested against three different documents and

<!DOCTYPE game SYSTEM "monopoly.dtd">
  <square label='GO'>
   <player id='dog'  cash='1500'/>
   <player id='ship' cash='1500'/>
   <player id='iron' cash='1500'/>
  <square label='Old Kent Road' ref='old-kent-road'/>
  <square label='Community Chest'/>
  <square label='Whitechapel' ref='whitechapel'/>
  <square label='Income Tax (Pay 200)'/>
  <square label="King's Cross Station" ref='kings-cross'/>
  <property id='old-kent-road' price='60'  colour='brown'/>
  <property id='whitechapel'   price='60'  colour='brown'/>
  <station  id='kings-cross'   price='200'/>

How many properties?

Show the number of properties held by player "ship" (count only property - not stations)

[Font] [Default] [Show] [Resize] [History] [Profile]

Move dog 3

Player dog throws a 3. Give the label of the square he will land on.

[Font] [Default] [Show] [Resize] [History] [Profile]

Light blues

If one player holds all properties that are light-blue then give the id of that player. Otherwise give "none".

[Font] [Default] [Show] [Resize] [History] [Profile]

King's cross rent

State the amount due in rent if you land on kings-cross.If the owner of kings-cross has 1 station pay 25, if he has 2 stations pay 50, if 3 stations then 150, if 4 stations pay 200. If the station is owned by the bank pay 0.

[Font] [Default] [Show] [Resize] [History] [Profile]

Dog buys property

Player "dog" throws a 5, lands on a property and buys it. Update the game document to reflect the new state of play.

[Font] [Default] [Show] [Resize] [History] [Profile]