<commit_before>'use strict';
var play = require('../engine/play.js');
var Player = require('../model/Player');
var player1, player2;
var timerText;

var plate1, plate2, plate3, plate4, selectSquare, splash, splashtext;
var keyboard;

var sprite;
var players = [];
var foodItems = [
  ["plate1", "plate2"],
  ["plate3", "plate4"]
];

//constants
var GRID_SIZE = 200;
var GRID_COLS = 2;
var SUSPEND = false;
var MAX_PLATES = 1;

var timer = 10; //in seconds
function updateTimer () {
  if (player1.chosen && player2.chosen) {
    timer = 10; // reset it if both players have chosen!
    player1.chosen = false;
    player2.chosen = false;
  } else if (timer <= 0) {
    timer = 10; // reset if 0
    console.log("player 1 [" + player1.score + "]: " + player1.plate.foodItems.toString() + " scored " + play.ratePlate(player1.plate));
    console.log("player 2 [" + player2.score + "]: " + player2.plate.foodItems.toString() + " scored " + play.ratePlate(player2.plate));
    player1.completePlate();
    player2.completePlate();
    player1.addPlate();
    player2.addPlate();
  } else {
    timer -= 1;
  }
  timerText.setText(timer);
}

function getCoords(game, i) {
  var col = i % GRID_COLS;
  var row = Math.floor(i / GRID_COLS);
  var x = game.world.centerX + (col * GRID_SIZE);
  var y = game.world.centerY + (row * GRID_SIZE);
  return [x, y];
}

function getIndex(x, y) {
  return y * GRID_COLS + x;
}

var PlayScene = {
  preload : function () {
  },

  create : function () {
    var game = this.game;
    game.stage.backgroundColor = '#2d2d2d';

    var background = game.add.sprite(0, 0, 'background');
    var woman = game.add.sprite(this.game.width / 2, 90, 'woman_a');
    var table = game.add.sprite(0, 0, 'table');
    var conveyor = game.add.sprite(0, 0, 'conveyorbelt');

    woman.anchor.set(.5, 0);
    woman.scale.set(5, 5);
    woman.animations.add('left', [3, 4, 5, 4]);
    woman.animations.add('right', [6, 7, 8, 7]);
    woman.animations.add('stop', [1]);

    function doTween(thing, state, duration) {
      duration = duration || 3000;
      var tween = game.add.tween(thing).to(state, 3000, Phaser.Easing.Linear.None, true);
      return tween;
    }

    function tweenAndAnimate(sprite, animation, tween, doNext) {
      sprite.animations.play(animation, 3, true);
      tween.onComplete.addOnce(function () {
        sprite.animations.stop(animation, true);
        sprite.animations.play('stop');
        setTimeout(_.partial(doNext, animation), Math.random() * 20 * 1000);
      }, this);
    }

    window.right = function() {
      var tweenRight = doTween(woman, { x: game.width / 2 + 150 })
      tweenAndAnimate(woman, 'right', tweenRight, left);
    };
    window.left = function() {
      var tweenLeft = doTween(woman, { x: game.width / 2 - 150 });
      tweenAndAnimate(woman, 'left', tweenLeft, right);
    };

    right();
    
    var conveyor = game.add.sprite(0, 0, 'conveyorbelt');
    conveyor.frame = 1;
    conveyor.animations.add('move', [0, 1], 2, true);
    conveyor.animations.play('move');
    //to stop the animation, call conveyor.animations.stop();
    conveyor.anchor.setTo(0.5, 0);
    
    //background.anchor.setTo(0.5, 0.5);
    background.height = this.game.height;<commit_msg>Remove extra conveyor belt<commit_after>'use strict';
var play = require('../engine/play.js');
var Player = require('../model/Player');
var player1, player2;
var timerText;

var plate1, plate2, plate3, plate4, selectSquare, splash, splashtext;
var keyboard;

var sprite;
var players = [];
var foodItems = [
  ["plate1", "plate2"],
  ["plate3", "plate4"]
];

//constants
var GRID_SIZE = 200;
var GRID_COLS = 2;
var SUSPEND = false;
var MAX_PLATES = 1;

var timer = 10; //in seconds
function updateTimer () {
  if (player1.chosen && player2.chosen) {
    timer = 10; // reset it if both players have chosen!
    player1.chosen = false;
    player2.chosen = false;
  } else if (timer <= 0) {
    timer = 10; // reset if 0
    console.log("player 1 [" + player1.score + "]: " + player1.plate.foodItems.toString() + " scored " + play.ratePlate(player1.plate));
    console.log("player 2 [" + player2.score + "]: " + player2.plate.foodItems.toString() + " scored " + play.ratePlate(player2.plate));
    player1.completePlate();
    player2.completePlate();
    player1.addPlate();
    player2.addPlate();
  } else {
    timer -= 1;
  }
  timerText.setText(timer);
}

function getCoords(game, i) {
  var col = i % GRID_COLS;
  var row = Math.floor(i / GRID_COLS);
  var x = game.world.centerX + (col * GRID_SIZE);
  var y = game.world.centerY + (row * GRID_SIZE);
  return [x, y];
}

function getIndex(x, y) {
  return y * GRID_COLS + x;
}

var PlayScene = {
  preload : function () {
  },

  create : function () {
    var game = this.game;
    game.stage.backgroundColor = '#2d2d2d';

    var background = game.add.sprite(0, 0, 'background');
    var woman = game.add.sprite(this.game.width / 2, 90, 'woman_a');
    var table = game.add.sprite(0, 0, 'table');

    woman.anchor.set(.5, 0);
    woman.scale.set(5, 5);
    woman.animations.add('left', [3, 4, 5, 4]);
    woman.animations.add('right', [6, 7, 8, 7]);
    woman.animations.add('stop', [1]);

    function doTween(thing, state, duration) {
      duration = duration || 3000;
      var tween = game.add.tween(thing).to(state, 3000, Phaser.Easing.Linear.None, true);
      return tween;
    }

    function tweenAndAnimate(sprite, animation, tween, doNext) {
      sprite.animations.play(animation, 3, true);
      tween.onComplete.addOnce(function () {
        sprite.animations.stop(animation, true);
        sprite.animations.play('stop');
        setTimeout(_.partial(doNext, animation), Math.random() * 20 * 1000);
      }, this);
    }

    window.right = function() {
      var tweenRight = doTween(woman, { x: game.width / 2 + 150 })
      tweenAndAnimate(woman, 'right', tweenRight, left);
    };
    window.left = function() {
      var tweenLeft = doTween(woman, { x: game.width / 2 - 150 });
      tweenAndAnimate(woman, 'left', tweenLeft, right);
    };

    right();

    var conveyor = game.add.sprite(0, 0, 'conveyorbelt');
    conveyor.frame = 1;
    conveyor.animations.add('move', [0, 1], 2, true);
    conveyor.animations.play('move');
    //to stop the animation, call conveyor.animations.stop();
    conveyor.anchor.setTo(0.5, 0);

    //background.anchor.setTo(0.5, 0.5);
    background.height = this.game.height;
{'fraction_non_alphanumeric': 0.16601896471319758, 'fraction_numerical': 0.0310896937665164, 'mean_word_length': 3.1243589743589744, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1644605', 'n_tokens_mistral': 2429, 'n_tokens_neox': 2276, 'n_words': 521}