<commit_before>using System;


namespace SmartFighter {
    public static class GameMode {
        public const int Story = 2;
        public const int Versus = 3;
        public const int Survival = 4;
        public const int Casual = 5;
        public const int BattleLounge = 6;
        public const int Ranked = 7;
        public const int Training = 8;
        public const int CFN = 9;
        public const int BattleSettings = 14;
        public const int Shop = 11;
        public const int Options = 12;
        public const int Challenge = 13;
        public const int Log = 14;
    }

    public static class VersusMode {
        public const int PvP = 0;
        public const int PvAI = 1;
        public const int AIvP = 2;
    }

    public static class MatchResult {
        public const int Player1 = 0;
        public const int Player2 = 1;
        public const int Draw = -1;
        public const int Unknown = -100;
    }

    public static class RoundResult {
        public const int Unknown = 0;
        public const int Loss = 1;
        public const int Win = 2;
        public const int CrticalArt = 3;
        public const int EX = 4;
        public const int Chip = 5;
        public const int Perfect = 6;
        public const int TimeOut = 7;
        public const int DoubleKO = 8;
    }

    public class GameState {
        public int gameMode = 0;
        public int versusMode = 0;
        public int roundCount = 0;
        public int roundTimer = 0;
        public string player1Id;
        public string player2Id;

        private int currentResult = MatchResult.Unknown;
        private bool gameStarted;
        private string gameID;

        public bool isInVersus() {
            return gameMode == GameMode.Versus && versusMode == VersusMode.PvP;
        }

        public bool isGameStarted() {
            return gameStarted;
        }

        public void startGame() {
            if (isInVersus()) {
                currentResult = MatchResult.Unknown;
                gameID = Guid.NewGuid().ToString("N");
                gameStarted = true;
            }
        }

        public void setMatchResults(int result) {
            if (isGameStarted()) {
                if (player1Id != null && player2Id != null) {
                    Logger.Instance.log("SET MATCH {0} --> {1} ({2} vs. {3})", gameID, result, player1Id, player2Id);
                    ApiQueue.registerGame(gameID, player1Id, player2Id, result, DateTime.UtcNow);
                    currentResult = result;
                } else {
                    currentResult = MatchResult.Unknown;
                    gameID = null;
                }
                gameStarted = false;
            }
        }

        public void setRoundResults(int[] player1, int[] player2) {
            if (player1.Length != player2.Length) {
                return;
            }
            if (isInVersus() && gameID != null) {
                if (currentResult == MatchResult.Unknown) {<commit_msg>Fix reporting of match results.<commit_after>using System;


namespace SmartFighter {
    public static class GameMode {
        public const int Story = 2;
        public const int Versus = 3;
        public const int Survival = 4;
        public const int Casual = 5;
        public const int BattleLounge = 6;
        public const int Ranked = 7;
        public const int Training = 8;
        public const int CFN = 9;
        public const int BattleSettings = 14;
        public const int Shop = 11;
        public const int Options = 12;
        public const int Challenge = 13;
        public const int Log = 14;
    }

    public static class VersusMode {
        public const int PvP = 0;
        public const int PvAI = 1;
        public const int AIvP = 2;
    }

    public static class MatchResult {
        public const int Player1 = 0;
        public const int Player2 = 1;
        public const int Draw = -1;
        public const int Unknown = -100;
    }

    public static class RoundResult {
        public const int Unknown = 0;
        public const int Loss = 1;
        public const int Win = 2;
        public const int CrticalArt = 3;
        public const int EX = 4;
        public const int Chip = 5;
        public const int Perfect = 6;
        public const int TimeOut = 7;
        public const int DoubleKO = 8;
    }

    public class GameState {
        public int gameMode = 0;
        public int versusMode = 0;
        public int roundCount = 0;
        public int roundTimer = 0;
        public string player1Id;
        public string player2Id;

        private int currentResult = MatchResult.Unknown;
        private bool gameStarted;
        private string gameID;

        public bool isInVersus() {
            return gameMode == GameMode.Versus && versusMode == VersusMode.PvP;
        }

        public bool isGameStarted() {
            return gameStarted;
        }

        public void startGame() {
            if (isInVersus()) {
                currentResult = MatchResult.Unknown;
                gameID = Guid.NewGuid().ToString("N");
                gameStarted = true;
            }
        }

        public void setMatchResults(int result) {
            if (isGameStarted()) {
                if (player1Id != null && player2Id != null) {
                    Logger.Instance.log("SET MATCH {0} --> {1} ({2} vs. {3})", gameID, result, player1Id, player2Id);
                    ApiQueue.registerGame(gameID, player1Id, player2Id, result + 1, DateTime.UtcNow);
                    currentResult = result;
                } else {
                    currentResult = MatchResult.Unknown;
                    gameID = null;
                }
                gameStarted = false;
            }
        }

        public void setRoundResults(int[] player1, int[] player2) {
            if (player1.Length != player2.Length) {
                return;
            }
            if (isInVersus() && gameID != null) {
                if (currentResult == MatchResult.Unknown) {
{'fraction_non_alphanumeric': 0.07636122177954847, 'fraction_numerical': 0.01942231075697211, 'mean_word_length': 1.60146804835924, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4129507', 'n_tokens_mistral': 1680, 'n_tokens_neox': 1536, 'n_words': 559}