Example #1
0
    public void RunTest()
    {
        var rubik = new RubikCube(settings);

        rubik.UseCommand(rubikMonoBehaviour.Command);
        var node = new Node(rubik, settings);

        Debug.Log("Start ida");
        var watch = System.Diagnostics.Stopwatch.StartNew();

        var task = Task.Run(() => RubikIDA.IdaStar(node));

        if (!task.Wait(TimeSpan.FromSeconds(TimeOut)))
        {
            throw new Exception("Timed out");
        }

        watch.Stop();
        var elapsedMs = watch.ElapsedMilliseconds;

        var idaResults = task.Result;

        if (idaResults == null)
        {
            return;
        }

        rubikMonoBehaviour.Decision = idaResults.Value.path.ToArray()[0].Command();

        Debug.Log("Time " + TimeSpan.FromMilliseconds(elapsedMs).TotalSeconds);
        Debug.Log(rubikMonoBehaviour.Decision);
    }
Example #2
0
    public void RunTest()
    {
        var rubik = new RubikCube(settings);

        rubik.UseCommand(rubikMonoBehaviour.Command);
        var node = new Node(rubik, settings);

        Debug.Log("Start ida");
        var watch = System.Diagnostics.Stopwatch.StartNew();

        var idaResults = IdaStar(node);

        watch.Stop();
        var elapsedMs = watch.ElapsedMilliseconds;

        if (idaResults == null)
        {
            return;
        }
        rubikMonoBehaviour.Decision = idaResults.Value.path.ToArray()[0].Command();
        Debug.Log("Time " + TimeSpan.FromMilliseconds(elapsedMs).TotalSeconds);
        Debug.Log(idaResults.Value.bound);
        Debug.Log(rubikMonoBehaviour.Decision);
    }