public override void Tick(MegajewelForm form) { if (form.Processing.DiamondMineCleared) return; var grid = form.Processing.Grid; List<Gem> bestGems = new List<Gem>(); for (int x = 0; x < 8; x++) for (int y = 0; y < 8; y++) { Gem gem = grid[x, y]; if (gem.SuggestedPower >= 3) { bestGems.Add(gem); } } if (bestGems.Count > 0) { foreach (Gem randomBestGem in bestGems) { Point from = new Point(randomBestGem.X, randomBestGem.Y); Point to = Predictor.MoveInDirection(from, randomBestGem.SuggestedDirection); Point fromReal = form.CurrentMode.GetGemCenter(from.X, from.Y); Point toReal = form.CurrentMode.GetGemCenter(to.X, to.Y); Controller.MoveTo(fromReal.X, fromReal.Y); Controller.HoldLeft(); Controller.MoveTo(toReal.X, toReal.Y); Controller.ReleaseLeft(); } } }
public override void Tick(MegajewelForm form) { int x = rgen.Next(7); int y = rgen.Next(7); Point p = form.CurrentMode.GetGemCenter(x, y); Point p2 = form.CurrentMode.GetGemCenter(x + 1, y); Controller.MoveTo(p.X, p.Y); Controller.HoldLeft(); Controller.MoveTo(p2.X, p2.Y); Controller.ReleaseLeft(); }
public HotkeyManager(MegajewelForm form) { Form = form; AddHotkey(Keys.H, () => { form.txtDebugLog.Text = "Hello, hotkeys!" + Environment.NewLine + form.txtDebugLog.Text; }); AddHotkey(Keys.Tab, () => { Form.IsAutonomous = !Form.IsAutonomous; }); }
public override void Tick(MegajewelForm form) { ticksMissed++; if (ticksMissed < 5) { return; } ticksMissed = 0; var grid = form.Processing.Grid; List <Gem> bestGems = new List <Gem>(); int bestPower = 1; for (int x = 0; x < 8; x++) { for (int y = 0; y < 8; y++) { Gem gem = grid[x, y]; if (gem.SuggestedPower == bestPower) { bestGems.Add(gem); } else if (gem.SuggestedPower > bestPower) { bestPower = gem.SuggestedPower; bestGems.Clear(); bestGems.Add(gem); } } } if (bestGems.Count > 0) { Gem randomBestGem = bestGems[rgen.Next(bestGems.Count)]; Point from = new Point(randomBestGem.X, randomBestGem.Y); Point to = Predictor.MoveInDirection(from, randomBestGem.SuggestedDirection); Point fromReal = form.CurrentMode.GetGemCenter(from.X, from.Y); Point toReal = form.CurrentMode.GetGemCenter(to.X, to.Y); Controller.MoveTo(fromReal.X, fromReal.Y); Controller.HoldLeft(); Controller.MoveTo(toReal.X, toReal.Y); Controller.ReleaseLeft(); } }
public override void Tick(MegajewelForm form) { tick++; if (tick % 2 == 0) { // Down for (int x = 0; x < 8; x++) { for (int y = 0; y < 8; y += 2) { Point p = form.CurrentMode.GetGemCenter(x, y); Point p2 = form.CurrentMode.GetGemCenter(x, y + 1); Controller.MoveTo(p.X, p.Y); Controller.HoldLeft(); Controller.MoveTo(p2.X, p2.Y); Controller.ReleaseLeft(); } } } else { // Right for (int y = 0; y < 8; y++) { for (int x = 0; x < 8; x += 2) { Point p = form.CurrentMode.GetGemCenter(x, y); Point p2 = form.CurrentMode.GetGemCenter(x + 1, y); Controller.MoveTo(p.X, p.Y); Controller.HoldLeft(); Controller.MoveTo(p2.X, p2.Y); Controller.ReleaseLeft(); } } } }
public override void Tick(MegajewelForm form) { if (form.Processing.DiamondMineCleared) { return; } var grid = form.Processing.Grid; List <Gem> bestGems = new List <Gem>(); for (int x = 0; x < 8; x++) { for (int y = 0; y < 8; y++) { Gem gem = grid[x, y]; if (gem.SuggestedPower >= 3) { bestGems.Add(gem); } } } if (bestGems.Count > 0) { foreach (Gem randomBestGem in bestGems) { Point from = new Point(randomBestGem.X, randomBestGem.Y); Point to = Predictor.MoveInDirection(from, randomBestGem.SuggestedDirection); Point fromReal = form.CurrentMode.GetGemCenter(from.X, from.Y); Point toReal = form.CurrentMode.GetGemCenter(to.X, to.Y); Controller.MoveTo(fromReal.X, fromReal.Y); Controller.HoldLeft(); Controller.MoveTo(toReal.X, toReal.Y); Controller.ReleaseLeft(); } } }
public abstract void Tick(MegajewelForm form);
public Processing(MegajewelForm form) { Form = form; }
public Overlaying(MegajewelForm form) { Form = form; }
public KnowledgeBase(MegajewelForm form) { Form = form; }
public Capturing(MegajewelForm form) { Form = form; }
public override void Tick(MegajewelForm form) { ticksMissed++; if (ticksMissed < 5) return; ticksMissed = 0; var grid = form.Processing.Grid; List<Gem> bestGems = new List<Gem>(); int bestPower = 1; for (int x= 0;x<8;x++) for (int y = 0; y< 8;y++) { Gem gem = grid[x, y]; if (gem.SuggestedPower == bestPower) { bestGems.Add(gem); } else if (gem.SuggestedPower > bestPower) { bestPower = gem.SuggestedPower; bestGems.Clear(); bestGems.Add(gem); } } if (bestGems.Count > 0) { Gem randomBestGem = bestGems[rgen.Next(bestGems.Count)]; Point from = new Point(randomBestGem.X, randomBestGem.Y); Point to = Predictor.MoveInDirection(from, randomBestGem.SuggestedDirection); Point fromReal = form.CurrentMode.GetGemCenter(from.X, from.Y); Point toReal = form.CurrentMode.GetGemCenter(to.X, to.Y); Controller.MoveTo(fromReal.X, fromReal.Y); Controller.HoldLeft(); Controller.MoveTo(toReal.X, toReal.Y); Controller.ReleaseLeft(); } }
public override void Tick(MegajewelForm form) { // Do nothing. }
public override void Tick(MegajewelForm form) { for (int i = 0; i < 10; i++) { int x = rgen.Next(8); int y = rgen.Next(7); Point p = form.CurrentMode.GetGemCenter(x, y); Point p2 = form.CurrentMode.GetGemCenter(x, y + 1); Controller.MoveTo(p.X, p.Y); Controller.HoldLeft(); Controller.MoveTo(p2.X, p2.Y); Controller.ReleaseLeft(); } }
public override void Tick(MegajewelForm form) { Controller.MoveTo(rgen.Next(0, 1680), rgen.Next(0, 1050)); }