1 "use strict"; 2 3 function getRooms() 4 { 5 var livingRoom = 6 { 7 name: "living room", 8 brokenThing: "fireplace screen", 9 description: "The leather sofa and fireplace make this a great room for entertaining guests without the distractions of major electronics.", 10 altDescription: "A cozy room. The new fireplace screen keeps the ashes from ruining the floor and burning your guests.", 11 fixWith: "new wire", 12 points: 25, 13 itemFound: "batteries", 14 exits: 15 { 16 north: "dining room", 17 east: "hallway", 18 up: "staircase" 19 }, 20 brokenArray: 21 [ 22 { 23 brokenThing: "sofa", 24 fixWith: "repair kit", 25 points: 30, 26 altDescription: "The fireplace is great to watch now that you can sit comfortably on the sofa again." 27 }, 28 { 29 brokenThing: "lamp", 30 fixWith: "light bulb", 31 points: 15, 32 altDescription: "The room feels so much brighter with the lamp fixed, even without the fireplace aglow." 33 } 34 ], 35 image: 36 { 37 src: "http://coding.stephenjwolf.com/roomadventure/roomimages/livingroom.jpg", 38 caption: "Photo by Outsite Co", 39 link: "https://unsplash.com/photos/R-LK3sqLiBw", 40 linkInfo: "Courtesy: unsplash.com" 41 } 42 }; 43 44 var diningRoom = 45 { 46 name: "dining room", 47 description: "With an expandable table that seats up to ten people, this room is calling out for a party.", 48 altDescription: "It's a lot brighter in here now that the chandelier is lit. Let's eat!", 49 brokenThing: "chandelier", 50 fixWith: "light bulb", 51 points: 15, 52 itemFound: "new wire", 53 exits: 54 { 55 south: "living room", 56 east: "kitchen" 57 }, 58 brokenArray: 59 [ 60 { 61 brokenThing: "plate", 62 fixWith: "new plate", 63 points: 5, 64 altDescription: "The room is a great place to gather for meals, especially with a good set of plates." 65 }, 66 { 67 brokenThing: "chair", 68 fixWith: "folding chair", 69 points: 25, 70 altDescription: "Though not as comfortable as a regular chair, the folding chair lets you sit with family and friends instead of standing for your meals." 71 } 72 ], 73 image: 74 { 75 src: "http://coding.stephenjwolf.com/roomadventure/roomimages/diningroom.jpg", 76 caption: "Photo by Erick Lee Hodge", 77 link: "https://unsplash.com/photos/el_V6z_h5nA", 78 linkInfo: "Courtesy: unsplash.com" 79 } 80 }; 81 82 var kitchen = 83 { 84 name: "kitchen", 85 description: "It needs a little attention, but the kitchen has everything you need to have a snack or host a huge party.", 86 altDescription: "With the faucet fixed, this kitchen is begging to be cooked in.", 87 brokenThing: "faucet", 88 fixWith: "wrench", 89 points: 35, 90 itemFound: "package with color ink", 91 exits: 92 { 93 south: "hallway", 94 west: "dining room", 95 east: "pantry" 96 }, 97 brokenArray: 98 [ 99 { 100 brokenThing: "cabinet", 101 fixWith: "cabinet handle", 102 points: 20, 103 altDescription: "The beautiful kitchen is begging for a great chef to get to work, now that the cabinet is fixed and you can reach the mixing bowls." 104 }, 105 { 106 brokenThing: "refrigerator's ice maker", 107 fixWith: "water filter", 108 points: 35, 109 altDescription: "The refrigerator is the perfect accent to the kitchen. With the new water filter, the ice maker no longer jams and the cubes don't have that funky flavor anymore." 110 } 111 ], 112 image: 113 { 114 src: "http://coding.stephenjwolf.com/roomadventure/roomimages/kitchen.jpg", 115 caption: "Photo by Paul", 116 link: "https://unsplash.com/photos/w2DsS-ZAP4U", 117 linkInfo: "Courtesy: unsplash.com" 118 } 119 }; 120 121 var hallway = 122 { 123 name: "hallway", 124 description: "The hallway helps make the house feel grand, though the old carpet curls up and it's easy to trip over.", 125 altDescription: "With the carpet fixed, you no long trip as you walk this corridor.", 126 brokenThing: "rug", 127 fixWith: "special carpet tape", 128 points: 45, 129 itemFound: "light bulb", 130 exits: 131 { 132 north: "kitchen", 133 east: "office", 134 south: "basement", 135 west: "living room", 136 northeast: "bathroom", 137 southeast: "den" 138 }, 139 brokenArray: 140 [ 141 { 142 brokenThing: "light switch", 143 fixWith: "screwdriver", 144 points: 10, 145 altDescription: "Now that the light switch is reattached to the wall, it's a lot easier to walk the hallway without stumbling." 146 }, 147 { 148 brokenThing: "fire alarm", 149 fixWith: "batteries", 150 points: 35, 151 altDescription: "The hallway feels much more serene now that the fire alarm is working again. There's nothing quite like peace of mind." 152 } 153 ], 154 image: 155 { 156 src: "http://coding.stephenjwolf.com/roomadventure/roomimages/hallway.jpg", 157 caption: "Photo by runnyrem", 158 link: "https://unsplash.com/photos/LfqmND-hym8", 159 linkInfo: "Courtesy: unsplash.com" 160 } 161 }; 162 163 var bathroom = 164 { 165 name: "bathroom", 166 description: "You take pride in your pristine bathroom. It's a relaxing place to take care of necessities.", 167 altDescription: "Though you miss the fun house effect, the bathroom is much more serene with the new mirror.", 168 brokenThing: "mirror", 169 fixWith: "new mirror", 170 points: 20, 171 itemFound: "screwdriver", 172 exits: 173 { 174 southwest: "hallway" 175 }, 176 brokenArray: 177 [ 178 { 179 brokenThing: "toothbrush", 180 fixWith: "new toothbrush", 181 points: 10, 182 altDescription: "The bathroom feels cleaner now that you can brush your teeth properly again. Don't forget to floss!" 183 }, 184 { 185 brokenThing: "soap dispenser", 186 fixWith: "new soap dispenser", 187 points: 20, 188 altDescription: "The gleaming bathroom is even nicer now that you can properly wash your hands again." 189 } 190 ], 191 image: 192 { 193 src: "http://coding.stephenjwolf.com/roomadventure/roomimages/bathroom.jpg", 194 caption: "Photo by Logan Ripley", 195 link: "https://unsplash.com/photos/w8UQkjQ_bS4", 196 linkInfo: "Courtesy: unsplash.com" 197 } 198 }; 199 200 var office = 201 { 202 name: "office", 203 description: "This place is a mess. It's a wonder you ever get any work done in here.", 204 altDescription: "The messy desk is still a mess, but at least you can print up more color pictures of your cats.", 205 brokenThing: "color printer", 206 fixWith: "package with color ink", 207 points: 40, 208 itemFound: "garbage bag", 209 exits: 210 { 211 west: "hallway" 212 }, 213 brokenArray: 214 [ 215 { 216 brokenThing: "ceiling fan light", 217 fixWith: "light bulb", 218 points: 25, 219 altDescription: "The room may still be a mess but with the light fixed, at least you see everything again." 220 }, 221 { 222 brokenThing: "air conditioner", 223 fixWith: "clean air filter", 224 points: 20, 225 altDescription: "Winter, Spring, Summer, or Fall, you do your best work when the air conditioner filters the air. Ahh, it's great in here." 226 } 227 ], 228 image: 229 { 230 src: "http://coding.stephenjwolf.com/roomadventure/roomimages/office.jpg", 231 caption: "Photo by Annie Spratt", 232 link: "https://unsplash.com/photos/FSFfEQkd1sc", 233 linkInfo: "Courtesy: unsplash.com" 234 } 235 }; 236 237 var basement = 238 { 239 name: "basement", 240 description: "You hide your eyes behind your hands so you don't have to see everything that's out of place down here.", 241 altDescription: "It's hard to see amidst the clutter, but at least the door isn't squeaky and creepy any more.", 242 brokenThing: "door hinge", 243 fixWith: "screwdriver", 244 points: 30, 245 itemFound: "catnip", 246 exits: 247 { 248 north: "hallway" 249 }, 250 brokenArray: 251 [ 252 { 253 brokenThing: "bicycle tire", 254 fixWith: "repair kit", 255 points: 30, 256 altDescription: "The fireplace is great to watch now that you can sit comfortably on the sofa again." 257 }, 258 { 259 brokenThing: "shelving unit", 260 fixWith: "nut and bolt", 261 points: 35, 262 altDescription: "The basement feels more organized now that the shelving unit is fixed and some of the stuff on the floor has been put away." 263 } 264 ], 265 image: 266 { 267 src: "http://coding.stephenjwolf.com/roomadventure/roomimages/basement.jpg", 268 caption: "Photo by S W", 269 link: "https://unsplash.com/photos/mNWsZDYUCFs", 270 linkInfo: "Courtesy: unsplash.com" 271 } 272 }; 273 274 var den = 275 { 276 name: "den", 277 description: "The den is a comfortable spot to watch TV and catch up on the latest movies.", 278 altDescription: "The TV and surround sound are much more enjoyable now that the remote control is working.", 279 brokenThing: "TV remote", 280 fixWith: "batteries", 281 points: 10, 282 itemFound: "wrench", 283 exits: 284 { 285 northwest: "hallway", 286 south: "cat den" 287 }, 288 brokenArray: 289 [ 290 { 291 brokenThing: "window", 292 fixWith: "pane of glass", 293 points: 30, 294 altDescription: "The den is comfortable now that the window is fixed and you can control the temperature again." 295 }, 296 { 297 brokenThing: "massage chair", 298 fixWith: "extension cord", 299 points: 20, 300 altDescription: "The den is a haven where you can watch movies in style, eating popcorn, and enjoying a massage with the Massage-o-Matic 9000." 301 } 302 ], 303 image: 304 { 305 src: "http://coding.stephenjwolf.com/roomadventure/roomimages/den.jpg", 306 caption: "Photo by Daniel Barnes", 307 link: "https://unsplash.com/photos/z0VlomRXxE8", 308 linkInfo: "Courtesy: unsplash.com" 309 } 310 }; 311 312 var catDen = 313 { 314 name: "cat den", 315 description: "An offshoot of another room, the cat den is a place the cats come to play, nap, and meow merrily.", 316 altDescription: "The cats are rolling around with the catnip one minute, then crashing in a napping heap the next. This spot is a little place of heaven.", 317 brokenThing: "cat toy", 318 fixWith: "catnip", 319 points: 100, 320 itemFound: "new mirror", 321 exits: 322 { 323 north: "den" 324 }, 325 brokenArray: 326 [ 327 { 328 brokenThing: "cat tower", 329 fixWith: "sisal", 330 points: 50, 331 altDescription: "The cats love this room and claw at the sisal every time they walk past it. So much better than ruining the furniture." 332 }, 333 { 334 brokenThing: "treat dispenser", 335 fixWith: "plastic tray", 336 points: 15, 337 altDescription: "Happy cats mean happy houses. The automatic treat dispenser works again and Merlin, Monty, and Shadow can get a little snack throughout the day again when needed." 338 } 339 ], 340 image: 341 { 342 src: "http://coding.stephenjwolf.com/roomadventure/roomimages/catden.jpg", 343 caption: "Photo by Jonathan Fink", 344 link: "https://unsplash.com/photos/Sa1z1pEzjPI", 345 linkInfo: "Courtesy: unsplash.com" 346 } 347 }; 348 349 var pantry = 350 { 351 name: "pantry", 352 description: "You have all shelves organized so you can find the food supplies you need.", 353 altDescription: "With the spaghetti cleaned up, the shelves look perfect once again.", 354 brokenThing: "box of spaghetti", 355 fixWith: "garbage bag", 356 points: 15, 357 itemFound: "special carpet tape", 358 exits: 359 { 360 west: "kitchen" 361 }, 362 brokenArray: 363 [ 364 { 365 brokenThing: "jar of sauce", 366 fixWith: "soap and sponge", 367 points: 30, 368 altDescription: "The pantry is clean again and there's no evidence of the spilled sauce on the shelves." 369 }, 370 { 371 brokenThing: "spice rack", 372 fixWith: "new spice rack", 373 points: 20, 374 altDescription: "The new spice rack sits perfectly among the boxes of pasta, the mason jars of sauce, and the 25 pound bag of rice." 375 } 376 ], 377 image: 378 { 379 src: "http://coding.stephenjwolf.com/roomadventure/roomimages/pantry.jpg", 380 caption: "Photo by Annie Spratt", 381 link: "https://unsplash.com/photos/SvBnIWiLbcQ", 382 linkInfo: "Courtesy: unsplash.com" 383 } 384 }; 385 386 var smallHall = 387 { 388 name: "small hall", 389 description: "It's a small landing that helps keep the other rooms separated.", 390 altDescription: "You nailed down the loose plank and now it's quiet as ever.", 391 brokenThing: "creaky floor", 392 fixWith: "hammer and nail", 393 points: 45, 394 itemFound: "drawer handle", 395 exits: 396 { 397 west: "bedroom", 398 east: "exercise room", 399 down: "staircase" 400 }, 401 brokenArray: 402 [ 403 { 404 brokenThing: "shoelace", 405 fixWith: "new laces", 406 points: 10, 407 altDescription: "With your laces fixed, the landing looks a little neater." 408 }, 409 { 410 brokenThing: "stool leg", 411 fixWith: "glue", 412 points: 25, 413 altDescription: "The glue really secured the stool leg. Now it doesn't wobble when you tie your shoes." 414 } 415 ], 416 image: 417 { 418 src: "http://coding.stephenjwolf.com/roomadventure/roomimages/smallhall.jpg", 419 caption: "Photo by Christopher Burns", 420 link: "https://unsplash.com/photos/56tCOHi5OzA", 421 linkInfo: "Courtesy: unsplash.com" 422 } 423 }; 424 425 var exercise = 426 { 427 name: "exercise room", 428 description: "It's a great place to work up a sweat and stay in shape.", 429 altDescription: "With the spaghetti cleaned up, the shelves look perfect once again.", 430 brokenThing: "scent in the air", 431 fixWith: "air freshener", 432 points: 35, 433 itemFound: "hammer and nail", 434 exits: 435 { 436 west: "small hall" 437 }, 438 brokenArray: 439 [ 440 { 441 brokenThing: "exercise mat", 442 fixWith: "sheet of foam", 443 points: 20, 444 altDescription: "The sheet of foam not only cushions your feet, it also reduces some of the noise." 445 }, 446 { 447 brokenThing: "rowing machine", 448 fixWith: "pull cord", 449 points: 50, 450 altDescription: "The rowing machine works again, thanks to the new cord. You've got to get ready for crew!" 451 } 452 ], 453 image: 454 { 455 src: "http://coding.stephenjwolf.com/roomadventure/roomimages/exercise.jpg", 456 caption: "Photo by Jesper Aggergaard", 457 link: "https://unsplash.com/photos/A97SnfANLeY", 458 linkInfo: "Courtesy: unsplash.com" 459 } 460 }; 461 462 var bedroom = 463 { 464 name: "bedroom", 465 description: "It's the most relaxing place you can imagine. And it's almost perfect.", 466 altDescription: "Once you pull the covers, you drift off to the most wondrous of places now that the room is perfect.", 467 brokenThing: "dresser drawer", 468 fixWith: "drawer handle", 469 points: 25, 470 itemFound: "air freshener", 471 exits: 472 { 473 east: "small hall" 474 }, 475 brokenArray: 476 [ 477 { 478 brokenThing: "pillow", 479 fixWith: "needle and thread", 480 points: 20, 481 altDescription: "The pillow is fixed and ready for you to rest your head and drift off to sleep." 482 }, 483 { 484 brokenThing: "curtain", 485 fixWith: "curtain rod", 486 points: 35, 487 altDescription: "Now you can pull the curtains closed easily and block out the street light so you can sleep deeply." 488 } 489 ], 490 image: 491 { 492 src: "http://coding.stephenjwolf.com/roomadventure/roomimages/bedroom.jpg", 493 caption: "Photo by Michael D Beckwith", 494 link: "https://unsplash.com/photos/XgOr3b5OOpc ", 495 linkInfo: "Courtesy: unsplash.com" 496 } 497 }; 498 499 var staircase = 500 { 501 name: "staircase", 502 description: "It's your favorite place to sit with a glass of iced tea. It's also convenient for getting up and downstairs.", 503 altDescription: null, 504 brokenThing: null, 505 fixWith: null, 506 points: 0, 507 itemFound: null, 508 exits: 509 { 510 down: "living room", 511 up: "small hall" 512 }, 513 brokenArray: [], 514 image: 515 { 516 src: "http://coding.stephenjwolf.com/roomadventure/roomimages/staircase.jpg", 517 caption: "Photo by Won Young Park", 518 link: "https://unsplash.com/photos/zn7rpVRDjIY", 519 linkInfo: "Courtesy: unsplash.com" 520 } 521 }; 522 523 //****************************** 524 //finish the getRooms() function 525 //****************************** 526 527 var rooms = {}; 528 rooms[livingRoom.name] = livingRoom; 529 rooms[diningRoom.name] = diningRoom; 530 rooms[kitchen.name] = kitchen; 531 rooms[hallway.name] = hallway; 532 rooms[bathroom.name] = bathroom; 533 rooms[office.name] = office; 534 rooms[basement.name] = basement; 535 rooms[den.name] = den; 536 rooms[catDen.name] = catDen; 537 rooms[pantry.name] = pantry; 538 rooms[smallHall.name] = smallHall; 539 rooms[bedroom.name] = bedroom; 540 rooms[exercise.name] = exercise; 541 rooms[staircase.name] = staircase; 542 543 return rooms; 544 } 545