// Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   player.java

package boggle.server;

import boggle.codec;
import boggle.settings;
import java.io.Serializable;

public class player
    implements Serializable
{

    public player(String s, String s1, int i)
    {
        name = s;
        passCode = codec.encode(s, s1);
        currentGame = -1;
        currentLanguage = i;
        status = "";
        played = new int[settings.getLanguages().length][settings.getGameNames().length];
        scored = new int[settings.getLanguages().length][settings.getGameNames().length];
        highest = new int[settings.getLanguages().length][settings.getGameNames().length];
        for(int j = 0; j < settings.getLanguages().length; j++)
        {
            for(int k = 0; k < settings.getGameNames().length; k++)
            {
                played[j][k] = 0;
                scored[j][k] = 0;
                highest[j][k] = 0;
            }

        }

    }

    public void setLanguage(int i)
    {
        currentLanguage = i;
    }

    public int getLanguage()
    {
        return currentLanguage;
    }

    public void score(int i, int j, int k)
    {
        if(k > highest[i][j])
            highest[i][j] = k;
        scored[i][j] += k;
        played[i][j]++;
    }

    public String getName()
    {
        return name;
    }

    public boolean checkCode(int i)
    {
        return i == passCode;
    }

    public int getScored(int i, int j)
    {
        return scored[i][j];
    }

    public int getPlayed(int i, int j)
    {
        return played[i][j];
    }

    public int getHighest(int i, int j)
    {
        return highest[i][j];
    }

    public String makeIntoString()
    {
        String s = name + " " + passCode + " " + currentLanguage + " ";
        for(int i = 0; i < settings.getLanguages().length; i++)
        {
            for(int j = 0; j < settings.getGameNames().length; j++)
                s = s + played[i][j] + " " + scored[i][j] + " " + highest[i][j] + " ";

        }

        return s;
    }

    public void setStatus(String s)
    {
        status = s;
    }

    public String getStatus()
    {
        return status;
    }

    private String name;
    private int passCode;
    private int currentGame;
    private int currentLanguage;
    private String status;
    private int played[][];
    private int scored[][];
    private int highest[][];
}
