<commit_before>define([
    'model/Player'
], function(Player) {

  'use strict';

  var DIMENSIONS = {
    width: 768,
    height: 640
  };
  var ROOMS = {
    1: {background: 'blue', doors: {east: 2, south: 3}},
    2: {background: 'black', doors: {west: 1, south: 4}},
    3: {background: 'yellow', doors: {east: 4, north: 1}},
    4: {background: 'green', doors: {west: 3, north: 2}}
  };

  var _viewAdpt;
  var _player;
  var _currentRoom;

  function getDimensions() {
    return DIMENSIONS;
  }

  function getGateways() {
    return {north: 1,
            east: 2,
            south: 3,
            west: 4}
  }

  function start() {
    _player = new Player();
    _player.installViewAdpt(_viewAdpt.makePlayerViewAdpt(_player));
  }

  function onDoorVisit(doorID) {
    if (doorID === 'north') {
      _player.setY(DIMENSIONS.height - 65);
    } else if (doorID === 'east') {
      _player.setX(32);
    } else if (doorID === 'south') {
      _player.setY(32);
    } else if (doorID === 'west') {
      _player.setX(DIMENSIONS.width - 65);
    }

    var gateways = _currentRoom['gatewaysOut']; // This apparently needs to exist or else error?
    for (var i = 0; i < gateways.length; i++) {
      if (_currentRoom['gatewaysOut'][i]['direction'] === doorID) {
        // get ID of room player is going to
        var id = _currentRoom['gatewaysOut'][i]['roomTo'];
        console.log("Entering room " + id);
        break;
      }
    }

    fetchRoom(id, function (room){
      var doors = {};
      for (var i = 0; i < room['gatewaysOut'].length; i++) {
        var gateway = room['gatewaysOut'][i];
        doors[gateway['direction']] = gateway['roomTo'];
      }
      _currentRoom = room;
      var roomConfig = {background: room.name, doors: doors};
      _viewAdpt.loadRoom(roomConfig);
    });
    
  }

  function fetchRoom(roomID, cb) {<commit_msg>Cleaned up for loop in onDoorVisit<commit_after>define([
    'model/Player'
], function(Player) {

  'use strict';

  var DIMENSIONS = {
    width: 768,
    height: 640
  };
  var ROOMS = {
    1: {background: 'blue', doors: {east: 2, south: 3}},
    2: {background: 'black', doors: {west: 1, south: 4}},
    3: {background: 'yellow', doors: {east: 4, north: 1}},
    4: {background: 'green', doors: {west: 3, north: 2}}
  };

  var _viewAdpt;
  var _player;
  var _currentRoom;

  function getDimensions() {
    return DIMENSIONS;
  }

  function getGateways() {
    return {north: 1,
            east: 2,
            south: 3,
            west: 4}
  }

  function start() {
    _player = new Player();
    _player.installViewAdpt(_viewAdpt.makePlayerViewAdpt(_player));
  }

  function onDoorVisit(doorID) {
    if (doorID === 'north') {
      _player.setY(DIMENSIONS.height - 65);
    } else if (doorID === 'east') {
      _player.setX(32);
    } else if (doorID === 'south') {
      _player.setY(32);
    } else if (doorID === 'west') {
      _player.setX(DIMENSIONS.width - 65);
    }

    for (var i = 0; i < _currentRoom.gatewaysOut.length; i++) {
      if (_currentRoom.gatewaysOut[i].direction === doorID) {
        // get ID of room player is going to
        var id = _currentRoom.gatewaysOut[i].roomTo;
        console.log("Entering room " + id);
        break;
      }
    }

    fetchRoom(id, function (room){
      var doors = {};
      for (var i = 0; i < room['gatewaysOut'].length; i++) {
        var gateway = room['gatewaysOut'][i];
        doors[gateway['direction']] = gateway['roomTo'];
      }
      _currentRoom = room;
      var roomConfig = {background: room.name, doors: doors};
      _viewAdpt.loadRoom(roomConfig);
    });
    
  }

  function fetchRoom(roomID, cb) {
{'fraction_non_alphanumeric': 0.15930169121658483, 'fraction_numerical': 0.01745771958537916, 'mean_word_length': 2.5259615384615386, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '214623', 'n_tokens_mistral': 1339, 'n_tokens_neox': 1247, 'n_words': 314}