fork download
  1. var superBlinders = [ ["Firestorm", 4000], ["Solar Death Ray", 6000], ["Supernova", 12000] ];
  2. var lighthouseRock = {
  3. gateClosed: true,
  4. weaponBulbs: superBlinders,
  5. capacity: 30,
  6. secretPassageTo: "Underwater Outpost",
  7. numRangers: 3,
  8. ranger1: {name: "Nick Walsh", skillz: "magnification burn", station: 2},
  9. ranger2: {name: "Drew Barontini", skillz: "uppercut launch", station: 3},
  10. ranger3: {name: "Christine Wong", skillz: "bomb defusing", station: 1}
  11. };
  12.  
  13. function dontPanic ( location ) {
  14. var msg = "Avast, me hearties!\n" + "There be pirates nearby! Stations!";
  15. for ( var j=0; j<location.numRangers; j++ ) {
  16. var ranger = location["ranger"+(j+1)];
  17. msg += "\n" + ranger.name + ", man the " +
  18. location.weaponBulbs[j][0] + "!";
  19. }
  20. print(msg);
  21. }
  22.  
  23. dontPanic(lighthouseRock);
Success #stdin #stdout 0.01s 4984KB
stdin
Standard input is empty
stdout
Avast, me hearties!
There be pirates nearby! Stations!
Nick Walsh, man the Firestorm!
Drew Barontini, man the Solar Death Ray!
Christine Wong, man the Supernova!