<commit_before>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TournamentTracker.Services.Enumerations;
using TournamentTracker.Services.Interfaces;

namespace TournamentTracker.Services 
{
    public class EloService
    {
        private int factor = 32;
        private int divisor = 400;

        public EloResult CalcElo(int playerOneElo, int playerTwoElo, MatchWinner winner)
        {
            // A2 = A1 + 32 (G-(1/(1+10 ** ((B1-A1)/400))))
            float G = 0;
            float A1 = System.Convert.ToSingle(playerOneElo);
            float B1 = System.Convert.ToSingle(playerTwoElo);
            if (winner == MatchWinner.PlayerOne) { G = 0; }
            if (winner == MatchWinner.PlayerTwo) { G = 1; }

            double addsub = factor * (G - (1 / (1 + System.Math.Pow(10, ((B1 - A1) / divisor)))));
            int addsubint = System.Convert.ToInt32(addsub);

            EloResult result = new EloResult();

            if (winner == MatchWinner.PlayerOne)
            {
                result.PlayerOneElo = playerOneElo + addsubint;
                result.PlayerTwoElo = playerTwoElo - addsubint;
            }
            if (winner == MatchWinner.PlayerTwo)
            {
                result.PlayerOneElo = playerOneElo - addsubint;
                result.PlayerTwoElo = playerTwoElo + addsubint;
            }<commit_msg>first bug fix for elo score adjustments<commit_after>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TournamentTracker.Services.Enumerations;
using TournamentTracker.Services.Interfaces;

namespace TournamentTracker.Services 
{
    public class EloService
    {
        private int factor = 32;
        private int divisor = 400;

        public EloResult CalcElo(int playerOneElo, int playerTwoElo, MatchWinner winner)
        {
            // A2 = A1 + 32 (G-(1/(1+10 ** ((B1-A1)/400))))
            float G = 0;
            float A1 = System.Convert.ToSingle(playerOneElo);
            float B1 = System.Convert.ToSingle(playerTwoElo);
            if (winner == MatchWinner.PlayerOne) { G = 0; }
            if (winner == MatchWinner.PlayerTwo) { G = 1; }

            double addsub = factor * (G - (1 / (1 + System.Math.Pow(10, ((B1 - A1) / divisor)))));
            int addsubint = System.Convert.ToInt32(addsub);

            EloResult result = new EloResult();

            if (winner == MatchWinner.PlayerOne)
            {
                result.PlayerOneElo = playerOneElo + addsubint;
                result.PlayerTwoElo = playerTwoElo - addsubint;
            }
            if (winner == MatchWinner.PlayerTwo)
            {
                result.PlayerOneElo = playerOneElo + addsubint;
                result.PlayerTwoElo = playerTwoElo - addsubint;
            }
{'fraction_non_alphanumeric': 0.10290986515259049, 'fraction_numerical': 0.0220014194464159, 'mean_word_length': 2.0344456404736277, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6335675', 'n_tokens_mistral': 881, 'n_tokens_neox': 826, 'n_words': 190}