private string getDirection(SolverInterface.Movement input) { if (!input.isVertical && input.amount > 0) { return("⇒"); } else if (!input.isVertical && input.amount < 0) { return("⇐"); } else if (input.isVertical && input.amount > 0) { return("⇓"); } else if (input.isVertical && input.amount < 0) { return("⇑"); } return("?"); }
public resultItem(SolverInterface.Movement input) { Position = "[" + input.yPos + "," + input.xPos + "]"; Amount = input.amount; Direction = getDirection(input); sHeart = input.score.Heart; sStam = input.score.Stamina; sSent = input.score.Sentiment; sBlue = input.score.Blue; sRed = input.score.Red; sGreen = input.score.Green; sGold = input.score.Gold; sBell = input.score.Bell; sBHeart = input.score.BrokenHeart; isVertical = input.isVertical; xPos = input.xPos; yPos = input.yPos; StaminaCost = input.score.staminaCost; Chain = input.score.chains; Total = input.score.getTotal(); TotalWBroken = input.score.getTotalNoBroken() - (2 * input.score.BrokenHeart); }
public Capture.Hook.Common.Overlay parseMovementAndDraw(SolverInterface.Movement command, int cellColor, int height, int width) { System.Drawing.Color tint = new System.Drawing.Color(); switch (cellColor) { case 0: tint = System.Drawing.Color.DarkMagenta; break; case 1: tint = System.Drawing.Color.Magenta; break; case 2: tint = System.Drawing.Color.Black; break; case 3: tint = System.Drawing.Color.Cyan; break; case 4: tint = System.Drawing.Color.MediumBlue; break; case 5: tint = System.Drawing.Color.Firebrick; break; case 6: tint = System.Drawing.Color.LimeGreen; break; case 7: tint = System.Drawing.Color.DarkOrange; break; case 8: tint = System.Drawing.Color.Yellow; break; } // CENTER = 1200X35 ON 3840X2160 // PIXEL TO CHECK 1227X364 ON 3840X2160 int startX = (int)(width * 0.2961); int startY = (int)(height * 0.12686); int offset = (int)(0.04688 * width); // 180 FOR 4K // -30, 0, 60 FOR 4K int directionOffsetX = command.isVertical ? (int)(-1 * (width * 0.0078125)) : (int)(width * 0.015625); // 50, 60, -20 FOR 4K int directionOffsetY = command.isVertical ? ((command.amount > 0) ? (int)(width * 0.01302083) : (int)(width * 0.015625)) : (int)(-1 * (width * 0.0052083)); List <Capture.Hook.Common.IOverlayElement> elem = new List <Capture.Hook.Common.IOverlayElement>(); // TAILS int i = command.amount > 0 ? command.amount - 1 : command.amount + 1; while (i != 0) //!= 0 { int xOffset = command.isVertical ? 0 : (command.amount > 0) ? i - 1 : i; int yOffset = command.isVertical ? (command.amount > 0) ? i - 1 : i : 0; elem.Add(new Capture.Hook.Common.ImageElement() { Location = new System.Drawing.Point((startX + (offset * command.xPos)) + (offset * xOffset) + directionOffsetX, (startY + (offset * command.yPos)) + (offset * yOffset) + directionOffsetY), Image = command.isVertical ? arrowTailV[0] : arrowTailH[0], Scale = (float)((float)width / 3840), Tint = tint }); if (i >= 0) { i--; } else { i++; } } int finalX = command.isVertical ? command.xPos : command.xPos + command.amount; int finalY = command.isVertical ? command.yPos + command.amount : command.yPos; // -190, 7 FOR 4K int headOffsetX = command.isVertical ? 0 : ((command.amount > 0) ? (int)(-1 * (width * 0.049479167)) : (int)(width * 0.0018229167)); // -188, 10, 3 FOR 4K int headOffsetY = command.isVertical ? ((command.amount > 0) ? (int)(-1 * (width * 0.0489584)) : (int)(width * 0.002604167)) : ((command.amount > 0) ? (int)(width * 0.00078125) : 1); // HEAD elem.Add(new Capture.Hook.Common.ImageElement() { Location = new System.Drawing.Point(startX + (offset * finalX) + directionOffsetX + headOffsetX, startY + (offset * finalY) + directionOffsetY + headOffsetY), Image = command.isVertical ? arrowHeadV[0] : arrowHeadH[0], Angle = (command.amount > 0) ? 3.14159f : 0.0f, Scale = (float)((float)width / 3840), Tint = tint }); return(new Capture.Hook.Common.Overlay { Elements = elem, Hidden = false }); }
public List <SolverInterface.Movement> loopBoard(int[][] board2Test) { List <SolverInterface.Movement> returnThis = new List <SolverInterface.Movement>(); int y = 0; int x = 0; while (y < length) { x = 0; while (x < width) { ///////////////////// // HORIZONTAL ///////////////////// /// // MOVE LEFT int offset = 1; while (x - offset > -1) { // DEEP COPY int[][] board2TestCopy = Array.ConvertAll(board2Test, a => (int[])a.Clone()); // MOVE board2TestCopy = moveHorizontal(y, x, -1 * offset, board2TestCopy); int boardHash = getBoardHash(board2TestCopy); // ONLY SAVE IF THERE WAS A MATCH/SCORE SolverInterface.Score result = evalBoard(new SolverInterface.Score(0), board2TestCopy, true); if (result.hasScore()) { // CHECK IF BOARD PATTERN ALREADY EXIST. REDUCE DUPLICATE SolverInterface.Movement testExist = returnThis.SingleOrDefault(s => s.boardHash == boardHash); if (!testExist.score.hasScore()) { returnThis.Add(new SolverInterface.Movement(x, y, false, -1 * offset, result, boardHash)); } } offset++; } // MOVE RIGHT offset = 1; while (x + offset < width) { // DEEP COPY int[][] board2TestCopy = Array.ConvertAll(board2Test, a => (int[])a.Clone()); // MOVE board2TestCopy = moveHorizontal(y, x, offset, board2TestCopy); int boardHash = getBoardHash(board2TestCopy); // ONLY SAVE IF THERE WAS A MATCH/SCORE SolverInterface.Score result = evalBoard(new SolverInterface.Score(0), board2TestCopy, true); if (result.hasScore()) { // CHECK IF BOARD PATTERN ALREADY EXIST. REDUCE DUPLICATE SolverInterface.Movement testExist = returnThis.SingleOrDefault(s => s.boardHash == boardHash); if (!testExist.score.hasScore()) { returnThis.Add(new SolverInterface.Movement(x, y, false, offset, result, boardHash)); } } offset++; } ///////////////////// // VERTICAL ///////////////////// // MOVE UP offset = 1; while (y - offset > -1) { // DEEP COPY int[][] board2TestCopy = Array.ConvertAll(board2Test, a => (int[])a.Clone()); // MOVE board2TestCopy = moveVertical(y, x, -1 * offset, board2TestCopy); int boardHash = getBoardHash(board2TestCopy); // ONLY SAVE IF THERE WAS A MATCH/SCORE SolverInterface.Score result = evalBoard(new SolverInterface.Score(0), board2TestCopy, true); if (result.hasScore()) { // CHECK IF BOARD PATTERN ALREADY EXIST. REDUCE DUPLICATE SolverInterface.Movement testExist = returnThis.SingleOrDefault(s => s.boardHash == boardHash); if (!testExist.score.hasScore()) { returnThis.Add(new SolverInterface.Movement(x, y, true, -1 * offset, result, boardHash)); } } offset++; } // MOVE DOWN offset = 1; while (y + offset < length) { // DEEP COPY int[][] board2TestCopy = Array.ConvertAll(board2Test, a => (int[])a.Clone()); // MOVE board2TestCopy = moveVertical(y, x, offset, board2TestCopy); int boardHash = getBoardHash(board2TestCopy); // ONLY SAVE IF THERE WAS A MATCH/SCORE SolverInterface.Score result = evalBoard(new SolverInterface.Score(0), board2TestCopy, true); if (result.hasScore()) { // CHECK IF BOARD PATTERN ALREADY EXIST. REDUCE DUPLICATE SolverInterface.Movement testExist = returnThis.SingleOrDefault(s => s.boardHash == boardHash); if (!testExist.score.hasScore()) { returnThis.Add(new SolverInterface.Movement(x, y, true, offset, result, boardHash)); } } offset++; } x++; } y++; } return(returnThis); }