Beispiel #1
0
    public static void StartSearch(int numThreads, int minDelay, int maxDelay)
    {
        Console.WriteLine("Buffered=" + Buffered + ", Overflow=" + Overflow);
        List <byte[][]> stateList = new List <byte[][]>();

        MakeSave();
        Gold           gb       = new Gold(true);
        List <GscTile> endTiles = new List <GscTile>()
        {
            r29[38, 16]
        };

        gb.SetTimeSec(120);

        for (int i = 0; i <= (maxDelay - minDelay); i++)
        {
            stateList.Add(new byte[60][]);
        }

        new GscIntroSequence(GscStrat.GfSkip, GscStrat.TitleSkip, GscStrat.Continue).ExecuteUntilIGT(gb);
        gb.AdvanceFrames(minDelay, Joypad.Left);
        byte[] state = gb.SaveState();
        for (int i = 0; i < stateList.Count(); i++)
        {
            for (int igt = 0; igt < 60; igt++)
            {
                gb.LoadState(state);
                gb.CpuWrite("wGameTimeFrames", (byte)igt);
                gb.AdvanceFrames(i, Joypad.Left);
                gb.Hold(Joypad.A, "OWPlayerInput");
                stateList[i][igt] = gb.SaveState();
            }
        }

        RandomPathSearch.StartSearch <Gold, GscTile>(numThreads,
                                                     new RandomSearchParameters <GscTile>()
        {
            StateList         = stateList,
            ClusterSize       = 1,
            SS                = 60,
            NumPathsToFind    = int.MaxValue,
            StartEdgeSet      = 0,
            StartTile         = gb.Tile,
            EndTiles          = endTiles.ToArray(),
            ExecutionCallback = (gb, actions) => gb.Execute(actions) == gb.OverworldLoopAddress,
            FoundCallback     = (stateIndex, actions, successes) => {
                lock (startWriter) {
                    startWriter.WriteLine(successes + " " + stateIndex + " " + ActionFunctions.ActionsToPath(actions));
                    startWriter.Flush();
                }
            },
        });
    }
Beispiel #2
0
    public static void Test(byte x, byte y, byte hour, byte minute, byte momStep, byte audio, byte frameType, byte menuAccount, byte igt, GscIntroSequence intro, string path, string recordName = "")
    {
        MakeSave(x, y, hour, minute, momStep, audio, frameType, menuAccount, igt);
        Gold gb = new Gold();

        if (recordName != "")
        {
            gb.Record(recordName);
        }
        gb.SetTimeSec(120);
        intro.ExecuteUntilIGT(gb);
        gb.CpuWrite("wGameTimeFrames", igt);
        gb.Execute(path);
        ushort dvs = Textboxes(gb).DVs;

        Console.WriteLine("0x{0:x4}", dvs);
        gb.Dispose();
    }