<commit_before>#include "RakPeerInterface.h"
#include "MessageIdentifiers.h"
#include "BitStream.h"
#include "RakNetTypes.h"  // MessageID
#include "packetids.h"
#include <stdio.h>
#include <string.h>

#define PORT 3999
#define MAX_CLIENTS 25

enum PlayerState {
    NONEXISTENT, EXISTENCE_ACKNOWLEDGED,
    AWAITING_CLIENT, ABOUT_TO_PLAY, PLAYING
};

struct PlayerStatus {
    PlayerState state;
    RakNet::SystemIndex index;
    RakNet::SystemIndex playing_with_index;
    RakNet::SystemAddress addr;
    uint32_t color;

    bool was_killed;
    bool thinks_other_was_killed;
    int kill_streak;
};

void register_kill(RakNet::RakPeerInterface* peer, PlayerStatus* killer, PlayerStatus* killed) {
    killer->was_killed = false;
    killer->thinks_other_was_killed = false;
    killer->kill_streak += 1;

    killed->was_killed = false;
    killed->thinks_other_was_killed = false;
    killed->kill_streak = 0;

    bool boss_mode = killer->kill_streak >= 5;

    printf("Player %i killed player %i! Streak: %i\n", killer->index, killed->index, killer->kill_streak);

    RakNet::BitStream resp2killer;
    resp2killer.Write((RakNet::MessageID)ID_KILL_HAPPENED);
    resp2killer.Write0();
    boss_mode ? resp2killer.Write1() : resp2killer.Write0();

    RakNet::BitStream resp2killed;
    resp2killed.Write((RakNet::MessageID)ID_KILL_HAPPENED);
    resp2killed.Write1();
    boss_mode ? resp2killed.Write1() : resp2killed.Write0();

    peer->Send(&resp2killer, HIGH_PRIORITY, RELIABLE_ORDERED, 0, killer->addr, false);
    peer->Send(&resp2killed, HIGH_PRIORITY, RELIABLE_ORDERED, 0, killed->addr, false);
}

int main(int argc, char** argv) {
    PlayerStatus players[100];
    uint32_t colors[] = {
        0xFFFF9900, 0xFF00FF00, 0xFF007BFF, 0xFFFF5EB4, 0xFFFF6100,
        0xFF6F8927, 0xFF323987, 0xFF70374A, 0xFF375B37, 0xFF0000FF
    };
    // So that we don't loop through the entire list.
    int highest_index = 0;

	RakNet::RakPeerInterface* peer = RakNet::RakPeerInterface::GetInstance();
	peer->SetTimeoutTime(30000,RakNet::UNASSIGNED_SYSTEM_ADDRESS);

    RakNet::Packet* packet;

    {
        RakNet::SocketDescriptor descriptor(PORT, NULL);
        peer->Startup(MAX_CLIENTS, &descriptor, 1);
    }
    peer->SetMaximumIncomingConnections(MAX_CLIENTS);

    printf("up we go!\n");

    while (true) {
        for (packet = peer->Receive(); packet; peer->DeallocatePacket(packet), packet = peer->Receive()) {
            switch (packet->data[0]) {
            case ID_REMOTE_DISCONNECTION_NOTIFICATION:
                printf("Another client has disconnected.\n");
                break;
            case ID_REMOTE_CONNECTION_LOST:
                printf("Another client has lost the connection.\n");
                break;
            case ID_REMOTE_NEW_INCOMING_CONNECTION:
                printf("Another client has connected.\n");
                break;
            case ID_CONNECTION_REQUEST_ACCEPTED:
                printf("Our connection request has been accepted.\n");
                break;					
            case ID_NEW_INCOMING_CONNECTION:
                printf("A connection is incoming. Index: %i\n", packet->systemAddress.systemIndex);
                players[packet->systemAddress.systemIndex].state = EXISTENCE_ACKNOWLEDGED;
                players[packet->systemAddress.systemIndex].addr = packet->systemAddress;
                players[packet->systemAddress.systemIndex].index = packet->systemAddress.systemIndex;
                players[packet->systemAddress.systemIndex].was_killed = false;
                players[packet->systemAddress.systemIndex].thinks_other_was_killed = false;
                players[packet->systemAddress.systemIndex].kill_streak = 0;
                if (packet->systemAddress.systemIndex > highest_index)
                    highest_index = packet->systemAddress.systemIndex;
                break;
            case ID_NO_FREE_INCOMING_CONNECTIONS:
                printf("The server is full.\n");
                break;
            case ID_DISCONNECTION_NOTIFICATION:
                printf("Player %i has disconnected.\n", packet->systemAddress.systemIndex);
                break;
            case ID_CONNECTION_LOST:
                printf("Player %i lost the connection.\n", packet->systemAddress.systemIndex);
                players[packet->systemAddress.systemIndex].state = NONEXISTENT;
                break;
<commit_msg>change ip address + minor fixes<commit_after>#include "RakPeerInterface.h"
#include "MessageIdentifiers.h"
#include "BitStream.h"
#include "RakNetTypes.h"  // MessageID
#include "packetids.h"
#include <stdio.h>
#include <string.h>

#define PORT 8081
#define MAX_CLIENTS 25

enum PlayerState {
    NONEXISTENT, EXISTENCE_ACKNOWLEDGED,
    AWAITING_CLIENT, ABOUT_TO_PLAY, PLAYING
};

struct PlayerStatus {
    PlayerState state;
    RakNet::SystemIndex index;
    RakNet::SystemIndex playing_with_index;
    RakNet::SystemAddress addr;
    uint32_t color;

    bool was_killed;
    bool thinks_other_was_killed;
    int kill_streak;
};

void register_kill(RakNet::RakPeerInterface* peer, PlayerStatus* killer, PlayerStatus* killed) {
    killer->was_killed = false;
    killer->thinks_other_was_killed = false;
    killer->kill_streak += 1;

    killed->was_killed = false;
    killed->thinks_other_was_killed = false;
    killed->kill_streak = 0;

    bool boss_mode = killer->kill_streak >= 5;

    printf("Player %i killed player %i! Streak: %i\n", killer->index, killed->index, killer->kill_streak);

    RakNet::BitStream resp2killer;
    resp2killer.Write((RakNet::MessageID)ID_KILL_HAPPENED);
    resp2killer.Write0();
    boss_mode ? resp2killer.Write1() : resp2killer.Write0();

    RakNet::BitStream resp2killed;
    resp2killed.Write((RakNet::MessageID)ID_KILL_HAPPENED);
    resp2killed.Write1();
    boss_mode ? resp2killed.Write1() : resp2killed.Write0();

    peer->Send(&resp2killer, HIGH_PRIORITY, RELIABLE_ORDERED, 0, killer->addr, false);
    peer->Send(&resp2killed, HIGH_PRIORITY, RELIABLE_ORDERED, 0, killed->addr, false);
}

int main(int argc, char** argv) {
    PlayerStatus players[100];
    uint32_t colors[] = {
        0xFFFF9900, 0xFF00FF00, 0xFF007BFF, 0xFFFF5EB4, 0xFFFF6100,
        0xFF6F8927, 0xFF323987, 0xFF70374A, 0xFF375B37, 0xFF0000FF
    };
    // So that we don't loop through the entire list.
    int highest_index = 0;

    RakNet::RakPeerInterface* peer = RakNet::RakPeerInterface::GetInstance();
    peer->SetTimeoutTime(30000,RakNet::UNASSIGNED_SYSTEM_ADDRESS);

    RakNet::Packet* packet;

    {
        RakNet::SocketDescriptor descriptor(PORT, "192.168.3.11");
        peer->Startup(MAX_CLIENTS, &descriptor, 1);
    }
    peer->SetMaximumIncomingConnections(MAX_CLIENTS);

    printf("up we go! on port %i\n", PORT);

    while (true) {
        for (packet = peer->Receive(); packet; peer->DeallocatePacket(packet), packet = peer->Receive()) {
            switch (packet->data[0]) {
            case ID_REMOTE_DISCONNECTION_NOTIFICATION:
                printf("Another client has disconnected.\n");
                break;
            case ID_REMOTE_CONNECTION_LOST:
                printf("Another client has lost the connection.\n");
                break;
            case ID_REMOTE_NEW_INCOMING_CONNECTION:
                printf("Another client has connected.\n");
                break;
            case ID_CONNECTION_REQUEST_ACCEPTED:
                printf("Our connection request has been accepted.\n");
                break;                    
            case ID_NEW_INCOMING_CONNECTION:
                printf("A connection is incoming. Index: %i\n", packet->systemAddress.systemIndex);
                players[packet->systemAddress.systemIndex].state = EXISTENCE_ACKNOWLEDGED;
                players[packet->systemAddress.systemIndex].addr = packet->systemAddress;
                players[packet->systemAddress.systemIndex].index = packet->systemAddress.systemIndex;
                players[packet->systemAddress.systemIndex].was_killed = false;
                players[packet->systemAddress.systemIndex].thinks_other_was_killed = false;
                players[packet->systemAddress.systemIndex].kill_streak = 0;
                if (packet->systemAddress.systemIndex > highest_index)
                    highest_index = packet->systemAddress.systemIndex;
                break;
            case ID_NO_FREE_INCOMING_CONNECTIONS:
                printf("The server is full.\n");
                break;
            case ID_DISCONNECTION_NOTIFICATION:
                printf("Player %i has disconnected.\n", packet->systemAddress.systemIndex);
                break;
            case ID_CONNECTION_LOST:
                printf("Player %i lost the connection.\n", packet->systemAddress.systemIndex);
                players[packet->systemAddress.systemIndex].state = NONEXISTENT;
                break;

{'fraction_non_alphanumeric': 0.10607086436470323, 'fraction_numerical': 0.022906793048973143, 'mean_word_length': 2.9112974404236542, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 81, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '4785993', 'n_tokens_mistral': 2903, 'n_tokens_neox': 2701, 'n_words': 504}