internal List <BooleanState> GetSuccessors() { List <BooleanState> myStates = new List <BooleanState>(); int Estado = 0; //Comenzamos por las filas (Cambio en una fila, un nuevo estado) for (int i = 0; i < Size + 1; i++) { for (int j = 0; j < Size; j++) { if (!BoolRow[i, j])//Si no hay linea dibujada, supondremos que se ha dibujado { // Estado++; // Console.WriteLine("--------------------------------------------------------------Estado: " + Estado); BooleanState NewChild = new BooleanState(); bool t = !BoolRow[i, j]; bool[,] boolRow2 = (bool[, ])BoolRow.Clone(); boolRow2[i, j] = t; NewChild.Size = Size; NewChild.BoolRow = boolRow2; NewChild.BoolColumn = (bool[, ])BoolColumn.Clone(); NewChild.Player = Player; NewChild.CreateBoxMatrix(); //NewChild.Print(); myStates.Add(NewChild); } if (!BoolColumn[i, j])//Si no hay linea dibujada, supondremos que se ha dibujado { // Estado++; // Console.WriteLine("--------------------------------------------------------------Estado: " + Estado); BooleanState NewChild = new BooleanState(); bool t = !BoolColumn[i, j]; bool[,] boolRow2 = (bool[, ])BoolRow.Clone(); NewChild.BoolColumn = (bool[, ])BoolColumn.Clone(); NewChild.BoolColumn[i, j] = t; NewChild.BoolRow = boolRow2; NewChild.Player = Player; NewChild.Size = Size; NewChild.CreateBoxMatrix(); //NewChild.Print(); myStates.Add(NewChild); } } } return(myStates); }
internal BooleanState BooleanRepresentation() { //Se arma el equivalente booleano BooleanState myState = new BooleanState(); bool[,] rows = new bool[Size + 1, Size]; bool[,] columns = new bool[Size + 1, Size]; for (int i = 0; i < Size + 1; i++) { for (int j = 0; j < Size; j++) { rows[i, j] = Rows[i][j].IsDraw; columns[i, j] = Columns[i][j].IsDraw; } } BooleanState Temp = new BooleanState { BoolColumn = columns, BoolRow = rows, Player = Jugador, Size = Size }; Temp.CreateBoxMatrix(); return(Temp); }