Ejemplo n.º 1
0
    private void GenerateMatrix()
    {
        // gonna be long
        // initial matrix will have Red in front, White down
        var matrixPositions = GetMatrixPositions();

        foreach (CubeEntry entry in cubes)
        {
            CubeName name = entry.name;
            // find the position
            PositionTriplet position = matrixPositions[name];
            // add to matrix;
            cubeMatrix[position.x][position.y][position.z] = new CubeEntry(entry);
            //Debug.Log(name + ": " + position.ToString());
        }
    }
Ejemplo n.º 2
0
    public bool IsSolved()
    {
        Dictionary <CubeName, PositionTriplet> solverMatrix = GetMatrixPositions();

        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                for (int k = 0; k < 3; k++)
                {
                    if (i != 1 || j != 1 || k != 1)
                    {
                        CubeName        name    = cubeMatrix[i][j][k].name;
                        PositionTriplet triplet = solverMatrix[name];
                        if (!(triplet.x == i && triplet.y == j && triplet.z == k))
                        {
                            return(false);
                        }
                    }
                }
            }
        }
        return(true);
    }