let currentRoom = null; function updateDisplay() { document.getElementById("location").innerHTML = currentRoom.name; } function move(direction) { let target = currentRoom.exits[direction]; if (target == null) { alert("Tried to move to an empty room!"); return; } else { currentRoom = target; update(["You move to " + currentRoom.name]); updateDisplay(); } } window.addEventListener('load', function(event) { loadCompass(); currentRoom = createWorld(); updateDisplay(); }); function update(lines=[]) { let log = document.getElementById("log"); for (let i=0; i