public void Toru()
        {
            switch (state)
            {
            case KomaState.OnA:
                state = KomaState.MochiB;
                game.mochibs.Add(this);
                break;

            case KomaState.OnB:
                state = KomaState.MochiA;
                game.mochias.Add(this);
                break;
            }
            game.onboards[X, Y] = null;
            X = Y = -1;

            if (canbeL)
            {
                if (only)
                {
                    game.winner = game.gamestate; game.gamestate = GameState.over;
                }
                else
                {
                    canbeL = false;
                }
            }
        }
        public void Utsu(int x, int y)
        {
            if (!CanUtsu(x, y))
            {
                throw new Exception("error");
            }

            switch (state)
            {
            case KomaState.MochiA:
                game.mochias.Remove(this);
                state = KomaState.OnA;
                break;

            case KomaState.MochiB:
                game.mochibs.Remove(this);
                state = KomaState.OnB;
                break;

            default:
                throw new Exception("error");
            }
            if ((state == KomaState.OnA && y == 0 || state == KomaState.OnB && y == 3) && canbeH == true)
            {
                isNari = true;
            }
            game.onboards[x, y] = this;
            X = x; Y = y;
        }
        public GKoma(int X, int Y, KomaState state, int index, GGame ggame)
            : base(X, Y, state, index, ggame)
        {
            this.ggame = ggame;

            imgH = GetImage("hina.png", 1);
            imgK = GetImage("kirin.png", 1);
            imgZ = GetImage("zo.png", 1);
            imgL = GetImage("lion.png", 1);
            imgN = GetImage("niwatori.png", 1);

            imgH2 = GetImage("hina.png", 0.3);
            imgK2 = GetImage("kirin.png", 0.3);
            imgZ2 = GetImage("zo.png", 0.3);
            imgL2 = GetImage("lion.png", 0.3);
            imgN2 = GetImage("niwatori.png", 0.3);
        }
 public virtual Koma NewKoma(int X, int Y, KomaState state, int index)
 {
     return(new Koma(X, Y, state, index, this));
 }
 public Koma(int X, int Y, KomaState state, int index, Game game)
 {
     this.X = X; this.Y = Y; this.state = state; this.index = index; this.game = game;
     canbeH = canbeK = canbeZ = canbeL = true;
     only   = isNari = false;
 }
 public Koma(int X, int Y, KomaState state, int index, Game game)
 {
     this.X = X; this.Y = Y; this.state = state; this.index = index; this.game = game;
     canbeH = canbeK = canbeZ = canbeL = true;
     only = isNari = false;
 }
 public override Koma NewKoma(int X, int Y, KomaState state, int index)
 {
     return(new GKoma(X, Y, state, index, this));
 }
        public GKoma(int X, int Y, KomaState state, int index, GGame ggame)
            : base(X, Y, state, index, ggame)
        {
            this.ggame = ggame;

            imgH = GetImage("hina.png", 1);
            imgK = GetImage("kirin.png", 1);
            imgZ = GetImage("zo.png", 1);
            imgL = GetImage("lion.png", 1);
            imgN = GetImage("niwatori.png", 1);

            imgH2 = GetImage("hina.png", 0.3);
            imgK2 = GetImage("kirin.png", 0.3);
            imgZ2 = GetImage("zo.png", 0.3);
            imgL2 = GetImage("lion.png", 0.3);
            imgN2 = GetImage("niwatori.png", 0.3);
        }
 public override Koma NewKoma(int X, int Y, KomaState state, int index)
 {
     return new GKoma(X, Y, state, index, this);
 }
 public virtual Koma NewKoma(int X, int Y, KomaState state, int index)
 {
     return new Koma(X, Y, state, index, this);
 }
        public void Utsu(int x, int y)
        {
            if (!CanUtsu(x, y)) throw new Exception("error");

            switch (state)
            {
                case KomaState.MochiA:
                    game.mochias.Remove(this);
                    state = KomaState.OnA;
                    break;
                case KomaState.MochiB:
                    game.mochibs.Remove(this);
                    state = KomaState.OnB;
                    break;
                default:
                    throw new Exception("error");
            }
            if ((state == KomaState.OnA && y == 0 || state == KomaState.OnB && y == 3) && canbeH == true)
            {
                isNari = true;
            }
            game.onboards[x, y] = this;
            X = x; Y = y;
        }
        public void Toru()
        {
            switch (state)
            {
                case KomaState.OnA:
                    state = KomaState.MochiB;
                    game.mochibs.Add(this);
                    break;
                case KomaState.OnB:
                    state = KomaState.MochiA;
                    game.mochias.Add(this);
                    break;
            }
            game.onboards[X, Y] = null;
            X = Y = -1;

            if (canbeL)
            {
                if (only) { game.winner = game.gamestate; game.gamestate = GameState.over; }
                else canbeL = false;
            }
        }