3

I don't know much about Javascript. Can someone help me with level 4 of Untrusted? I'm not sure how to use the title multiplicity.

5

Make another exit:

map.placeObject(10,10, 'exit');
| improve this answer | |
4

Multiplicity, in programming, refers to relationships between objects.

In this case, it's referring to the relationship between the Map and the Exit:

  • Usually: 1 map has 1 exit.
  • For this level: 1 map can have n (n > 0) exits.

Therefore, simply add another exit (with the map.placeObject() function), and use that instead.

| improve this answer | |
0

What @zero said, this is one level where HasXObjects is not checked. Neither is AtleastXObjects checked.

Go crazy with it. But do try and learn a little Javascript.

| improve this answer | |
0

You could actually still complete this level with the ability to create just one exit. You can do this by creating an exit as mentioned, but then replacing the map variable with one where placeObject does nothing. Then, an error is shown saying which functions are missing, just add these from the actual map:

map.placeObject(map.getWidth() - 5, 5, 'exit');


map = {
        placeObject: function(){},
        getWidth: function(){},
        getHeight: function(){},
        _endOfStartLevelReached: map._endOfStartLevelReached
}
| improve this answer | |
-1

you can put an if(x) in there and the whole loop is bypassed :)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.