Player.java :  » Game » seizure » com » seizure » Android Open Source

Android Open Source » Game » seizure 
seizure » com » seizure » Player.java
package com.seizure;

class Player
{
  public int StepsCount = 0;
  public int OwnedCellsCount = 0;
    public boolean HasFreeCell = true;
    public boolean Enabled = false;
    public boolean IsAI = false;
    public int AiLevel;
    private String Name;
    public int GameFieldCornerIndex;
    public int BorderColor;

    private Player()
    {}

    public Player(String name, boolean isAI, int aiLevel)
    {
        IsAI = isAI;
        Name = name;
        if(isAI)
        {
            AiLevel = aiLevel;
        }
  }

    public void setName(String name)
    {
        Name = name;
    }

    public String getName()
    {
        return Name + (IsAI ? " (AI="+AiLevel+")":"");
    }

    public void Reset()
    {
        OwnedCellsCount = 0;
        StepsCount = 0;
        HasFreeCell = true;
    }

    public Player clone()
    {
        Player p = new Player();
        p.Name = Name;
        p.StepsCount = StepsCount;
        p.OwnedCellsCount = OwnedCellsCount;
        p.HasFreeCell = HasFreeCell;
        p.Enabled = Enabled;
        p.IsAI = IsAI;
        p.AiLevel = AiLevel;
        p.GameFieldCornerIndex = GameFieldCornerIndex;
        return p;
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.