private static void PlaceHorizonal(World world, int line, Position.Orientation orient)
 {
     for (int i = 0; i < ShogiEnvironment.Board_X; i++)
     {
         PlacePiece(world, i, line, orient);
     }
 }
Beispiel #2
0
 public bool YContains(Position p)
 {
     return NumberUtil.Contains(SY, EY, p.Y);
 }
Beispiel #3
0
 public bool XContains(Position p)
 {
     return NumberUtil.Contains(SX, EX, p.X);
 }
Beispiel #4
0
 public bool Contains(Position p)
 {
     return XContains(p) && YContains(p);
 }
Beispiel #5
0
 private double GetRect(Position.Orientation orient)
 {
     switch (orient)
     {
         case Position.Orientation.Up: return PI(0D);
         case Position.Orientation.Down: return PI(1D);
         //case Position.Orientation.Left: return PI(0.5D);
         //case Position.Orientation.Right: return PI(1.5D);
     }
     return double.NaN;
 }
Beispiel #6
0
 private int GetPlayerNumber(Position.Orientation orient)
 {
     switch (orient)
     {
         case Position.Orientation.Up: return 0;
         case Position.Orientation.Down: return 1;
     }
     return -1;
 }
Beispiel #7
0
 public void PlacePiece(int x, int y, Position.Orientation orient)
 {
     if (orient == Position.Orientation.None)
     {
         Board[x, y] = new Piece(-1);
     }
     else
     {
         Board[x, y] = new Piece(PieceCounter++);
     }
     Board[x, y].Pos = new Position(x, y, orient);
 }
Beispiel #8
0
        public void OnClick(int Code)
        {
            if (mx < 0) return;
            rx = mx / ShogiEnvironment.Piece.SizeX;
            ry = my / ShogiEnvironment.Piece.SizeY;
            if (Code == (int)MouseCode.LEFTCLICK)
            {
                if (ClickedList.Count > 0)
                {
                    Position pos = new Position(rx, ry, Position.Orientation.None);

                    if (ClickedList.Contains(pos))
                    {
                        Move(cx, cy, rx, ry);
                    }
                    ClickedList.Clear();
                }
                else
                {
                    ClickedList.Clear();
                    foreach (var v in Board[rx, ry].AllTypes)
                    {
                        List<Position> res = v.Moving(this, Board[rx, ry]);
                        foreach (var r in res)
                            if (!ClickedList.Contains(r))
                                ClickedList.Add(r);
                    }
                }
            }
            cx = rx;
            cy = ry;
        }
 private static void PlacePiece(World world, int x, int y, Position.Orientation orient)
 {
     world.PlacePiece(x, y, orient);
 }
Beispiel #10
0
 public Position(Position p)
     : this(p.X, p.Y, p.Orient)
 {
 }