<commit_before>PLAYER = yegiks[0]
BALL = yegiks[1]
BALL_BOT = bots[1]

FLOOR = points[0].pos_y
CEIL = points[1].pos_y

# Initialization
if timers[1].value == 1:
    system.bots = 1

    PLAYER.spawn(2)
    PLAYER.weapon = 2
    PLAYER.has_weapon = True
    PLAYER.ammo = 50

# Restart game after player shoots
if timers[1].value == 1 or PLAYER.ammo < 50 and BALL.health == 0:
    BALL.spawn(1)
    BALL_BOT.ai = False
    ball_speed_x = 0.0

    green_armor = yellow_armor = red_armor = 0
    ball_damage = 0

# Infinite ammo
PLAYER.ammo = 50

# End screen
if -BALL.pos_y < -FLOOR:
    game_duration = timers[1].value / 50
    timers[1].stop()

    BALL.health = 0

    system.message_at(280, 200, 1, 'Game_Over!')

    system.message_at(280, 230, 1, 'Your score: {score}')
    system.message_at(280, 245, 1, 'Green: {green_armor}')
    system.message_at(280, 260, 1, 'Yellow: {yellow_armor}')
    system.message_at(280, 275, 1, 'Red: {red_armor}')
    system.message_at(280, 290, 1, 'Game duration: {game_duration}')
    system.message_at(280, 305, 1, 'Ball damage: {ball_damage}')

    system.message_at(280, 335, 1, 'Shoot to restart')

# Scoring
if BALL.armor > 0:
    if BALL.armor == 100:
        green_armor += 1
    elif BALL.armor == 150:
        yellow_armor += 1
    elif BALL.armor == 200:
        red_armor += 1
    BALL.armor = 0

score = green_armor*100 + yellow_armor*150 + red_armor*200

if BALL.health > 0:
    system.message_at(30, 30, 1, 'Your score: {score}')

# Ball movement
BALL.speed_y *= 0.9

# Ball bouncing off the walls
if BALL.speed_x != 0 and BALL.speed_y != 0:
    ball_speed_x = BALL.speed_x
if ball_speed_x != 0 and BALL.speed_x == 0 and BALL.speed_y != 0:
    ball_speed_x *= -1.0
    BALL.speed_x = ball_speed_x
if -BALL.pos_y > -CEIL:
    BALL.pos_y = CEIL
    BALL.speed_y *= -0.5

# Ball impulse
is_ball_damaged = 0 < BALL.health < 100
if is_ball_damaged:
    speed_x = BALL.pos_x - PLAYER.pos_x
    speed_y = (PLAYER.pos_y - BALL.pos_y) / (speed_x * 0.1)

    if speed_x < 0:
        speed_x = -10.0
    elif speed_x > 0:
        speed_x = 10.0
        speed_y *= -1.0

    BALL.speed_x = speed_x
    BALL.speed_y = speed_y

    ball_damage += 100 - BALL.health
    BALL.health = 100<commit_msg>Arcanoid: Rocket launcher is more fun than SG<commit_after>PLAYER = yegiks[0]
BALL = yegiks[1]
BALL_BOT = bots[1]

FLOOR = points[0].pos_y
CEIL = points[1].pos_y

PUNCH_VELOCITY = 15

# Initialization
if timers[1].value == 1:
    system.bots = 1

    PLAYER.spawn(2)
    PLAYER.weapon = 7
    PLAYER.has_weapon = True
    PLAYER.ammo = 30

# Restart game after player shoots
if timers[1].value == 1 or PLAYER.ammo < 30 and BALL.health == 0:
    BALL.spawn(1)
    BALL_BOT.ai = False
    ball_speed_x = 0.0

    green_armor = yellow_armor = red_armor = 0
    ball_damage = 0

PLAYER.health = 100

if PLAYER.ammo < 30:
    launch_x = PLAYER.pos_x
    launch_y = PLAYER.pos_y
    PLAYER.ammo = 30

# End screen
if -BALL.pos_y < -FLOOR:
    game_duration = timers[1].value / 50
    timers[1].stop()

    BALL.health = 0

    system.message_at(280, 200, 1, 'Game_Over!')

    system.message_at(280, 230, 1, 'Your score: {score}')
    system.message_at(280, 245, 1, 'Green: {green_armor}')
    system.message_at(280, 260, 1, 'Yellow: {yellow_armor}')
    system.message_at(280, 275, 1, 'Red: {red_armor}')
    system.message_at(280, 290, 1, 'Game duration: {game_duration}')
    system.message_at(280, 305, 1, 'Ball damage: {ball_damage}')

    system.message_at(280, 335, 1, 'Shoot to restart')

# Scoring
if BALL.armor > 0:
    if BALL.armor == 100:
        green_armor += 1
    elif BALL.armor == 150:
        yellow_armor += 1
    elif BALL.armor == 200:
        red_armor += 1
    BALL.armor = 0

score = green_armor*100 + yellow_armor*150 + red_armor*200

if BALL.health > 0:
    system.message_at(30, 30, 1, 'Your score: {score}')

# Ball movement
if BALL.speed_y > 0:
    BALL.speed_y *= 0.9

# Ball bouncing off the walls
if BALL.speed_x != 0 and BALL.speed_y != 0:
    ball_speed_x = BALL.speed_x
    ball_speed_y = BALL.speed_y
if ball_speed_x != 0 and BALL.speed_x == 0 and BALL.speed_y != 0:
    ball_speed_x *= -1.0
    BALL.speed_x = ball_speed_x
if -BALL.pos_y > -CEIL:
    BALL.pos_y = CEIL
    BALL.speed_y *= -1.0

# Ball impulse
is_ball_damaged = 0 < BALL.health < 100
if is_ball_damaged:
    dist_x = BALL.pos_x - launch_x
    dist_y = BALL.pos_y - launch_y

    # Calculate length of speed vector via Newton's method
    sqr_hypo = dist_y*dist_y + dist_x*dist_x
    hypo = sqr_hypo/2
    for _ in range(8):
        hypo = (hypo + sqr_hypo/hypo) / 2

    BALL.speed_x = dist_x/hypo * PUNCH_VELOCITY/2
    BALL.speed_y = dist_y/hypo * PUNCH_VELOCITY

    ball_damage += 100 - BALL.health
    BALL.health = 100
{'fraction_non_alphanumeric': 0.1271542664985288, 'fraction_numerical': 0.0617906683480454, 'mean_word_length': 2.8817292006525284, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '4000997', 'n_tokens_mistral': 2260, 'n_tokens_neox': 1980, 'n_words': 456}