<commit_before>class GameController {
  constructor($window, $log, $scope, $state, $interval, GameService, SocketService, toastr) {
    'ngInject';

    this.$log = $log;
    this.$state = $state;
    this.toastr = toastr;
    this.$window = $window;
    this.$interval = $interval;
    this.GameService = GameService;
    this.SocketService = SocketService;

    this.waitTime = 2000;
    this.questionHidden = true;
    this.question = GameService.getQuestion();
    this.players = GameService.players;
    this.timer = 30;

    $scope.$on('server_disconnect', function(event, args) {
      alert('Server disconnected. Game ended.');
      $state.go('home');
    });

    this.SocketService.extendedHandler = (message) => {
      if (message.type === 'player_disconnect') {
        this.handlePlayerDisconnect(message);
      }
    };

    this.setAnimation();
  }

  isWindowSmall() {
    return this.$window.innerWidth < 800;
  }

  isWarningTime() {
    return this.timer < 10;
  }

  startTimer() {
    this.$interval(() => this.tickTimer(), 1000, this.timer, true);
    //TODO: this.send start timer
  }

  tickTimer() {
    this.timer -= 1;

    if(this.timer === 0) {
      this.endTimer();
    }
  }

  endTimer() {
    this.$log.log("Timer ended");
    //TODO: this.send end timer<commit_msg>Prepare to receive message<commit_after>class GameController {
  constructor(_, $window, $log, $scope, $state, $interval, GameService, SocketService, toastr) {
    'ngInject';

    this._ = _;
    this.$log = $log;
    this.$state = $state;
    this.toastr = toastr;
    this.$window = $window;
    this.$interval = $interval;
    this.GameService = GameService;
    this.SocketService = SocketService;

    this.waitTime = 2000;
    this.questionHidden = true;
    this.question = GameService.getQuestion();
    this.players = GameService.players;
    this.timer = 30;

    $scope.$on('server_disconnect', function(event, args) {
      alert('Server disconnected. Game ended.');
      $state.go('home');
    });

    this.SocketService.extendedHandler = (message) => {
      if (message.type === 'player_disconnect') {
        this.handlePlayerDisconnect(message);

      } else if (message.type === 'answer') {
        const player = _.find(this.players, (p) => p.id === message.player);
        player.lastAnswer = message.answer;
        //TODO: animate player done
      }
    };

    this.setAnimation();
  }

  isWindowSmall() {
    return this.$window.innerWidth < 800;
  }

  isWarningTime() {
    return this.timer < 10;
  }

  startTimer() {
    this.$interval(() => this.tickTimer(), 1000, this.timer, true);
    //TODO: this.send start timer
  }

  tickTimer() {
    this.timer -= 1;

    if(this.timer === 0) {
      this.endTimer();
    }
  }

  endTimer() {
    this.$log.log("Timer ended");
    //TODO: this.send end timer
{'fraction_non_alphanumeric': 0.15517241379310345, 'fraction_numerical': 0.011963406052076003, 'mean_word_length': 2.7605820105820107, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, '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': '6063328', 'n_tokens_mistral': 956, 'n_tokens_neox': 898, 'n_words': 182}