// 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:   BogglePlayer.java

import java.util.HashSet;
import java.util.Set;

public class BogglePlayer
{

    public BogglePlayer(String s)
    {
        pScore = 0;
        selectedWords = new HashSet(25);
        pName = s;
    }

    public String getPlayerName()
    {
        return pName;
    }

    public int getPlayerScore()
    {
        return pScore;
    }

    public String newWord(String s)
    {
        if(selectedWords.contains(s))
            return "Word already selected";
        if(dict.isValid(s))
        {
            selectedWords.add(s);
            pScore += score.increaseScore(s);
            return "Good word, score increased";
        } else
        {
            return "Word not in dictionary";
        }
    }

    private String pName;
    private int pScore;
    private Set selectedWords;
    private static BoggleScorer score = new BoggleScorer();
    private static BoggleDictionary dict = new BoggleDictionary();

}
