Пример #1
0
        public static List<Grid> NextPossibleWorldStates(Grid state)
        {
            var nextStates = new List<Grid>();
            for (var x = 0; x < 4; x++)
                for (var y = 0; y < 4; y++)
                    if (state[x, y] == 0)
                    {
                        var newState = state.CloneMatrix();
                        newState[x, y] = 2;

                        nextStates.Add(new Grid(newState));
                    }

            return nextStates;
        }
Пример #2
0
        public static List <Grid> NextPossibleWorldStates(Grid state)
        {
            var nextStates = new List <Grid>();

            for (var x = 0; x < 4; x++)
            {
                for (var y = 0; y < 4; y++)
                {
                    if (state[x, y] == 0)
                    {
                        var newState = state.CloneMatrix();

                        newState[x, y] = 2;

                        nextStates.Add(new Grid(newState));
                    }
                }
            }

            return(nextStates);
        }