public bool[,] getCheckerboard(int numX, int numY, int numBlack, int minSteps) { squareNumX = numX; squareNumY = numY; blackSquareNum = numBlack; Layout defaultLayout = new Layout(); defaultLayout.bottom = cubeColor.getFaces()[0]; defaultLayout.left = cubeColor.getFaces()[1]; defaultLayout.right = cubeColor.getFaces()[2]; defaultLayout.front = cubeColor.getFaces()[3]; defaultLayout.back = cubeColor.getFaces()[4]; defaultLayout.top = cubeColor.getFaces()[5]; defaultLayout.positionX = 0; defaultLayout.positionY = 0; defaultLayout = moveDown(defaultLayout); defaultLayout.moveCount = -1; for (int i = 0; i < 10000; i++) { generateCheckerboard(); path = moveCube(defaultLayout, 0); if (path != null && path[0] >= minSteps) { for (int j = path.Count - 1; j > 0; j--) { switch (path[j]) { case 0: print("Gor"); break; case 1: print("Desno"); break; case 2: print("Dol"); break; case 3: print("Levo"); break; } } break; } layoutCombinations = new List <Layout>(); } return(checkerboard); }
void Start() { squareNumX = drawCheckerboard.getSquareNumX(); squareNumY = drawCheckerboard.getSquareNumY(); squareWidth = 5f / squareNumX; originX = (-1f + squareWidth) / 2f; originY = (squareWidth - 1f) / 2f; transform.Translate(originX, 0, originY); gameObject.transform.localScale = new Vector3(squareWidth, squareWidth, squareWidth); faces = new Faces(); faces.bottom = cubeColor.getFaces()[0]; faces.left = cubeColor.getFaces()[1]; faces.right = cubeColor.getFaces()[2]; faces.front = cubeColor.getFaces()[3]; faces.back = cubeColor.getFaces()[4]; faces.top = cubeColor.getFaces()[5]; }