Ejemplo n.º 1
0
        public override bool IsNeighborValidOn(GenericGridWorldDynamicState DynamicState,
                                               GenericGridWorldStaticState ss, bool all)
        {
            Unit U = DynamicState.FindUnit(Unit);

            return(U.Y > 0 && U.X > 0);
        }
Ejemplo n.º 2
0
        public override bool IsNeighborValidOn(GenericGridWorldDynamicState DynamicState,
                                               GenericGridWorldStaticState ss, bool all)
        {
            Unit U = DynamicState.FindUnit(Unit);

            return(U.Y < ss.Height - 1 && U.X < ss.Width - 1);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Tests to see if this action can be performed on the given dynamic state.
        /// </summary>
        /// <param name="DynamicState">The dynamic state to test against.</param>
        /// <returns>Whether this is currently a valid action on the given
        /// state.</returns>
        public override bool IsValidOn(GenericGridWorldDynamicState DynamicState,
                                       GenericGridWorldStaticState ss, bool all)
        {
            Unit U = DynamicState.FindUnit(Unit);

            return(base.IsValidOn(DynamicState, ss, all, U.X > 0, U.Y, U.X - 1));
        }
Ejemplo n.º 4
0
        public override bool IsValidOn(GenericGridWorldDynamicState DynamicState,
                                       GenericGridWorldStaticState ss, bool all)
        {
            Unit U = DynamicState.FindUnit(Unit);

            return(base.IsValidOn(DynamicState, ss, all,
                                  U.Y < ss.Height - 1 && U.X < ss.Width - 1, U.Y + 1, U.X + 1));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Performs the action on the given state. This function is not safe and
        /// it therefore assumes the IsValidOn function has been called in the past.
        /// </summary>
        /// <param name="DynamicState">The state to act upon.</param>
        /// <returns>The resultant state after this action has been performed.
        /// </returns>
        public override IEnumerable <GenericGridWorldDynamicState> PerformOn(
            GenericGridWorldDynamicState
            DynamicState, GenericGridWorldStaticState ss)
        {
            GenericGridWorldDynamicState ds =
                DynamicState.Clone( ) as GenericGridWorldDynamicState;
            Unit U = ds.FindUnit(Unit);

            ds.hash ^= U.GetHashCode( );
            U.X--;
            ds.hash ^= U.GetHashCode( );
            var l = new List <GenericGridWorldDynamicState>( );

            l.Add(ds);
            return(l);
        }