예제 #1
0
        public void OpenDirectory(String[] FileNames, bool skipoutlines = false)
        {
            string path = Path.GetDirectoryName(FileNames[0]);

            foreach (var F in FileNames)
            {
                BoardSide  BS = BoardSide.Unknown;
                BoardLayer BL = BoardLayer.Unknown;

                if (Gerber.FindFileType(F) == BoardFileType.Gerber)
                {
                    Gerber.DetermineBoardSideAndLayer(F, out BS, out BL);

                    if (BS == BoardSide.Both && BL == BoardLayer.Outline)
                    {
                        outlinefiles.Add(F);
                    }
                    else
                    {
                        if (BS == BoardSide.Both && BL == BoardLayer.Mill)
                        {
                            millfiles.Add(F);
                        }
                        else
                        {
                            if (BL == BoardLayer.Copper)
                            {
                                copperfiles.Add(F);
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        private void RenderParts(PnPProcDoc D, bool after, Graphics G, BoardSide side, float S)
        {
            var B = D.B;

            if (after)
            {
                B = D.BPost;
            }
            int curpart = 0;

            foreach (var p in B.DeviceTree)
            {
                foreach (var pp in p.Value.Values)
                {
                    var curcol = Helpers.RefractionNormalledMaxBrightnessAndSat(curpart / p.Value.Values.Count());
                    curpart++;
                    foreach (var rf in pp.RefDes)
                    {
                        if (rf.Side == side)
                        {
                            BOM.RenderPackage(G, rf.x, rf.y, rf.angle, pp.PackageName, rf.Side);
                        }
                    }
                }
            }
        }
예제 #3
0
        private void RenderLayerSets(bool after, Graphics G, float S, BoardSide side, BoardLayer layer, Color C, bool lines = true)
        {
            if (pnp.ActiveDoc == null)
            {
                return;
            }
            var D = pnp.ActiveDoc;
            List <ParsedGerber> s;

            if (after)
            {
                s = D.FixSet.PLSs;
            }
            else
            {
                s = D.Set.PLSs;
            }
            foreach (var l in s)
            {
                if (l.Side == side && l.Layer == layer)
                {
                    RenderOutline(G, S, l, C, lines);
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Converts BoardSide enum castling rights into a FEN compliant string
        /// </summary>
        /// <param name="castlingRights">Rights to convert</param>
        /// <param name="color">Color (for casing)</param>
        /// <returns>FEN compliant string for the BoardSide, e.g. "KQ"</returns>
        private static string TokenizeCastlingRights(BoardSide castlingRights, PieceColor color)
        {
            string result = String.Empty;

            if (castlingRights.HasFlag(BoardSide.King) & castlingRights.HasFlag(BoardSide.Queen))
            {
                result = String.Concat(result, "kq");
            }
            else if (castlingRights.HasFlag(BoardSide.King))
            {
                result = String.Concat(result, "k");
            }
            else if (castlingRights.HasFlag(BoardSide.Queen))
            {
                result = String.Concat(result, "q");
            }
            else
            {
                result = "-";
            }

            if (color == PieceColor.White)
            {
                result = result.ToUpper();
            }
            return(result);
        }
예제 #5
0
파일: Hashcode.cs 프로젝트: CNHume/Samples
        protected void hashPiece(BoardSide side, Byte vPiece, Int32 n)
        {
            if (nPieces <= vPiece)
            {
                Debug.Assert(vPiece < nPieces, "hashPiece(nPieces <= vPiece)");
            }

            if (n < 0)
            {
                Debug.Assert(n >= 0, "hashPiece(n < 0)");
            }
            else if (nSquares <= n)
            {
                Debug.Assert(n < nSquares, "hashPiece(nSquares <= n)");
            }

            var zobrist = side.Parameter.Zobrist;
            var qHash   = zobrist[vPiece][n];

            if (vPiece == vP6)
            {
                HashPawn ^= qHash;
            }
            Hash ^= qHash;
        }
예제 #6
0
        //
        // The following is used to preempt Illegal King Moves.
        // Allowing the moves, then handling them like Illegal
        // Moves may be just as fast.
        //
        protected Plane attacks(BoardSide foe, Plane qpFriend)
        {
            var qpTo = 0UL;

            qpTo |= (qpFriend & foe.PawnA1H8Atx);
            qpTo |= (qpFriend & foe.PawnA8H1Atx);

            while (qpFriend != 0)
            {
                var n = RemoveLo(ref qpFriend, out Plane qp);

                var bAttacked =
                    (foe.Piece & Knight & KnightAtx[n]) != 0 ||
                    (foe.Piece & DiagPiece & diagAtx(n)) != 0 ||
                    (foe.Piece & RectPiece & rectAtx(n)) != 0 ||
                    (foe.Piece & King & KingAtx[n]) != 0;

                if (bAttacked)
                {
                    qpTo |= qp;
                }
            }

            return(qpTo);
        }
        public static void performTest(Func <BoardSide, BoardSide, string> setUp)
        {
            ConsoleColor defaults = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.Yellow;
            HearthstoneBoard b        = new HearthstoneBoard();
            BoardSide        b1       = new BoardSide();
            BoardSide        b2       = new BoardSide();
            string           testname = setUp(b1, b2);

            Console.WriteLine("Starting test: " + testname + "!--------------------------------------------------");
            Console.ForegroundColor = defaults;
            b.p1Board = b1;
            b.p2Board = b2;
            try
            {
                b.printState();
                Console.WriteLine("#####");
                // b.printEvents = true;
                List <HearthstoneBoard> res = b.simulateResults(10000);


                var dmgdist = StatisticsManager.calculateDmgDistributions(res);
                StatisticsManager.printReadableResult(dmgdist);
            }
            catch (ExceptionWithMessageWhyDoesntCSharpHaveItDeafaultComeOne e)
            {
                Console.WriteLine("An error occured when performing test " + testname + ". Message: " + e.message);
                Console.ReadLine();
            }
        }
    public void killOf(Card c)
    {
        printDebugMessage("Card is killed of: " + c.getReadableName(), OutputPriority.DAMAGES);
        BoardSide current = p1Board.Contains(c) ? p1Board : p2Board;

        if (!p2Board.Contains(c) && !p1Board.Contains(c))
        {
            throw new CardDoesNotExistException("killOf failed: card does not exist: " + c.ID);
        }
        List <Card> alreadyInformed = new List <Card>();

        for (int i = 0; i < current.Count; i++)
        {
            if (!alreadyInformed.Contains(current[i]))
            {
                alreadyInformed.Add(current[i]);
                current[i].performedAction(new CardKilledAction(c), this);
            }
        }
        current.Remove(c);
        current.graveyard.Add(new BoardSide.DeadCard(c.cardID, c.golden, c.getCardType()));

        printDebugMessage("Card killed: count is now: " + current.Count, OutputPriority.INTENSEDEBUG);
        printDebugMessage("Card killed: count is now on p2: " + p2Board.Count, OutputPriority.INTENSEDEBUG);
    }
예제 #9
0
        /// <summary>
        ///     Удерживать заданную точку в пределах поля
        /// </summary>
        /// <param name="side">Сторона поля</param>
        /// <param name="point">Точка</param>
        public void StayAtField(BoardSide side, ref Vector3 point)
        {
            var xSign = Mathf.Sign(point.x);
            var ySign = side == BoardSide.Upper ? 1 : -1;

            var weight = _fieldSize.x / 2 - _puck.Radius;
            var height = _fieldSize.y - _puck.Radius - _rubberRope.Thickness;

            weight = Mathf.Abs(point.y) > _rubberRope.PositionY ? weight - _rubberRope.Thickness : weight;

            if (side == BoardSide.Upper)
            {
                point.y = point.y > 0
                    ? point.y > height ? height : point.y
                    : 0;
            }
            else
            {
                point.y = point.y > 0
                    ? 0
                    : point.y > -height ? point.y : -height;
            }

            point.y = Mathf.Abs(point.y) < _crossbar.Height
                ? Mathf.Abs(point.x) < _crossbar.Width / 2 ? point.y : (_puck.Radius + _crossbar.Height) * ySign
                : point.y;

            weight = Mathf.Abs(point.y) < _crossbar.Height
                ? Mathf.Abs(point.x) < _crossbar.Width / 2 - _puck.Radius ? weight : _crossbar.Width / 2 - _puck.Radius
                : weight;

            point.x = Mathf.Abs(point.x) > weight ? weight * xSign : point.x;
        }
예제 #10
0
 bool CheckSide(Tile other, BoardSide side)
 {
     if (side == BoardSide.Down)
     {
         return(other.Data[0] == Data[Data.Count - 1]);
     }
     if (side == BoardSide.Up)
     {
         return(other.Data[other.Data.Count - 1] == Data[0]);
     }
     if (side == BoardSide.Left)
     {
         for (var r = 0; r < Data.Count; ++r)
         {
             if (Data[r][0] != other.Data[r][other.Data.Count - 1])
             {
                 return(false);
             }
         }
     }
     if (side == BoardSide.Right)
     {
         for (var r = 0; r < Data.Count; ++r)
         {
             if (Data[r][Data.Count - 1] != other.Data[r][0])
             {
                 return(false);
             }
         }
     }
     return(true);
 }
예제 #11
0
파일: AddMoves.cs 프로젝트: CNHume/Samples
        private void addPawnMoves(BoardSide side, Plane qpTo)
        {
            var qpPawn = side.Piece & Pawn;

            //
            // Pawn Advances:
            //
            var qpAdvance1 = shiftl(qpPawn, side.Parameter.ShiftRank) & ~RankPiece;
            var qpAdvance2 = shiftl(qpAdvance1 & side.Parameter.RankPass, side.Parameter.ShiftRank) & ~RankPiece;
            var qpAdv1From = shiftr(qpAdvance1 & qpTo, side.Parameter.ShiftRank);
            var qpAdv2From = shiftr(qpAdvance2 & qpTo, 2 * side.Parameter.ShiftRank);

#if TestPawnAdvances
            LogLine("Pawn Advance:\n");
            writeRect(qpAdvance1 | qpAdvance2);
            LogLine();
#endif
            while (qpAdv1From != 0)
            {
                var nFrom    = RemoveLo(ref qpAdv1From);
                var nTo      = nFrom + side.Parameter.ShiftRank;
                var qpMoveTo = BIT0 << nTo;
                var bAbove   = (side.Parameter.Above & qpMoveTo) != 0;
                var bPromote = (side.Parameter.RankLast & qpMoveTo) != 0;
                addPawnMove(nFrom, nTo, bAbove, bPromote);
            }

            while (qpAdv2From != 0)
            {
                var nFrom = RemoveLo(ref qpAdv2From);
                var nTo   = nFrom + 2 * side.Parameter.ShiftRank;
                addPawnMove(nFrom, nTo, false, false);
            }
        }
예제 #12
0
        public static string testZapp(BoardSide b1, BoardSide b2, List <HearthstoneBoard> expected)
        {
            b1.Add(CardCreatorFactory.createFromName(CardCreatorFactory.Cards.ZappSlywick));

            b2.Add(CardCreatorFactory.createFromName(CardCreatorFactory.Cards.DragonspawnLieutenant));
            b2.Add(CardCreatorFactory.createFromName(CardCreatorFactory.Cards.DragonspawnLieutenant));
            b2.Add(CardCreatorFactory.createFromName(CardCreatorFactory.Cards.BaronRivendare));
            b2.Add(CardCreatorFactory.createFromName(CardCreatorFactory.Cards.BaronRivendare).setPoisonous(true));

            HearthstoneBoard exp1 = new HearthstoneBoard();

            exp1.p2Board = new BoardSide {
                CardCreatorFactory.createFromName(CardCreatorFactory.Cards.DragonspawnLieutenant), CardCreatorFactory.createFromName(CardCreatorFactory.Cards.BaronRivendare)
            };
            expected.Add(exp1);

            HearthstoneBoard exp2 = new HearthstoneBoard();

            exp2.p2Board = new BoardSide {
                CardCreatorFactory.createFromName(CardCreatorFactory.Cards.DragonspawnLieutenant)
            };
            expected.Add(exp2);

            return("test zapp targeting");
        }
    public override void doAction(Action cause, Card user, HearthstoneBoard board, List <Card> alwaysUse)
    {
        board.printDebugMessage("Performing action: bomb deathrattle: " + user, HearthstoneBoard.OutputPriority.EFFECTTRIGGERS);
        BoardSide   opponentBoard = board.getOpponentBoardFromMinion(user);
        List <Card> targets       = new List <Card>();

        for (int i = 0; i < times; i++)
        {
            if (opponentBoard.Count == 0)
            {
                return;
            }
            Card target = opponentBoard.getRandomCardAlive(board);
            if (target == null)
            {
                return;
            }
            user.causeDamageToTarget(target, board, 4);
            targets.Add(target);
        }
        foreach (Card c in targets)
        {
            c.deathCheck(board);
        }
    }
예제 #14
0
 internal void Arrow(PointD pointD1, PointD pointD2, BoardSide side, BoardLayer layer = BoardLayer.Silk)
 {
     foreach (var L in GetGAW(side, layer))
     {
         L.Arrow(pointD1, pointD2);
     }
 }
예제 #15
0
        protected void placePiece(BoardSide side, Byte vPiece, Int32 nTo)
        {
            var bLite = lowerPiece(side, vPiece, nTo);

            incSideCount(side, vPiece);

            //
            // Update BishopMask
            //
            if (vPiece == vB6)
            {
                side.FlagsHi |= bLite ? HiFlags.Lite : HiFlags.Dark;
#if HashPieces
                var u = (UInt32)(side.FlagsHi & HiFlags.Pair) >> nBishopPairBit;
                setTwoBits(ref side.PieceHash, 0, u); // Piece == vHF
#endif
            }
#if HashPieces
            if (vP6 < vPiece && vPiece < vK6)
            {
                var u = nibble(side.Counts >> vPiece * nPerNibble);
                setTwoBits(ref side.PieceHash, vPiece - vHF, u % vMod4);
            }
#endif
        }
예제 #16
0
    public override void doAction(Action cause, Card user, HearthstoneBoard board, List <Card> alwaysUse)
    {
        board.printDebugMessage("Performing action: deathrattledivine: " + user, HearthstoneBoard.OutputPriority.EFFECTTRIGGERS);

        BoardSide userBoard = board.getBoardFromMinion(user);

        for (int i = 0; i < times; i++)
        {
            bool stop = true;
            foreach (Card c in userBoard)
            {
                if (c != user && !c.divineShield)
                {
                    board.printDebugMessage("Found minion without divine shield " + c.getReadableName(), HearthstoneBoard.OutputPriority.INTENSEDEBUG);
                    stop = false;
                }
            }
            if (stop)
            {
                return;
            }
            while (true)
            {
                int target = board.getRandomNumber(0, userBoard.Count);
                if (!userBoard[target].divineShield && userBoard[target] != user)
                {
                    board.printDebugMessage("Giving divine shield to " + userBoard[target].getReadableName(), HearthstoneBoard.OutputPriority.INTENSEDEBUG);
                    userBoard[target].setDivineShield(true);
                    break;
                }
            }
        }
    }
예제 #17
0
        public static Move GetCastle(PieceColor color, BoardSide side)
        {
            if (color == PieceColor.None)
            {
                throw new ArgumentException("Piece Color for castle move must be specified.");
            }
            if (side == BoardSide.None)
            {
                throw new ArgumentException("Board Side for castle move must be specified.");
            }

            switch (color)
            {
            case PieceColor.White:
                return(new Move(Piece.WhiteKing, Location.E1, side == BoardSide.KingSide ? Location.G1 : Location.C1)
                {
                    IsCastle = true
                });

            case PieceColor.Black:
                return(new Move(Piece.BlackKing, Location.E8, side == BoardSide.KingSide ? Location.G8 : Location.C8)
                {
                    IsCastle = true
                });
            }
            throw new InvalidOperationException();
        }
예제 #18
0
    public override void doAction(Action cause, Card user, HearthstoneBoard board, List <Card> alwaysUse)
    {
        board.printDebugMessage("Performing action: deathrattle dmg bonus: " + user, HearthstoneBoard.OutputPriority.EFFECTTRIGGERS);

        BoardSide userBoard = board.getBoardFromMinion(user);

        if (userBoard.Count == 1)
        {
            return;
        }


        for (int i = 0; i < times; i++)
        {
            while (true)
            {
                int target = board.getRandomNumber(0, userBoard.Count);
                if (userBoard[target] != user)
                {
                    board.printDebugMessage("Giving damage bonus to " + userBoard[target].getReadableName(), HearthstoneBoard.OutputPriority.INTENSEDEBUG);
                    userBoard[target].addAttack(user.getAttack(board));
                    break;;
                }
            }
        }
    }
예제 #19
0
    public override void doAction(Action cause, Card user, HearthstoneBoard board, List <Card> alwaysUse)
    {
        board.printDebugMessage("Performing action: make extra summon: " + user, HearthstoneBoard.OutputPriority.EFFECTTRIGGERS);
        BoardSide userboard = board.getBoardFromMinion(user);

        for (int i = 0; i < userboard.IndexOf(user); i++)
        {
            if (userboard[i].hasEffect(this))
            {
                return;
            }
        }
        if (current < 1)
        {
            current = count;
        }
        else
        {
            Card c = ((CardSpawnedAction)cause).spawnedCard();
            if (c == user)
            {
                return;
            }
            current--;
            board.printDebugMessage("khadgar effect used, count is now " + current, HearthstoneBoard.OutputPriority.INTENSEDEBUG);
            board.addNewMinionToBoard(board.getPlayerFromMinion(user), c.copy().setId(board.getRandomNumber(1, 9999)), board.getPositionFromMinion(c), true);
        }
    }
예제 #20
0
파일: AddMoves.cs 프로젝트: CNHume/Samples
        private void addPawnCaptures(BoardSide side, Plane qpTo)
        {
            var nEP = IsPassed() ? ep(FlagsLo) : nSquares;

            addPawnCaptures2(side, side.PawnA1H8Atx & qpTo, side.Parameter.ShiftA1H8, nEP);
            addPawnCaptures2(side, side.PawnA8H1Atx & qpTo, side.Parameter.ShiftA8H1, nEP);
        }
    public Card chooseTarget(int player, Card attacker)
    {
        BoardSide current = getBoardFromPlayer(player);
        BoardSide other   = player == 1 ? p2Board : p1Board;
        Card      target;

        if (attacker.getName().Equals("Zapp Slywick"))
        {
            var targets = other.getLowestAtks(this);
            printDebugMessage("Zapp targets:", OutputPriority.INTENSEDEBUG);
            foreach (Card c in targets)
            {
                printDebugMessage(c.getReadableName(), OutputPriority.INTENSEDEBUG);
            }
            return(targets[getRandomNumber(0, targets.Count)]);
        }

        List <Card> taunts = other.getTaunts();

        if (taunts.Count == 0)
        {
            int res = getRandomNumber(0, other.Count);
            target = other[res];
        }
        else
        {
            target = taunts[getRandomNumber(0, taunts.Count)];
        }
        return(target);
    }
    public void doTurn(int player)
    {
        printDebugMessage("Player " + player + " attacking.", OutputPriority.ATTACKERS);
        BoardSide current = getBoardFromPlayer(player);
        BoardSide other   = player == 1 ? p2Board : p1Board;

        if (!current.hasAvailableAttackers(this))
        {
            printDebugMessage("Player " + player + " has no minions to attack with.", OutputPriority.ATTACKERS);
            return;
        }

        Card attacker = getHighestPriorityCard(current);

        if (attacker.attackPriority == Card.MAX_PRIORITY)
        {
            setAttackPriorities(player);
            attacker = getHighestPriorityCard(current);
        }
        while (attacker.getAttack(this) == 0)
        {
            attacker.attackPriority = Card.MAX_PRIORITY;
            attacker = getHighestPriorityCard(current);
        }

        attacker.performAttack(chooseTarget(player, attacker), this);
        printDebugMessage("Checking for windfury: " + attacker.windfury + " isAlive: " + attacker.isAlive() + " Count:" + other.Count, OutputPriority.INTENSEDEBUG);
        if (attacker.isAlive() && attacker.windfury && other.Count != 0)
        {
            attacker.performAttack(chooseTarget(player, attacker), this);
        }
    }
예제 #23
0
파일: Mover.cs 프로젝트: CNHume/Samples
        protected void resetPawnAtx(BoardSide side)
        {
            var qpPawn = side.Piece & Pawn;

            side.PawnA1H8Atx = shiftl(qpPawn & ~side.Parameter.FileRight, side.Parameter.ShiftA1H8);
            side.PawnA8H1Atx = shiftl(qpPawn & ~side.Parameter.FileLeft, side.Parameter.ShiftA8H1);
        }
        public static BoardSide loadBoardSide(string filename)
        {
            FileStream stream    = new FileStream(filename, FileMode.Open, FileAccess.Read);
            IFormatter formatter = new BinaryFormatter();
            BoardSide  objnew    = (BoardSide)formatter.Deserialize(stream);

            return(objnew);
        }
예제 #25
0
파일: Board.cs 프로젝트: CNHume/Samples
 private void newSides()
 {
     foreach (var parameter in Parameter)
     {
         var nSide = (Int32)parameter.SideName;
         Side[nSide] = new BoardSide(parameter);
     }
 }
예제 #26
0
 public Computer(IOutputDevice outputDevice, BoardSide boardNum, Player opponent = null, bool afterLoad = false) : base(boardNum, Players.Computer, opponent, outputDevice)
 {
     if (!afterLoad)
     {
         AddShips();
     }
     _chosenDir = Enumerable.Repeat(false, 4).ToArray();
 }
예제 #27
0
        public void AddFileStream(ProgressLog log, MemoryStream S, string origfilename, double drillscaler = 1.0)
        {
            var FileType = Gerber.FindFileTypeFromStream(new StreamReader(S), origfilename);

            S.Seek(0, SeekOrigin.Begin);

            if (FileType == BoardFileType.Unsupported)
            {
                return;
            }

            ParsedGerber PLS;


            GerberParserState State = new GerberParserState()
            {
                PreCombinePolygons = false
            };

            if (FileType == BoardFileType.Drill)
            {
                if (Gerber.ExtremelyVerbose)
                {
                    Console.WriteLine("Log: Drill file: {0}", origfilename);
                }
                PLS = PolyLineSet.LoadExcellonDrillFileFromStream(log, new StreamReader(S), origfilename, false, drillscaler);
                S.Seek(0, SeekOrigin.Begin);

                // ExcellonFile EF = new ExcellonFile();
                // EF.Load(a);
            }
            else
            {
                bool       forcezerowidth     = false;
                bool       precombinepolygons = false;
                BoardSide  Side  = BoardSide.Unknown;
                BoardLayer Layer = BoardLayer.Unknown;
                Gerber.DetermineBoardSideAndLayer(origfilename, out Side, out Layer);
                if (Layer == BoardLayer.Outline || Layer == BoardLayer.Mill)
                {
                    forcezerowidth     = true;
                    precombinepolygons = true;
                }
                State.PreCombinePolygons = precombinepolygons;


                PLS = PolyLineSet.LoadGerberFileFromStream(log, new StreamReader(S), origfilename, forcezerowidth, false, State);
                S.Seek(0, SeekOrigin.Begin);

                PLS.Side  = Side;
                PLS.Layer = Layer;
            }

            Gerbers.Add(new DisplayGerber()
            {
                File = PLS, visible = true, sortindex = Gerber.GetDefaultSortOrder(PLS.Side, PLS.Layer), Color = Colors.GetDefaultColor(PLS.Layer, PLS.Side)
            });
        }
예제 #28
0
    public void VolleyShot(BoardSide boardSide, float power)
    {
        var possibleArtillery = artillery[boardSide];

        for (int i = 0; i < possibleArtillery.Length; i++)
        {
            possibleArtillery[i].Shoot(power);
        }
    }
예제 #29
0
        protected Boolean lowerPiece(BoardSide side, Byte vPiece, Int32 nTo)
        {
            hashPiece(side, vPiece, nTo);
            var qp = BIT0 << nTo;

#if VerifySquarePiece
            foreach (var testSide in Side)
            {
                if ((qp & testSide.Piece) != 0)
                {
                    var sb = new StringBuilder();
                    sb.Append($"{testSide.Parameter.SideName} Piece prevents placement of {side.Parameter.SideName} Piece at")
                    .AppendSquares(qp);
                    throw new MoveException(sb.ToString());
                }
            }
#endif
            setPiece(side, qp);
#if !Magic
            setRotations(nTo);
#endif
            var bLite = false;
            switch (vPiece)
            {
            case vP6:
                Pawn |= qp;
                break;

            case vR6:
                RectPiece |= qp;
                break;

            case vN6:
                Knight |= qp;
                break;

            case vB6:
                DiagPiece |= qp;
                bLite      = (qp & LiteSquare) != 0;
                break;

            case vQ6:
                DiagPiece |= qp;
                RectPiece |= qp;
                break;

            case vK6:
                King        |= qp;
                side.KingPos = (Byte)nTo;
                break;

            default:
                throw new PieceException("Unexpected Piece [lowerSide]");
            }

            return(bLite);
        }
        public static string Ghastcoiler(BoardSide b1, BoardSide b2)
        {
            b1.Add(CardCreatorFactory.createFromName(CardCreatorFactory.Cards.GhastCoiler));
            b2.Add(CardCreatorFactory.createFromName(CardCreatorFactory.Cards.GhastCoiler));



            return("Ghastcoiler");
        }
예제 #31
0
파일: Move.cs 프로젝트: Keboo/PGNSharp
        public static Move GetCastle(PieceColor color, BoardSide side)
        {
            if (color == PieceColor.None) throw new ArgumentException("Piece Color for castle move must be specified.");
            if (side == BoardSide.None) throw new ArgumentException("Board Side for castle move must be specified.");

            switch (color)
            {
                case PieceColor.White:
                    return new Move(Piece.WhiteKing, Location.E1, side == BoardSide.KingSide ? Location.G1 : Location.C1) { IsCastle = true };
                case PieceColor.Black:
                    return new Move(Piece.BlackKing, Location.E8, side == BoardSide.KingSide ? Location.G8 : Location.C8) { IsCastle = true };
            }
            throw new InvalidOperationException();
        }
예제 #32
0
파일: Camera.cs 프로젝트: GodLesZ/svn-dump
		public void Flip( FlipDirection direction ) {
			side = ( side == BoardSide.Front ) ? BoardSide.Back : BoardSide.Front;
			baseXZ += (float)Math.PI * (int)direction;

			previousXZ = currentXZ;
			targetXZ = baseXZ;
			cameraMovementCurrentTime = 0.0f;
			cameraMovementTotalTime = 0.6f;

			Audio.Play( "Flip Board" );
			isFlipping = true;
		}