当前位置: 首页>>代码示例>>C#>>正文


C# IMove类代码示例

本文整理汇总了C#中IMove的典型用法代码示例。如果您正苦于以下问题:C# IMove类的具体用法?C# IMove怎么用?C# IMove使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IMove类属于命名空间,在下文中一共展示了IMove类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NodeBase

 internal NodeBase(INode parentNode, IMove move, float uctk, IPlayer player)
 {
     this.parent = parentNode;
     this.move = move;
     this.uctk = uctk;
     this.playerJustMoved = player;
 }
开发者ID:rfrerebe,项目名称:MCTS,代码行数:7,代码来源:NodeBase.cs

示例2: Execute

        public GameState Execute()
        {
            _numPushed = 0;
            _oldPieceToMove = _state.PieceToMove;
            _oldLastMove = _state.LastMove;
            _start = _piece.Position;

            int ystep = _end.Y - _start.Y;

            _state.BoardPositions[_piece.Position.Y][_piece.Position.X] = null;
            Piece currentPiece = _piece;
            while (_state.BoardPositions[currentPiece.Position.Y + ystep][currentPiece.Position.X] != null)
            {
                Piece next = _state.BoardPositions[currentPiece.Position.Y + ystep][currentPiece.Position.X];
                _state.BoardPositions[currentPiece.Position.Y + ystep][currentPiece.Position.X] = currentPiece;
                currentPiece.Position = new Point(currentPiece.Position.X, currentPiece.Position.Y + ystep);
                currentPiece = next;
                _numPushed++;
            }

            _state.BoardPositions[currentPiece.Position.Y + ystep][currentPiece.Position.X] = currentPiece;
            currentPiece.Position = new Point(currentPiece.Position.X, currentPiece.Position.Y + ystep);

            _state.IsPlayerTwo = !_state.IsPlayerTwo;
            _state.PieceToMove = currentPiece;
            _state.LastMove = this;

            List<IMove> possible = new List<IMove>();
            possible.Add(new SumoDazedMove(_state, currentPiece));
            _state.PossibleMoves = possible;

            return _state;
        }
开发者ID:vfarcy,项目名称:Kamisado,代码行数:33,代码来源:SumoPushMove.cs

示例3: IsValidMove

        public override bool IsValidMove(IPlayer player, IMove move)
        {
            var checkersBoard = (CheckersBoard)CurrentGameState;
            var checkersMove = (CheckersMove)move;
            var checkersPlayer = (CheckersPlayer)player;
            var startPiece = (CheckersPiece)checkersBoard.GetPieceAt(checkersMove.MovePath[0]);

            if (startPiece==null) return false;
            if (startPiece.Color != checkersPlayer.Color) return false;

            int maxEat=0;
            bool eatMove=false;

            foreach (var piece in checkersBoard.GetPiecesOfColor(startPiece.Color))
            {
                var possibleMoves = piece.PossibleMoves;
                if (possibleMoves.Count > 0)
                {
                    var otherMove = possibleMoves[0] as CheckersMove;
                    if (maxEat < otherMove.MovePath.Length)
                    {
                        maxEat = otherMove.MovePath.Length;
                    }
                    if (otherMove.EatMove)
                        eatMove = true;
                }
            }

            bool isPossible = startPiece.PossibleMoves.Cast<CheckersMove>().Contains(checkersMove);
            return
                eatMove==checkersMove.EatMove &&
                checkersMove.MovePath.Length==maxEat &&
                isPossible;
        }
开发者ID:Bajena,项目名称:Checkers,代码行数:34,代码来源:CheckersModerator.cs

示例4: Pouring

 internal Pouring(IReadOnlyList<int> capacities, IReadOnlyList<int> state, Pouring previous, IMove move)
 {
     Capacities = capacities;
     State = state;
     Move = move;
     Previous = previous;
 }
开发者ID:timurgaitov,项目名称:waterpouring,代码行数:7,代码来源:Pouring.cs

示例5: Enter

 protected Enter(Actor self, Actor target, int maxTries = 1, bool targetCenter = false)
 {
     this.move = self.Trait<IMove>();
     this.target = Target.FromActor(target);
     this.maxTries = maxTries;
     this.targetCenter = targetCenter;
 }
开发者ID:ushardul,项目名称:OpenRA,代码行数:7,代码来源:Enter.cs

示例6: DeliverGoods

 public DeliverGoods(Actor self)
 {
     trader = self.Trait<Trader>();
     traderInfo = self.Info.Traits.Get<TraderInfo>();
     move = self.Trait<IMove>();
     pathFinder = self.World.WorldActor.Trait<IPathFinder>();
 }
开发者ID:Holloweye,项目名称:OpenRA,代码行数:7,代码来源:DeliverGoods.cs

示例7: Follow

        public Follow(Actor self, Target target, WRange minRange, WRange maxRange)
        {
            this.target = target;
            this.minRange = minRange;
            this.maxRange = maxRange;

            move = self.Trait<IMove>();
        }
开发者ID:ushardul,项目名称:OpenRA,代码行数:8,代码来源:Follow.cs

示例8: LayMines

 public LayMines(Actor self)
 {
     minelayer = self.TraitOrDefault<Minelayer>();
     info = self.Info.TraitInfo<MinelayerInfo>();
     ammoPools = self.TraitsImplementing<AmmoPool>().ToArray();
     movement = self.Trait<IMove>();
     rearmBuildings = info.RearmBuildings;
 }
开发者ID:pchote,项目名称:OpenRA,代码行数:8,代码来源:LayMines.cs

示例9: Contrail

 public Contrail(Actor self, ContrailInfo info)
 {
     contrailTurret = new Turret(info.ContrailOffset);
     history = new ContrailHistory(info.TrailLength,
         info.UsePlayerColor ? ContrailHistory.ChooseColor(self) : info.Color);
     facing = self.Trait<IFacing>();
     move = self.Trait<IMove>();
 }
开发者ID:jeff-1amstudios,项目名称:OpenRA,代码行数:8,代码来源:Contrail.cs

示例10: Refuel

 public Refuel(Actor self, Actor host)
 {
     move = self.TraitOrDefault<IMove>();
     this.host = host;
     target = Target.FromActor(host);
     refuels = host.TraitOrDefault<RefuelsUnits>();
     fueltank = self.TraitOrDefault<Fueltank>();
 }
开发者ID:obrakmann,项目名称:oramod-wargame,代码行数:8,代码来源:Refuel.cs

示例11: Drag

		public Drag(Actor self, WPos start, WPos end, int length)
		{
			positionable = self.Trait<IPositionable>();
			movement = self.TraitOrDefault<IMove>();
			moveDisablers = self.TraitsImplementing<IDisableMove>().ToArray();
			this.start = start;
			this.end = end;
			this.length = length;
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:9,代码来源:Drag.cs

示例12: PutShipsUserControl

 public PutShipsUserControl(IMove lvl)
 {
     InitializeComponent();
     computer = Computer.getInstance(lvl);
     DisableComputerBoard();
     computerShipsAdded = computer.PutComputerShips();
     MessageBox.AppendText("Dodano wszystkie statki przeciwnika.");
     MessageBox.AppendText(Environment.NewLine + "Proszę dodać dwumasztowy statek.");
 }
开发者ID:gornikp,项目名称:ZTP,代码行数:9,代码来源:PutShipsUserControl.xaml.cs

示例13: getInstance

        public static Computer getInstance(IMove lvl)
        {
            if (instance == null)
            {
                instance = new Computer(lvl);
            }
            return instance;

        }
开发者ID:gornikp,项目名称:ZTP,代码行数:9,代码来源:Computer.cs

示例14: Drag

 public Drag(Actor self, WPos start, WPos end, int length)
 {
     positionable = self.Trait<IPositionable>();
     movement = self.TraitOrDefault<IMove>();
     disableable = movement as IDisabledTrait;
     this.start = start;
     this.end = end;
     this.length = length;
 }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:9,代码来源:Drag.cs

示例15: Board

        public Board(int[,] data, IMove move)
        {
            if (data == null) { throw new ArgumentNullException(nameof(data)); }

            _data = (int[,])data.Clone();
            _data[move.Row, move.Column] = move.Value;

            // Validate(_data);
        }
开发者ID:sayedihashimi,项目名称:sudoku,代码行数:9,代码来源:Board.cs


注:本文中的IMove类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。