public List <IState> AvailableMoves() { List <IState> availableMoves = new List <IState>(); for (int i = 0; i < towertops.Count; i++) { for (int j = 0; j < towertops.Count; j++) { if (i == j) { if (cubes[towertops[i]] != -1) { CubeAction a = new CubeAction(towertops[i], -1); availableMoves.Add(a.ResultState(this)); } } else { CubeAction a = new CubeAction(towertops[i], towertops[j]); availableMoves.Add(a.ResultState(this)); } } } return(availableMoves); }
public CubeState() { cubes = new Dictionary <int, int>(); towertops = new List <int>(); fromAction = new CubeAction(-2, -2); }