<commit_before>package huippu.common;

import java.io.DataInputStream;
import java.io.IOException;

public final class Score
    implements IStorable
{
    private static final boolean USE_ALL_ZERO = false;
    
    private final int mValue;
    private final int mLevel;
    private final ScoreDate mDate;
    
    public Score()
    {
        this( 0, 0, new ScoreDate() );
    }
    
    public Score( final int pValue, final int pLevel, final ScoreDate pDate )
    {
        mValue = pValue;
        mLevel = pLevel;
        mDate = pDate;
    }

    public Score( final int pValue, final int pLevel )
    {
        mValue = pValue;
        mLevel = pLevel;
        mDate = new ScoreDate();
    }
    
    public Score( final DataInputStream pInput )
        throws IOException
    {
        mValue = pInput.readInt();
        mLevel = pInput.readInt();
        mDate = new ScoreDate( pInput.readByte(),
                               pInput.readByte(),
                               pInput.readByte() );
    }
    
    public byte[] getAsBytes()
        throws IOException
    {
        // Convert all values to byte data
        final byte[] dataValue = Storable.getDataInt( mValue );
        final byte[] dataLevel = Storable.getDataInt( mLevel );
        final byte[] dataDate = mDate.getAsBytes();
        
        // Append all data to a continuous byte array
        final byte[] data = new byte[   dataValue.length
                                      + dataLevel.length
                                      + dataDate.length ];
        
        int offset = 0;
        
        offset = Storable.appendData( dataValue, data, offset );
        offset = Storable.appendData( dataLevel, data, offset );
        offset = Storable.appendData( dataDate, data, offset );
        
        return data;
    }
    
    public int getValue()
    {
        return mValue;
    }
    
    public int getLevel()
    {
        return mLevel;
    }
    
    public ScoreDate getDate()
    {
        return mDate;
    }
    
    private static final Score[] SCORES_TOTAL_BIGGEST = new Score[]
    {
        new Score( 1074, 11, new ScoreDate( 24,  9, 10 ) ),
        new Score(  714,  7, new ScoreDate( 20,  3, 10 ) ),
        new Score(  706,  8, new ScoreDate( 21,  8, 10 ) ),
        new Score(  683,  7, new ScoreDate( 29, 10, 10 ) ),
        new Score(  617,  6, new ScoreDate(  2,  5, 10 ) ),
    };
    
    private static final Score[] SCORES_TOTAL_SMALLEST = new Score[]
    {
        new Score( 55, 1, new ScoreDate(  5,  9, 10 ) ),
        new Score( 68, 1, new ScoreDate(  7,  7, 10 ) ),
        new Score( 69, 1, new ScoreDate( 27,  9, 10 ) ),
        new Score( 76, 1, new ScoreDate( 15,  9, 10 ) ),
        new Score( 77, 1, new ScoreDate( 24, 10, 10 ) ),
    };
    
    private static final Score[] SCORES_LEVEL_BIGGEST = new Score[]
    {
        new Score( 133, 1, new ScoreDate(  9,  2, 10 ) ),
        new Score( 130, 1, new ScoreDate( 29, 10, 10 ) ),
        new Score( 127, 1, new ScoreDate( 22,  2, 10 ) ),
        new Score( 127, 1, new ScoreDate( 22,  2, 10 ) ),
        new Score( 125, 1, new ScoreDate( 10,  2, 10 ) ),
    };
    
    private static final Score[] SCORES_LEVEL_SMALLEST = new Score[]
    {
        new Score( 71, 1, new ScoreDate( 21,  3, 10 ) ),
        new Score( 79, 6, new ScoreDate( 21,  8, 10 ) ),
        new Score( 79, 3, new ScoreDate( 21,  8, 10 ) ),
        new Score( 82, 9, new ScoreDate( 24,  9, 10 ) ),
        new Score( 85, 6, new ScoreDate( 29, 10, 10 ) ),
    };
    
    private static final Score[] REMOVES_LEVEL_SMALLEST = new Score[]
    {
        new Score(  7,  1, new ScoreDate(  9,  2, 10 ) ),
        new Score(  8,  1, new ScoreDate( 29, 10, 10 ) ),
        new Score(  9,  1, new ScoreDate( 22,  2, 10 ) ),
        new Score(  9,  1, new ScoreDate( 22,  2, 10 ) ),
        new Score( 10,  1, new ScoreDate( 26, 10, 10 ) ),
    };
    
    private static final Score[] REMOVES_LEVEL_BIGGEST = new Score[]
    {
        new Score( 25,  6, new ScoreDate( 21,  8, 10 ) ),
        new Score( 25,  3, new ScoreDate( 21,  8, 10 ) ),
        new Score( 24,  9, new ScoreDate( 24,  9, 10 ) ),
        new Score( 24,  2, new ScoreDate(  5,  9, 10 ) ),
        new Score( 24,  1, new ScoreDate(  2,  5, 10 ) ),
    };
    
    private static final Score[] REMOVES_BIGGEST = new Score[]
    {
        new Score( 37,  1, new ScoreDate( 29, 10, 10 ) ),
        new Score( 32,  1, new ScoreDate(  2,  5, 10 ) ),
        new Score( 30,  1, new ScoreDate( 12,  3, 10 ) ),
        new Score( 29,  1, new ScoreDate(  3,  4, 10 ) ),
        new Score( 27,  1, new ScoreDate(  7,  7, 10 ) ),
    };

    static final Score[] getInitialScoresTotalBiggest()
    {
        if ( USE_ALL_ZERO )
        {
            return getEmptyScores( SCORES_TOTAL_BIGGEST.length );
        }
        else
        {
            return SCORES_TOTAL_BIGGEST;
        }
    }

    static final Score[] getInitialScoresTotalSmallest()
    {
        if ( USE_ALL_ZERO )
        {
            return getEmptyScores( SCORES_TOTAL_SMALLEST.length );
        }
        else
        {
            return SCORES_TOTAL_SMALLEST;
        }
    }
    
    static final Score[] getInitialScoresLevelBiggest()
    {
        if ( USE_ALL_ZERO )<commit_msg>Store more scores in Hall of Fame<commit_after>package huippu.common;

import java.io.DataInputStream;
import java.io.IOException;

public final class Score
    implements IStorable
{
    private static final boolean USE_ALL_ZERO = false;
    
    private final int mValue;
    private final int mLevel;
    private final ScoreDate mDate;
    
    public Score()
    {
        this( 0, 0, new ScoreDate() );
    }
    
    public Score( final int pValue, final int pLevel, final ScoreDate pDate )
    {
        mValue = pValue;
        mLevel = pLevel;
        mDate = pDate;
    }

    public Score( final int pValue, final int pLevel )
    {
        mValue = pValue;
        mLevel = pLevel;
        mDate = new ScoreDate();
    }
    
    public Score( final DataInputStream pInput )
        throws IOException
    {
        mValue = pInput.readInt();
        mLevel = pInput.readInt();
        mDate = new ScoreDate( pInput.readByte(),
                               pInput.readByte(),
                               pInput.readByte() );
    }
    
    public byte[] getAsBytes()
        throws IOException
    {
        // Convert all values to byte data
        final byte[] dataValue = Storable.getDataInt( mValue );
        final byte[] dataLevel = Storable.getDataInt( mLevel );
        final byte[] dataDate = mDate.getAsBytes();
        
        // Append all data to a continuous byte array
        final byte[] data = new byte[   dataValue.length
                                      + dataLevel.length
                                      + dataDate.length ];
        
        int offset = 0;
        
        offset = Storable.appendData( dataValue, data, offset );
        offset = Storable.appendData( dataLevel, data, offset );
        offset = Storable.appendData( dataDate, data, offset );
        
        return data;
    }
    
    public int getValue()
    {
        return mValue;
    }
    
    public int getLevel()
    {
        return mLevel;
    }
    
    public ScoreDate getDate()
    {
        return mDate;
    }
    
    private static final Score[] SCORES_TOTAL_BIGGEST = new Score[]
    {
        new Score( 1074, 11, new ScoreDate( 24,  9, 10 ) ),
        new Score(  895,  9, new ScoreDate(  4,  5, 12 ) ),
        new Score(  714,  7, new ScoreDate( 20,  3, 10 ) ),
        new Score(  706,  8, new ScoreDate( 21,  8, 10 ) ),
        new Score(  693,  7, new ScoreDate(  2,  5, 12 ) ),
        new Score(),
        new Score(),
        new Score(),
        new Score(),
        new Score(),
    };
    
    private static final Score[] SCORES_TOTAL_SMALLEST = new Score[]
    {
        new Score( 55, 1, new ScoreDate(  5,  9, 10 ) ),
        new Score( 68, 1, new ScoreDate( 24,  3, 12 ) ),
        new Score( 68, 1, new ScoreDate( 11, 11, 10 ) ),
        new Score( 68, 1, new ScoreDate(  7,  7, 10 ) ),
        new Score( 69, 1, new ScoreDate( 27,  9, 10 ) ),
        new Score(),
        new Score(),
        new Score(),
        new Score(),
        new Score(),
    };
    
    private static final Score[] SCORES_LEVEL_BIGGEST = new Score[]
    {
        new Score( 133, 1, new ScoreDate(  9,  2, 10 ) ),
        new Score( 130, 1, new ScoreDate( 29, 10, 10 ) ),
        new Score( 127, 1, new ScoreDate(  9,  8, 11 ) ),
        new Score( 127, 1, new ScoreDate( 22,  2, 10 ) ),
        new Score( 127, 1, new ScoreDate( 22,  2, 10 ) ),
        new Score(),
        new Score(),
        new Score(),
        new Score(),
        new Score(),
    };
    
    private static final Score[] SCORES_LEVEL_SMALLEST = new Score[]
    {
        new Score( 71, 1, new ScoreDate( 21,  3, 10 ) ),
        new Score( 79, 6, new ScoreDate( 21,  8, 10 ) ),
        new Score( 79, 3, new ScoreDate( 21,  8, 10 ) ),
        new Score( 82, 1, new ScoreDate( 17,  8, 11 ) ),
        new Score( 82, 1, new ScoreDate( 24,  2, 11 ) ),
        new Score(),
        new Score(),
        new Score(),
        new Score(),
        new Score(),
    };
    
    private static final Score[] REMOVES_LEVEL_SMALLEST = new Score[]
    {
        new Score(  7,  1, new ScoreDate(  9,  2, 10 ) ),
        new Score(  8,  1, new ScoreDate( 29, 10, 10 ) ),
        new Score(  9,  1, new ScoreDate(  9,  8, 11 ) ),
        new Score(  9,  1, new ScoreDate( 22,  2, 10 ) ),
        new Score(  9,  1, new ScoreDate( 22,  2, 10 ) ),
        new Score(),
        new Score(),
        new Score(),
        new Score(),
        new Score(),
    };
    
    private static final Score[] REMOVES_LEVEL_BIGGEST = new Score[]
    {
        new Score( 25,  6, new ScoreDate( 21,  8, 10 ) ),
        new Score( 25,  3, new ScoreDate( 21,  8, 10 ) ),
        new Score( 24,  1, new ScoreDate( 17,  8, 11 ) ),
        new Score( 24,  1, new ScoreDate( 24,  2, 11 ) ),
        new Score( 24,  9, new ScoreDate( 24,  9, 10 ) ),
        new Score(),
        new Score(),
        new Score(),
        new Score(),
        new Score(),
    };
    
    private static final Score[] REMOVES_BIGGEST = new Score[]
    {
        new Score( 37,  1, new ScoreDate( 29, 10, 10 ) ),
        new Score( 32,  1, new ScoreDate( 17,  7, 12 ) ),
        new Score( 32,  1, new ScoreDate(  2,  5, 10 ) ),
        new Score( 31,  1, new ScoreDate( 22, 11, 10 ) ),
        new Score( 30,  1, new ScoreDate( 12,  3, 10 ) ),
        new Score(),
        new Score(),
        new Score(),
        new Score(),
        new Score(),
    };

    static final Score[] getInitialScoresTotalBiggest()
    {
        if ( USE_ALL_ZERO )
        {
            return getEmptyScores( SCORES_TOTAL_BIGGEST.length );
        }
        else
        {
            return SCORES_TOTAL_BIGGEST;
        }
    }

    static final Score[] getInitialScoresTotalSmallest()
    {
        if ( USE_ALL_ZERO )
        {
            return getEmptyScores( SCORES_TOTAL_SMALLEST.length );
        }
        else
        {
            return SCORES_TOTAL_SMALLEST;
        }
    }
    
    static final Score[] getInitialScoresLevelBiggest()
    {
        if ( USE_ALL_ZERO )
{'fraction_non_alphanumeric': 0.11105211928147951, 'fraction_numerical': 0.05079196531280418, 'mean_word_length': 1.66619485727766, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3839651', 'n_tokens_mistral': 4086, 'n_tokens_neox': 3624, 'n_words': 1188}