• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IMove类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Start

    protected virtual void Start()
    {
        this.moveBehaviour = this.GetComponent<IMove> ();
        if (this.moveBehaviour == null) {
            this.moveBehaviour = this.gameObject.AddComponent<EmptyMove> ();
        }

        this.moveBehaviour.Init (this.sea);
    }
开发者ID:imgr8,项目名称:FishingMine,代码行数:9,代码来源:AMCatchable.cs


示例17: CanMovePiece

 public bool CanMovePiece(IPlayer player, IBoard board, IMove move)
 {
     var context = new DefaultGameRuleStrategyContext();
     var canMovePiece = false;
     for (var strategy = this; !context.IsDone && !canMovePiece && strategy != null; strategy = strategy.next)
     {
         canMovePiece = strategy.CanStrategyMovePiece(player, board, move, context);
     }
     return canMovePiece;
 }
开发者ID:MarinAtanasov,项目名称:Backgammon,代码行数:10,代码来源:GameRuleStrategyBase.cs


示例18: SingleThreadedNode

 internal SingleThreadedNode(INode parent, IMove move, IGameState gameState, float uctk)
     : base(parent, move, uctk, gameState.PlayerJustMoved)
 {
     this.wins = 0L;
     this.visits = 0L;
     this.childs = new List<INode>();
     var moves = gameState.GetMoves();
     var shuffled = moves.Shuffle();
     this.untriedMoves = new Stack<IMove>(shuffled); //randomize Moves
 }
开发者ID:rfrerebe,项目名称:MCTS,代码行数:10,代码来源:SingleThreadedNode.cs


示例19: CanStrategyMovePiece

        protected override bool CanStrategyMovePiece(IPlayer player, IBoard board, IMove move, IGameRuleStrategyContext context)
        {
            if (board.Bar.Any(x => x.Player == player.Name))
            {
                context.IsDone = true;
                return this.IsMoveValid(board, move.Die.Value, player.Name);
            }

            return false;
        }
开发者ID:MarinAtanasov,项目名称:Backgammon,代码行数:10,代码来源:EnterPieceStrategy.cs


示例20: PickupUnit

 public PickupUnit(Actor self, Actor cargo)
 {
     this.cargo = cargo;
     carryable = cargo.Trait<Carryable>();
     cargoFacing = cargo.Trait<IFacing>();
     movement = self.Trait<IMove>();
     carryall = self.Trait<Carryall>();
     helicopter = self.Trait<Helicopter>();
     selfFacing = self.Trait<IFacing>();
     state = State.Intercept;
 }
开发者ID:ushardul,项目名称:OpenRA,代码行数:11,代码来源:PickupUnit.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMultiLineString类代码示例发布时间:2022-05-24
下一篇:
C# IMouseInformation类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap