Problem with exercise 33

136 views
Skip to first unread message

nskr...@gmail.com

unread,
Dec 16, 2016, 9:00:55 AM12/16/16
to mooc.fi
Hi,

I'm having problems with week 10 exercise 33  on course

Object-Oriented programming with Java, part II.



The link to my work is here: http://paste.mooc.fi/871b8602

Best regards


Supported languages are English and Finnish

   when testing the code i get the following error:
   FAIL: DungeonTest testThatLampsDecreaseWhenCheckingSituation
Tested Dungeon dungeon = new Dungeon(4,4,1,100,false); dungeon.run();
Blinkings of the lamp should decrease by one per one turn. Player can walk around in the darkness as much as  he wants without the lamp battery going decreasing.

  However, when I test my code myself it seems to work. The blinking goes down by one and so one.
  Does anyone know what might cause this?
  here is a link to my code:
http://paste.mooc.fi/871b8602 
 
TMC Plugin has built-in code sharing feature. 
In NetBeans, select TMC -> Send code to TMC pastebin. Copy the link you receive and paste it to your message.  

You may use our web interface to share code snippets: http://paste.mooc.fi

ian.pa...@gmail.com

unread,
Feb 11, 2019, 6:40:14 AM2/11/19
to mooc.fi
Any chance you remember how you solved this? Am having the exact same problem!

ian.pa...@gmail.com

unread,
Feb 11, 2019, 6:52:34 AM2/11/19
to mooc.fi
Just in case it helps anyone else. I solved the issue by moving the line of code that decrements the number of remaining moves to the top of my function. So the number of moves is reduced by one before the player actually moves.
Reply all
Reply to author
Forward
0 new messages