private void Oll() { OllPattern p = new OllPattern(); Algorithm oll = p.FindBestMatch(PatternHelpers.FromRubik(this.Rubik), CubeFlag.TopLayer, CommonPatternFilters.SameFlipCount); if (oll != null) { SolverAlgorithm(oll); // else no oll algorithm required } }
private void Pll() { var p = new PllPattern(); for (int i = 0; i < 4; i++) { Algorithm pll = p.FindBestMatch(PatternHelpers.FromRubik(Rubik), CubeFlag.TopLayer, CommonPatternFilters.SameInversionCount); if (pll != null) { SolverAlgorithm(pll); break; } SolverMove(CubeFlag.TopLayer, true); } }
private void CreateSkinSignatures() { Signatures[(int)SignatureNames.CurrentSkinData] = new SigEx { Name = "currentSkinData", Pattern = PatternHelpers.UnpackStr("75218b1d"), UseMask = false, Offset = 4, PointerOffsets = { 0, 0 } }; Signatures[(int)SignatureNames.CurrentSkinFolder] = new SigEx { Name = "currentSkinFolder", ParentSig = Signatures[(int)SignatureNames.CurrentSkinData], Offset = 68 }; }
private void CreateTourneySignatures() { Signatures.Add((int)SignatureNames.TourneyBase, new SigEx { Name = "TourneyBase", Pattern = PatternHelpers.UnpackStr("7D15A10000000085C0"), Mask = "xxx????xx", Offset = -0xB }); Signatures.Add((int)SignatureNames.TourneyIpcState, new SigEx { ParentSig = Signatures[(int)SignatureNames.TourneyBase], PointerOffsets = { 4, 0x54 } }); Signatures.Add((int)SignatureNames.TourneyLeftStars, new SigEx { ParentSig = Signatures[(int)SignatureNames.TourneyBase], PointerOffsets = { 4, 0x1C, 0x2C } }); Signatures.Add((int)SignatureNames.TourneyRightStars, new SigEx { ParentSig = Signatures[(int)SignatureNames.TourneyBase], PointerOffsets = { 4, 0x20, 0x2C } }); Signatures.Add((int)SignatureNames.TourneyBO, new SigEx { ParentSig = Signatures[(int)SignatureNames.TourneyBase], PointerOffsets = { 4, 0x20, 0x30 } }); Signatures.Add((int)SignatureNames.TourneyStarsVisible, new SigEx { ParentSig = Signatures[(int)SignatureNames.TourneyBase], PointerOffsets = { 4, 0x20, 0x38 } }); Signatures.Add((int)SignatureNames.TourneyScoreVisible, new SigEx { ParentSig = Signatures[(int)SignatureNames.TourneyBase], PointerOffsets = { 4, 0x20, 0x39 } }); }
private void CompleteF2L() { List <Tuple <Cube, Cube> > unsolvedPairs = GetPairs(this.Rubik).ToList(); while (unsolvedPairs.Count > 0) // 4 pairs { Tuple <Cube, Cube> currentPair = unsolvedPairs.First(); Cube edge = currentPair.Item1; Cube corner = currentPair.Item2; CubePosition target = new CubePosition(Rubik.GetTargetFlags(corner)); if (!corner.Position.HasFlag(CubeFlag.TopLayer) && Rubik.GetTargetFlags(corner) != corner.Position.Flags) { CubeFlag rotationLayer = CubeFlagService.FirstNotInvalidFlag(corner.Position.Flags, CubeFlag.BottomLayer); bool direction = new TestScenario(Rubik, new LayerMove(rotationLayer, true, false)).TestCubePosition(corner, CubeFlag.TopLayer); SolverMove(rotationLayer, direction); SolverMove(CubeFlag.TopLayer, true); SolverMove(rotationLayer, !direction); } // move edge to top position if necessary if (!edge.Position.HasFlag(CubeFlag.TopLayer) && Rubik.GetTargetFlags(edge) != edge.Position.Flags) { CubeFlag rotationLayer = CubeFlagService.FirstNotInvalidFlag(edge.Position.Flags, CubeFlag.MiddleLayer); bool direction = new TestScenario(Rubik, new LayerMove(rotationLayer, true, false)).TestCubePosition(edge, CubeFlag.TopLayer); SolverMove(rotationLayer, direction); while ((corner.Position.HasFlag(rotationLayer) && !corner.Position.HasFlag(CubeFlag.BottomLayer)) || edge.Position.HasFlag(rotationLayer)) { SolverMove(CubeFlag.TopLayer, true); } SolverMove(rotationLayer, !direction); } // detect right and front slice CubeFlag rightSlice = CubeFlagService.ToInt(target.X) == CubeFlagService.ToInt(target.Z) ? target.Z : target.X; CubeFlag frontSlice = CubeFlagService.FirstNotInvalidFlag(target.Flags, CubeFlagModule.YFlags | rightSlice); while (!corner.Position.HasFlag(target.Flags & ~CubeFlag.BottomLayer)) { SolverMove(CubeFlag.TopLayer, true); } PatternFilter filter = new PatternFilter(delegate(Pattern p1, Pattern p2) { PatternItem item = new PatternItem(corner.Position, Solvability.GetOrientation(this.Rubik, corner), target.Flags); return(p2.Items.Any(i => i.Equals(item))); }, true); for (int i = 0; i < 4; i++) { F2LPattern pattern = new F2LPattern(Rubik.GetTargetFlags(edge), Rubik.GetTargetFlags(corner), rightSlice, frontSlice); var algo = pattern.FindBestMatch(PatternHelpers.FromRubik(Rubik), CubeFlag.None, filter); if (algo != null) { SolverAlgorithm(algo); break; } SolverMove(CubeFlag.TopLayer, true); } int count = unsolvedPairs.Count; unsolvedPairs = GetPairs(this.Rubik).ToList(); if (unsolvedPairs.Count == count) { this.BroadcastOnSolutionError("Complete first two layers", "Wrong algorithm"); return; } } }
internal void CreateSignatures() { Signatures.Add((int)SignatureNames.OsuBase, new SigEx { Name = "OsuBase", Pattern = PatternHelpers.UnpackStr("F80174048365"), UseMask = false }); Signatures.Add((int)SignatureNames.GameMode, new SigEx { ParentSig = Signatures[(int)SignatureNames.OsuBase], Offset = -51, PointerOffsets = { 0 } }); Signatures.Add((int)SignatureNames.Retrys, new SigEx { ParentSig = Signatures[(int)SignatureNames.OsuBase], Offset = -51, PointerOffsets = { 8 } }); CreateBeatmapDataSignatures(); Signatures.Add((int)SignatureNames.OsuStatus, new SigEx { Name = "OsuStatus", ParentSig = Signatures[(int)SignatureNames.OsuBase], Offset = -60, PointerOffsets = { 0 } }); Signatures.Add((int)SignatureNames.PlayTime, new SigEx { Name = "PlayTime", ParentSig = Signatures[(int)SignatureNames.OsuBase], Offset = 100, PointerOffsets = { -16 } }); Signatures[(int)SignatureNames.Mods] = new SigEx { Name = "mods", Pattern = PatternHelpers.UnpackStr("C8FF0000000000810D0000000000080000"), Mask = "xx?????xx????xxxx", Offset = 9, PointerOffsets = { 0 }, UseMask = true, }; Signatures[(int)SignatureNames.IsReplay] = new SigEx { Name = "IsReplay", Pattern = PatternHelpers.UnpackStr("741A80000000000000741180"), Mask = "xxx??????xxx", Offset = 13, PointerOffsets = { 0 }, UseMask = true, }; CreateSkinSignatures(); CreatePlaySignatures(); CreateTourneySignatures(); }
private void CreatePlaySignatures() { Signatures.Add((int)SignatureNames.PlayContainer, new SigEx { //avaliable only when playing; //need to reset on each play Name = "PlayContainer", Pattern = PatternHelpers.UnpackStr("C7864801000001000000A1"), Offset = 0xB, PointerOffsets = { 0x4, 0x60 }, UseMask = false }); Signatures.Add((int)SignatureNames.PlayingMods, new SigEx { //Complex - 2 xored ints ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 56, 28 } }); Signatures.Add((int)SignatureNames.PlayerName, new SigEx { //char[] ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 56, 40 } }); Signatures.Add((int)SignatureNames.HitErrors, new SigEx { //int[] ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 56, 56 } }); Signatures.Add((int)SignatureNames.Combo, new SigEx { //ushort ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 56, 148 } }); Signatures.Add((int)SignatureNames.ComboMax, new SigEx { //ushort ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 56, 104 } }); Signatures.Add((int)SignatureNames.Hit100c, new SigEx { //ushort ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 56, 136 } }); Signatures.Add((int)SignatureNames.Hit300c, new SigEx { //ushort ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 56, 138 } }); Signatures.Add((int)SignatureNames.Hit50c, new SigEx { //ushort ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 56, 140 } }); Signatures.Add((int)SignatureNames.HitGeki, new SigEx { //ushort ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 56, 142 } }); Signatures.Add((int)SignatureNames.HitKatsu, new SigEx { //ushort ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 56, 144 } }); Signatures.Add((int)SignatureNames.HitMissc, new SigEx { //ushort ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 56, 146 } }); Signatures.Add((int)SignatureNames.Score, new SigEx { //int ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 56, 120 } }); Signatures.Add((int)SignatureNames.PlayingGameMode, new SigEx { //int ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 56, 104 } }); Signatures.Add((int)SignatureNames.Acc, new SigEx { //double ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 72, 20 } }); Signatures.Add((int)SignatureNames.PlayerHp, new SigEx { //ushort ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 64, 28 } }); Signatures.Add((int)SignatureNames.PlayerHpSmoothed, new SigEx { //ushort ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 64, 20 } }); Signatures.Add((int)SignatureNames.ScoreV2, new SigEx { //int ParentSig = Signatures[(int)SignatureNames.PlayContainer], PointerOffsets = { 0x4C, 0xC, 0x68, 0x4, 0xF8 } }); }