<commit_before>$(document).ready(function() {
  var config = {
    bingoCard: {
      width: 7,
      height: 7,
      size: 49,

    },
    buzzwordCount: 73 	// Anzahl der Buzzwords +1...
  };
  
  var WinBoards = {
	"Horizontal 1" : [0, 1 , 2, 3, 4, 5, 6],
	"Horizontal 2" : [7, 8, 9, 10, 11, 12, 13],
	"Horizontal 3" : [14, 15, 16, 17, 18, 19, 20],
	"Horizontal 4" : [21, 22, 23, 24, 25, 26, 27],
	"Horizontal 5" : [28, 29, 30, 31, 32, 33, 34],
	"Horizontal 6" : [35, 36, 37, 38, 39, 40, 41],
	"Horizontal 7" : [42, 43, 44, 45, 46, 47, 48],
	"Vertikal 1" : [0, 7, 14, 21, 28, 35, 42],
	"Vertikal 2" : [1, 8, 15, 22, 29, 36, 43],
	"Vertikal 3" : [2, 9, 16, 23, 30, 37, 44],
	"Vertikal 4" : [3, 10, 17, 24, 31, 38, 45],
	"Vertikal 5" : [4, 11, 18, 25, 32, 39, 46],
	"Vertikal 6" : [5, 12, 19, 26, 33, 40, 47],
	"Vertikal 7" : [6, 13, 20, 27, 34, 41, 48],
	"Diagonal 1" : [0, 8, 16, 24, 32, 40, 48],
	"Diagonal 2" : [6, 12, 18, 24, 30, 36, 42],
        "Freakshow F": [9, 10, 11, 12, 16, 23, 24, 25, 30, 37],
	"<NAME> (oben links)": [0, 1, 2, 7, 8, 14],
	"<NAME> (oben rechts)": [4, 5, 6, 12, 13, 20],
	"<NAME> (unten rechts)": [34, 40, 41, 46, 47, 48],
	"<NAME> (unten links)": [28, 35, 36, 42, 43, 44],
	"<NAME>": [23, 24, 25, 29, 33, 35, 41, 42, 48],
        "Diamant": [3, 9, 11, 15, 19, 21, 27, 29, 33, 37, 39, 45],
        "AT zeichen": [1, 2, 3, 4, 5, 7, 13, 14, 17, 20, 21, 23, 25, 27, 28, 30, 31, 32, 33, 35, 43, 44, 45, 46, 47, 48],
        "Bierkrug": [8, 11, 12, 15, 18, 20, 22, 25, 27, 29, 32, 33, 36, 39, 44, 45],
        "<NAME>": [0, 6, 42, 48],
	"<NAME>": [11, 15, 33, 37],
	"Saphir": [10, 16, 18, 22, 26, 30, 32, 38],
	"CCC": [1, 2, 7, 14, 18, 19, 21, 27, 29, 30, 33, 41, 46, 47],
	"Knochen": [15, 19, 22, 23, 24, 25, 26, 29, 33],
	"Schluessel": [8, 9, 15, 16, 24, 32, 39, 40],
	"Sternhimmel":[1, 4, 7, 13, 17, 23, 24, 25, 28, 31, 40, 44, 48],
	"Schachbrett": [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47],
	"<NAME>": [16, 18, 30, 32],
	"Hangman": [9, 10, 11, 15, 18, 22, 24, 25, 26, 29, 32, 36, 38, 40, 43],
	"Sinus": [7, 11, 15, 17, 19, 22, 24, 26, 29, 31, 33, 37, 41],
	"Space Invaders": [0, 2, 4, 6, 15, 17, 19, 30, 39, 45, 46, 47],
	"Nethack": [9, 11, 12, 13, 18, 21, 22, 23, 25, 30, 32, 39, 44, 46],
	"Bloecke": [8, 9, 11, 12, 15, 16, 18, 19, 29, 30, 32, 33, 36, 37, 39, 40],
	"Six Pack": [17, 18, 24, 25, 31, 32],
	"<NAME> (unten)": [29, 33, 37, 39, 45],
	"<NAME> (rechts)": [11, 19, 27, 33, 39],
	"<NAME> (oben)": [3, 9, 11, 15, 19],
	"<NAME> (links)": [9, 15, 21, 29, 37],
	"<NAME> (unten rechts)": [26, 33, 38, 39, 40],
	"<NAME> (oben rechts)": [10, 11, 12, 19, 26],
	"<NAME> (oben links)": [8, 9, 10, 15, 22],
	"<NAME> (unten links)": [22, 29, 36, 37, 38],
	"Wuerfel 6": [9, 11, 23, 25, 37, 39],
	"Twin Peaks": [2, 8, 10, 39, 45, 47],
	"Slashes": [16, 19, 22, 25, 28, 31],
	"Ungleich": [16, 18, 22, 26, 30, 32],
	"3er Ecken": [0, 1, 5, 6, 7, 13, 35, 41, 42, 43, 47, 48],
	"Snake": [8, 9, 10, 15, 17, 22, 24, 25, 26, 33, 34, 36],
	"Double Six Pack": [11, 12, 18, 19, 22, 23, 25, 26, 29, 30, 36, 37],
	"Satellit": [8, 12, 16, 17, 18, 23, 25, 30, 31, 32, 36, 40],
	"Bulls_Eye": [9, 10, 11, 15, 19, 22, 24, 26, 29, 33, 37, 38, 39],
	"Schmetterling": [8, 12, 15, 16, 18, 19, 22, 24, 26, 29, 30, 32, 33, 36, 40],
	"Vogelscheuche": [10, 15, 16, 17, 18, 19, 24, 30, 32, 36, 40],
	"Defender": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 14, 23, 35, 36, 38, 39, 40, 42, 43, 44, 45, 46, 47, 48],
	"Jedes 1/4 Dreieck (unten)": [24, 30, 31, 32, 36, 37, 38, 39, 40, 42, 43, 44, 45, 46, 47, 48],
	"Jedes 1/4 Dreieck (links)": [0, 7, 8, 14, 15, 16, 21, 22, 23, 24, 28, 29, 30, 35, 36, 42],
	"Jedes 1/4 Dreieck (oben)": [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 16, 17, 18, 24],
	"Jedes 1/4 Dreieck (rechts)": [6, 12, 13, 18, 19, 20, 24, 25, 26, 27, 32, 33, 34, 40, 41, 48],
	"Tannenbaum": [3, 9, 10, 11, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 29, 31, 33, 38, 44, 45, 46],
	"Monster Bingo": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48],
        "Apfel": [4, 10, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 36, 37, 38, 39, 40, 44, 46]
      }

  
  var wonBingos = new Array(77);
  var UserRejected = new Array(23);
  var totalScore = 0;
  var $bingoBody = $('#BingoBody');
  var PlayMode = false;

  var model = {
    bingoCard: _.fill(new Array(config.bingoCard.size), false)
  };
  
  
  
  init();

  function init() {
    createBingoCard();
    bindEventHandler();
    initBingoCard();
  }

  function createBingoCard() {
    var $row = $('<tr>');

    _.times(config.bingoCard.size, function(i) {
      $cell = $('<td>');
      if(i != 24) {					// 24= Freifeld in der Mitte mit Freakshow Logo
	$cell.attr('id', 'cell' + i);
      }else{
        $cell.attr('id', 'cell24');
      }
      $cell.attr('data-id', i);
      $cell.append($('<img>'));
      $cell.attr('class', 'missing');
      $row.append($cell);

      // Ueberpruefe ob Reihe voll
      if (i % config.bingoCard.width == config.bingoCard.width - 1) {
        $bingoBody.append($row);
        $row = $('<tr>');
      }
    });
  }

  function initBingoCard() {
    var allBingoCards = _.range(1, config.buzzwordCount);
    diff = allBingoCards.filter(function(x) { return UserRejected.indexOf(x) < 0 }); // Benuztzer abgewaehlte buzzwords vom array abziehen	

    // Mische alle Bingo-Karten außer die ausgeschlossenen und Teile alle Karten in Zwei-Teile auf
    var tmp = _.chunk(_.shuffle(diff), config.bingoCard.size - 1);
    var usedBingoCards = tmp[0];
    var missingBingoCards = tmp[1];
    
    setImgOnFree('#cell24', 'frei');
    setImgOn('#cell', usedBingoCards);
    setImgOff('#missing', usedBingoCards);
    setImgOn('#missing', missingBingoCards);
    $("#BingoBody td").removeClass('gelbe_zelle');
    $("#BingoBody td").removeClass('gruene_zelle');
    $("#BingoBody td").removeClass('rote_zelle');
    $("#BuzzwordsBody td").removeClass('rote_zelle');
    setImgOnRejected('#missing', UserRejected);
    wonBingos = [];
    model.bingoCard.length = 0;
  }

  function resetUserdata() {
    UserRejected = [];
    UserRejectedNum = 0;
  }
  
  function setImgOn(htmlId, imgIds) {
    _.times(imgIds.length, function(id) {
      if(id == 24) {					// wenn id 24 erreicht, in cell48 schreiben
	var $elem = $(htmlId + 48);
	$elem.find('img').attr('src', 'images/' + imgIds[id] + '.svg');
	$elem.attr('data-img-id', imgIds[id]);
      }else{
      
      var $elem = $(htmlId + id);
      $elem.find('img').attr('src', 'images/' + imgIds[id] + '.svg');
      $elem.attr('data-img-id', imgIds[id]);
      }
    });
  }
  
    function setImgOnRejected(htmlId, imgIds) {
    _.times(imgIds.length+1, function(id) {
      if(isNaN(imgIds[id])) {
      }else{
      var $elem = $(htmlId + (23-id));
      $elem.find('img').attr('src', 'images/' + imgIds[id] + '.svg');
      $elem.attr('data-img-id', imgIds[id]);
      $elem.addClass("rote_zelle");<commit_msg>Refactor if statement<commit_after>$(document).ready(function() {
  var config = {
    bingoCard: {
      width: 7,
      height: 7,
      size: 49,

    },
    buzzwordCount: 73 	// Anzahl der Buzzwords +1...
  };
  
  var WinBoards = {
	"Horizontal 1" : [0, 1 , 2, 3, 4, 5, 6],
	"Horizontal 2" : [7, 8, 9, 10, 11, 12, 13],
	"Horizontal 3" : [14, 15, 16, 17, 18, 19, 20],
	"Horizontal 4" : [21, 22, 23, 24, 25, 26, 27],
	"Horizontal 5" : [28, 29, 30, 31, 32, 33, 34],
	"Horizontal 6" : [35, 36, 37, 38, 39, 40, 41],
	"Horizontal 7" : [42, 43, 44, 45, 46, 47, 48],
	"Vertikal 1" : [0, 7, 14, 21, 28, 35, 42],
	"Vertikal 2" : [1, 8, 15, 22, 29, 36, 43],
	"Vertikal 3" : [2, 9, 16, 23, 30, 37, 44],
	"Vertikal 4" : [3, 10, 17, 24, 31, 38, 45],
	"Vertikal 5" : [4, 11, 18, 25, 32, 39, 46],
	"Vertikal 6" : [5, 12, 19, 26, 33, 40, 47],
	"Vertikal 7" : [6, 13, 20, 27, 34, 41, 48],
	"Diagonal 1" : [0, 8, 16, 24, 32, 40, 48],
	"Diagonal 2" : [6, 12, 18, 24, 30, 36, 42],
        "Freakshow F": [9, 10, 11, 12, 16, 23, 24, 25, 30, 37],
	"<NAME> (oben links)": [0, 1, 2, 7, 8, 14],
	"<NAME> (oben rechts)": [4, 5, 6, 12, 13, 20],
	"<NAME> (unten rechts)": [34, 40, 41, 46, 47, 48],
	"<NAME> (unten links)": [28, 35, 36, 42, 43, 44],
	"<NAME>": [23, 24, 25, 29, 33, 35, 41, 42, 48],
        "Diamant": [3, 9, 11, 15, 19, 21, 27, 29, 33, 37, 39, 45],
        "AT zeichen": [1, 2, 3, 4, 5, 7, 13, 14, 17, 20, 21, 23, 25, 27, 28, 30, 31, 32, 33, 35, 43, 44, 45, 46, 47, 48],
        "Bierkrug": [8, 11, 12, 15, 18, 20, 22, 25, 27, 29, 32, 33, 36, 39, 44, 45],
        "<NAME>": [0, 6, 42, 48],
	"<NAME>": [11, 15, 33, 37],
	"Saphir": [10, 16, 18, 22, 26, 30, 32, 38],
	"CCC": [1, 2, 7, 14, 18, 19, 21, 27, 29, 30, 33, 41, 46, 47],
	"Knochen": [15, 19, 22, 23, 24, 25, 26, 29, 33],
	"Schluessel": [8, 9, 15, 16, 24, 32, 39, 40],
	"Sternhimmel":[1, 4, 7, 13, 17, 23, 24, 25, 28, 31, 40, 44, 48],
	"Schachbrett": [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47],
	"<NAME>": [16, 18, 30, 32],
	"Hangman": [9, 10, 11, 15, 18, 22, 24, 25, 26, 29, 32, 36, 38, 40, 43],
	"Sinus": [7, 11, 15, 17, 19, 22, 24, 26, 29, 31, 33, 37, 41],
	"Space Invaders": [0, 2, 4, 6, 15, 17, 19, 30, 39, 45, 46, 47],
	"Nethack": [9, 11, 12, 13, 18, 21, 22, 23, 25, 30, 32, 39, 44, 46],
	"Bloecke": [8, 9, 11, 12, 15, 16, 18, 19, 29, 30, 32, 33, 36, 37, 39, 40],
	"Six Pack": [17, 18, 24, 25, 31, 32],
	"<NAME> (unten)": [29, 33, 37, 39, 45],
	"<NAME> (rechts)": [11, 19, 27, 33, 39],
	"<NAME> (oben)": [3, 9, 11, 15, 19],
	"<NAME> (links)": [9, 15, 21, 29, 37],
	"<NAME> (unten rechts)": [26, 33, 38, 39, 40],
	"<NAME> (oben rechts)": [10, 11, 12, 19, 26],
	"<NAME> (oben links)": [8, 9, 10, 15, 22],
	"<NAME> (unten links)": [22, 29, 36, 37, 38],
	"Wuerfel 6": [9, 11, 23, 25, 37, 39],
	"<NAME>": [2, 8, 10, 39, 45, 47],
	"Slashes": [16, 19, 22, 25, 28, 31],
	"Ungleich": [16, 18, 22, 26, 30, 32],
	"<NAME>": [0, 1, 5, 6, 7, 13, 35, 41, 42, 43, 47, 48],
	"Snake": [8, 9, 10, 15, 17, 22, 24, 25, 26, 33, 34, 36],
	"Double Six Pack": [11, 12, 18, 19, 22, 23, 25, 26, 29, 30, 36, 37],
	"Satellit": [8, 12, 16, 17, 18, 23, 25, 30, 31, 32, 36, 40],
	"Bulls_Eye": [9, 10, 11, 15, 19, 22, 24, 26, 29, 33, 37, 38, 39],
	"Schmetterling": [8, 12, 15, 16, 18, 19, 22, 24, 26, 29, 30, 32, 33, 36, 40],
	"Vogelscheuche": [10, 15, 16, 17, 18, 19, 24, 30, 32, 36, 40],
	"Defender": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 14, 23, 35, 36, 38, 39, 40, 42, 43, 44, 45, 46, 47, 48],
	"Jedes 1/4 Dreieck (unten)": [24, 30, 31, 32, 36, 37, 38, 39, 40, 42, 43, 44, 45, 46, 47, 48],
	"Jedes 1/4 Dreieck (links)": [0, 7, 8, 14, 15, 16, 21, 22, 23, 24, 28, 29, 30, 35, 36, 42],
	"Jedes 1/4 Dreieck (oben)": [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 16, 17, 18, 24],
	"Jedes 1/4 Dreieck (rechts)": [6, 12, 13, 18, 19, 20, 24, 25, 26, 27, 32, 33, 34, 40, 41, 48],
	"Tannenbaum": [3, 9, 10, 11, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 29, 31, 33, 38, 44, 45, 46],
	"Monster Bingo": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48],
        "Apfel": [4, 10, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 36, 37, 38, 39, 40, 44, 46]
      }

  
  var wonBingos = new Array(77);
  var UserRejected = new Array(23);
  var totalScore = 0;
  var $bingoBody = $('#BingoBody');
  var PlayMode = false;

  var model = {
    bingoCard: _.fill(new Array(config.bingoCard.size), false)
  };
  
  
  
  init();

  function init() {
    createBingoCard();
    bindEventHandler();
    initBingoCard();
  }

  function createBingoCard() {
    var $row = $('<tr>');

    _.times(config.bingoCard.size, function(i) {
      $cell = $('<td>');
      if(i != 24) {					// 24= Freifeld in der Mitte mit Freakshow Logo
	$cell.attr('id', 'cell' + i);
      }else{
        $cell.attr('id', 'cell24');
      }
      $cell.attr('data-id', i);
      $cell.append($('<img>'));
      $cell.attr('class', 'missing');
      $row.append($cell);

      // Ueberpruefe ob Reihe voll
      if (i % config.bingoCard.width == config.bingoCard.width - 1) {
        $bingoBody.append($row);
        $row = $('<tr>');
      }
    });
  }

  function initBingoCard() {
    var allBingoCards = _.range(1, config.buzzwordCount);
    diff = allBingoCards.filter(function(x) { return UserRejected.indexOf(x) < 0 }); // Benuztzer abgewaehlte buzzwords vom array abziehen	

    // Mische alle Bingo-Karten außer die ausgeschlossenen und Teile alle Karten in Zwei-Teile auf
    var tmp = _.chunk(_.shuffle(diff), config.bingoCard.size - 1);
    var usedBingoCards = tmp[0];
    var missingBingoCards = tmp[1];
    
    setImgOnFree('#cell24', 'frei');
    setImgOn('#cell', usedBingoCards);
    setImgOff('#missing', usedBingoCards);
    setImgOn('#missing', missingBingoCards);
    $("#BingoBody td").removeClass('gelbe_zelle');
    $("#BingoBody td").removeClass('gruene_zelle');
    $("#BingoBody td").removeClass('rote_zelle');
    $("#BuzzwordsBody td").removeClass('rote_zelle');
    setImgOnRejected('#missing', UserRejected);
    wonBingos = [];
    model.bingoCard.length = 0;
  }

  function resetUserdata() {
    UserRejected = [];
    UserRejectedNum = 0;
  }
  
  function setImgOn(htmlId, imgIds) {
    _.times(imgIds.length, function(id) {
      if(id == 24) {					// wenn id 24 erreicht, in cell48 schreiben
	var $elem = $(htmlId + 48);
	$elem.find('img').attr('src', 'images/' + imgIds[id] + '.svg');
	$elem.attr('data-img-id', imgIds[id]);
      }else{
      
      var $elem = $(htmlId + id);
      $elem.find('img').attr('src', 'images/' + imgIds[id] + '.svg');
      $elem.attr('data-img-id', imgIds[id]);
      }
    });
  }
  
    function setImgOnRejected(htmlId, imgIds) {
    _.times(imgIds.length+1, function(id) {
      if(!isNaN(imgIds[id])) {
      var $elem = $(htmlId + (23-id));
      $elem.find('img').attr('src', 'images/' + imgIds[id] + '.svg');
      $elem.attr('data-img-id', imgIds[id]);
      $elem.addClass("rote_zelle");
{'fraction_non_alphanumeric': 0.2365415986949429, 'fraction_numerical': 0.19341797290587984, 'mean_word_length': 3.0354894104178594, 'pattern_counts': {'":': 102, '<': 47, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 242, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3578834', 'n_tokens_mistral': 8923, 'n_tokens_neox': 6336, 'n_words': 2084}