<commit_before>var highscoreList = new Array();
var highscoreNameList = new Array();
var highscoreLadderList = new Array();

/**
 * @Class
 * @name highscoreState
 * @desc state that shows the highscores you have obtained.
 * @property {fontStyle}	style				 							 -	style of the font in the score.
 * @property {text}	titleStyle				 							 -	style of the font in the screen.
 */
var highscoreState = {
  // Custom "variables".
  style: null,
  titleStyle: null,
  // Phaser functions.

  create: function() {
   var highscoreBackground = game.add.sprite(0, 0,'highscoreBackground');
    style = {};

    //	Font style
		style.font = 'Passion One';
		style.fontSize = 75;
		style.fontWeight = 'bold';

		//	Stroke color and thickness
		style.stroke = '#FFFF00';
		style.strokeThickness = 3;
		style.fill = '#FF2828';

   	titleText = game.add.text(game.world.centerX - 150, 70, "HIGHSCORES");
    //	Font style
		titleText.font = 'Passion One';
		titleText.fontSize = 50;
		titleText.fontWeight = 'bold';
		//	Stroke color and thickness
		titleText.stroke = '#0020C2';
		titleText.strokeThickness = 5;
		titleText.fill = '#2B65EC';

    var escKey = game.input.keyboard.addKey(Phaser.Keyboard.Q);
		escKey.onDown.add(this.goToMain, this);

  		var str_highscore = JSON.parse(localStorage.getItem('highScore'));

  		if (str_highscore == null || str_highscore == "null") {
  		} else {
  			highscoreList = str_highscore;
  			this.checkScoreValues();
  		}




  		var backButton;
		  backButton = game.add.button(100, 100, 'backButton', function() {
		  game.state.start('mainMenu');
		  }, this);
		  backButton.anchor.setTo(0.5, 0.5);
  },

  	/** @method
	* @name addScore
	* @memberof highscoreState
	* @description this is a function that adds a score to the highscore list
	*/
  addScore: function(scoreToAdd) {
    if(typeof scoreToAdd === 'number') {
      if(highscoreList.length >= 9)
      {
        highscoreList.splice(10,1);
      }
      highscoreList.push("\n" +scoreToAdd );

    }
  },
   /** @method
	* @name checkScoreValues
	* @memberof highscoreState
	* @description this is a function checks the scores and in the arrays and displays them on the screen.
	*/
  checkScoreValues: function(){
    highscoreLadderList = []
    var sortedList = highscoreList;
    sortedList.sort( function(a,b) { return b - a; } );
    console.log(sortedList);
      for (var i = 0; i < sortedList.length; i++) {
     highscoreLadderList.push("" + (i+1) + ".\n");
    }
    var scoreText = game.add.text(game.world.centerX - 100 + 100, 200, '', style);
    scoreText.parseList(sortedList);
    var ladderText = game.add.text(game.world.centerX - 100, 300, '', style);
    ladderText.parseList(highscoreLadderList);
  },
    goToMain: function() {
		game.state.start('mainMenu');
  },
};
<commit_msg>changed whitespaces.<commit_after>var highscoreList = new Array();
var highscoreLadderList = new Array();

/**
 * @Class
 * @name highscoreState
 * @desc state that shows the highscores you have obtained.
 * @property {fontStyle}	style				 							 -	style of the font in the score.
 * @property {text}	titleStyle				 							 -	style of the font in the screen.
 */
var highscoreState = {
	// Custom "variables".
	style: null,
	titleStyle: null,

	// Phaser functions.
	create: function() {
		var highscoreBackground = game.add.sprite(0, 0,'highscoreBackground');
		style = {};

		// Font style
		style.font = 'Passion One';
		style.fontSize = 75;
		style.fontWeight = 'bold';

		// Stroke color and thickness
		style.stroke = '#FFFF00';
		style.strokeThickness = 3;
		style.fill = '#FF2828';

		titleText = game.add.text(game.world.centerX - 150, 70, "HIGHSCORES");
		// Font style
		titleText.font = 'Passion One';
		titleText.fontSize = 50;
		titleText.fontWeight = 'bold';

		// Stroke color and thickness
		titleText.stroke = '#0020C2';
		titleText.strokeThickness = 5;
		titleText.fill = '#2B65EC';

		var escKey = game.input.keyboard.addKey(Phaser.Keyboard.Q);
		escKey.onDown.add(this.goToMain, this);

		var str_highscore = JSON.parse(localStorage.getItem('highScore'));

		if (str_highscore == null || str_highscore == "null") {
		} else {
			highscoreList = str_highscore;
			this.checkScoreValues();
		}

		var backButton;
		backButton = game.add.button(100, 100, 'backButton', function() {
			game.state.start('mainMenu');
		}, this);
		backButton.anchor.setTo(0.5, 0.5);
	},

	/** @method
	 * @name addScore
	 * @memberof highscoreState
	 * @description this is a function that adds a score to the highscore list
	 */
	addScore: function(scoreToAdd) {
		if(typeof scoreToAdd === 'number') {
			if(highscoreList.length >= 9) {
				highscoreList.splice(10,1);
			}

			highscoreList.push("\n" +scoreToAdd );
		}
	},

	/** @method
	 * @name checkScoreValues
	 * @memberof highscoreState
	 * @description this is a function checks the scores and in the arrays and displays them on the screen.
	 */
	checkScoreValues: function(){
		highscoreLadderList = []
		var sortedList = highscoreList;
		sortedList.sort( function(a,b) { return b - a; } );
		for (var i = 0; i < sortedList.length; i++) {
			highscoreLadderList.push("" + (i+1) + ".\n");
		}

		var scoreText = game.add.text(game.world.centerX - 100 + 100, 200, '', style);
		scoreText.parseList(sortedList);
		var ladderText = game.add.text(game.world.centerX - 100, 300, '', style);
		ladderText.parseList(highscoreLadderList);
	},

	goToMain: function() {
		game.state.start('mainMenu');
	},
};

{'fraction_non_alphanumeric': 0.14222954420647996, 'fraction_numerical': 0.021233754347428153, 'mean_word_length': 3.3227848101265822, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2844386', 'n_tokens_mistral': 2084, 'n_tokens_neox': 1838, 'n_words': 442}