<commit_before>'use strict';

function draw_logic(){
    // Save the current buffer state.
    canvas_buffer.save();

    // Translate to camera position.
    canvas_buffer.translate(
      camera['x'],
      camera['y']
    );

    // Draw selection if not AI turn.
    if(players[player_ids[turn]]
      && players[player_ids[turn]]['ai'] === false
      && !players[player_ids[turn]]['done']){
        draw_hexagon(
          core_mouse['x'],
          core_mouse['y'],
          core_storage_data['hexagon-size'] + 5,
          players[player_ids[turn]]['color']
        );
    }

    // Draw hexagons.
    for(var hexagon in hexagons){
        draw_hexagon(
          hexagons[hexagon]['x'],
          hexagons[hexagon]['y'],
          hexagons[hexagon]['size'],
          hexagons[hexagon]['color']
        );
    }

    // Restore the buffer state.
    canvas_buffer.restore();

    var x = 75;

    // Draw scoreboard.
    for(var player in scoreboard){
        if(!players[scoreboard[player]['id']]){
            continue;
        }

        canvas_buffer.fillStyle = players[scoreboard[player]['id']]['color'];
        canvas_buffer.fillText(
          players[scoreboard[player]['id']]['name']
            + (players[scoreboard[player]['id']]['done']
              ? '='
              : ':')
            + scoreboard[player]['hexagons'],
          0,
          x
        );
        x += 25;
    }

    // Draw winner.
    if(game_over){
        canvas_buffer.fillStyle = players[scoreboard[0]['id']]['color'];
        canvas_buffer.fillText(
          players[scoreboard[0]['id']]['name'] + ' wins!',
          0,
          x
        );
    }
}

function logic(){
    // Move camera left.
    if(core_keys[65]['state']
      && camera['x'] < width_half){
        camera['x'] += core_storage_data['scroll-speed'];
    }

    // Move camera right.
    if(core_keys[68]['state']
      && camera['x'] > -width_half){
        camera['x'] -= core_storage_data['scroll-speed'];
    }

    // Move camera down.
    if(core_keys[83]['state']
      && camera['y'] > -height_half){
        camera['y'] -= core_storage_data['scroll-speed'];
    }

    // Move camera up.
    if(core_keys[87]['state']
      && camera['y'] < height_half){
        camera['y'] += core_storage_data['scroll-speed'];
    }

    handle_turn();
    update_scoreboard();

    core_ui_update({
      'ids': {
        'turn': turns + turn_limit_string + ' ' + players[player_ids[turn]]['name'],
        'unclaimed': unclaimed,
      },
    });
}

function repo_init(){
    core_repo_init({
      'info': '<input onclick=canvas_setmode({newgame:true}) type=button value="Start New Game">',
      'keybinds': {
        65: {},
        68: {},
        72: {
          'todo': function(){
              if(players[player_ids[turn]]
                && !players[player_ids[turn]]['ai']){
                  input_required = false;
                  end_turn();
              }
          },
        },
        80: {
          'todo': function(){
              if(!game_over
                && players[player_ids[turn]]
                && !players[player_ids[turn]]['ai']){
                  for(var hexagon in hexagons){
                      if(!players[player_ids[turn]]){
                          break;
                        }
                      if(hexagons[hexagon]['color'] === players[player_ids[turn]]['color']){
                          hexagons[hexagon]['color'] = core_storage_data['default-color'];
                          lose_hexagon(player_ids[turn]);
                          unclaimed += 1;
                      }
                  }
                  for(var player in players){
                      players[player]['done'] = false;
                  }
                  input_required = false;
                  end_turn();
              }
          },
        },
        83: {},
        87: {},
      },<commit_msg>improved formatting<commit_after>'use strict';

function draw_logic(){
    // Save the current buffer state.
    canvas_buffer.save();

    // Translate to camera position.
    canvas_buffer.translate(
      camera['x'],
      camera['y']
    );

    // Draw selection if not AI turn.
    if(players[player_ids[turn]]
      && players[player_ids[turn]]['ai'] === false
      && !players[player_ids[turn]]['done']){
        draw_hexagon(
          core_mouse['x'],
          core_mouse['y'],
          core_storage_data['hexagon-size'] + 5,
          players[player_ids[turn]]['color']
        );
    }

    // Draw hexagons.
    for(var hexagon in hexagons){
        draw_hexagon(
          hexagons[hexagon]['x'],
          hexagons[hexagon]['y'],
          hexagons[hexagon]['size'],
          hexagons[hexagon]['color']
        );
    }

    // Restore the buffer state.
    canvas_buffer.restore();

    var x = 75;

    // Draw scoreboard.
    for(var player in scoreboard){
        if(!players[scoreboard[player]['id']]){
            continue;
        }

        canvas_buffer.fillStyle = players[scoreboard[player]['id']]['color'];
        canvas_buffer.fillText(
          players[scoreboard[player]['id']]['name']
            + (players[scoreboard[player]['id']]['done']
              ? '='
              : ':')
            + scoreboard[player]['hexagons'],
          0,
          x
        );
        x += 25;
    }

    // Draw winner.
    if(game_over){
        canvas_buffer.fillStyle = players[scoreboard[0]['id']]['color'];
        canvas_buffer.fillText(
          players[scoreboard[0]['id']]['name'] + ' wins!',
          0,
          x
        );
    }
}

function logic(){
    // Move camera left.
    if(core_keys[65]['state']
      && camera['x'] < width_half){
        camera['x'] += core_storage_data['scroll-speed'];
    }

    // Move camera right.
    if(core_keys[68]['state']
      && camera['x'] > -width_half){
        camera['x'] -= core_storage_data['scroll-speed'];
    }

    // Move camera down.
    if(core_keys[83]['state']
      && camera['y'] > -height_half){
        camera['y'] -= core_storage_data['scroll-speed'];
    }

    // Move camera up.
    if(core_keys[87]['state']
      && camera['y'] < height_half){
        camera['y'] += core_storage_data['scroll-speed'];
    }

    handle_turn();
    update_scoreboard();

    core_ui_update({
      'ids': {
        'turn': turns + turn_limit_string + ' ' + players[player_ids[turn]]['name'],
        'unclaimed': unclaimed,
      },
    });
}

function repo_init(){
    core_repo_init({
      'info': '<input onclick=canvas_setmode({newgame:true}) type=button value="Start New Game">',
      'keybinds': {
        65: {},
        68: {},
        72: {
          'todo': function(){
              if(players[player_ids[turn]]
                && !players[player_ids[turn]]['ai']){
                  input_required = false;
                  end_turn();
              }
          },
        },
        80: {
          'todo': function(){
              if(!game_over
                && players[player_ids[turn]]
                && !players[player_ids[turn]]['ai']){
                  for(var hexagon in hexagons){
                      if(!players[player_ids[turn]]){
                          break;
                      }

                      if(hexagons[hexagon]['color'] === players[player_ids[turn]]['color']){
                          hexagons[hexagon]['color'] = core_storage_data['default-color'];
                          lose_hexagon(player_ids[turn]);
                          unclaimed += 1;
                      }
                  }
                  for(var player in players){
                      players[player]['done'] = false;
                  }
                  input_required = false;
                  end_turn();
              }
          },
        },
        83: {},
        87: {},
      },
{'fraction_non_alphanumeric': 0.16170647592285095, 'fraction_numerical': 0.007663814024779665, 'mean_word_length': 1.6443768996960486, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '574898', 'n_tokens_mistral': 2360, 'n_tokens_neox': 2248, 'n_words': 351}