public void UpdateMatrix(Fild fild1, int x, int y) { int whichRow = fild1.WhichRow(y); int whichColomn = fild1.WhichColomn(x, y); for (int t = 0; t < 122; t++) { matrix[(whichRow - 1) * 10 + whichRow + whichColomn - 1, t] = false; matrix[t, (whichRow - 1) * 10 + whichRow + whichColomn - 1] = false; } }
// + -- // + ++ public void RotatePosition(int rc, Fild fg) { switch (rc) { case (0): if (SupportMethods.Intersection(Form_0, fg)) { Form = Form_0; rollCount = NextPosition(); } break; case (1): Move.TakeOutFigForm(fg); bool flag2 = true, strf = false; strf = Move.dotMove[1] == fg.FildGame.GetLength(1) - 1 || (fg.FildGame[Move.dotMove[0] + 1, Move.dotMove[1] + 1] == true && Move.dotMove[1] != 0); if (strf) { Move.dotMove[1]--; } for (int i = 0; i < Form_2.GetLength(0); i++) { for (int j = 0; j < Form_2.GetLength(1); j++) { if (Form_2[i, j] == true) { if (Form_2[i, j] == fg.FildGame[i + Move.dotMove[0], j + Move.dotMove[1]]) { flag2 = false; break; } } if (!flag2) { break; } } } if (!flag2) { if (strf) { Move.dotMove[1]++; } Move.SetFigForm(fg); } else { Form = Form_2; rollCount = NextPosition(); Move.SetFigForm(fg); } break; } }
public void RotatePosition(int rc, Fild fg) { switch (rc) { case (0): Move.dotMove[0]--; Move.dotMove[1]++; if (SupportMethods.Intersection(Form_0, fg)) { Form = Form_0; rollCount = NextPosition(); } else { Move.dotMove[0]++; Move.dotMove[1]--; } break; case (1): bool flagOut1 = false; if (Move.dotMove[1] == 0 || (fg.FildGame[Move.dotMove[0] + 1, Move.dotMove[1] - 1] == true && Move.dotMove[1] + 2 < fg.FildGame.GetLength(1))) { Move.dotMove[0]++; flagOut1 = true; } else { Move.dotMove[0]++; Move.dotMove[1]--; } if (SupportMethods.Intersection(Form_1, fg)) { Form = Form_1; rollCount = NextPosition(); } else if (flagOut1) { Move.dotMove[0]--; } else { Move.dotMove[0]--; Move.dotMove[1]++; } break; } }
public static bool Intersection(bool[,] form_x, Fild fg) { bool flag = true; for (int i = 0; i < form_x.GetLength(0); i++) { for (int j = 0; j < form_x.GetLength(1); j++) { if ((form_x[i, j] == true) && true == fg.FildGame[i + Move.dotMove[0], j + Move.dotMove[1]]) { flag = false; break; } } if (!flag) { break; } } return(flag); }
private void xxx_MouseDown(object sender, MouseButtonEventArgs e) { Fild.Close(); }
private void exit_Click(object sender, RoutedEventArgs e) { Fild.Close(); }
public void RotatePosition(int rc, Fild fg) { switch (rc) { case (0): if (Move.dotMove[0] < fg.FildGame.GetLength(0) - 2 && (fg.FildGame[Move.dotMove[0] + 2, Move.dotMove[1] + 1] == true || fg.FildGame[Move.dotMove[0] + 2, Move.dotMove[1] + 2] == true)) { Move.dotMove[0]--; Move.dotMove[1]++; if (SupportMethods.Intersection(Form_0, fg)) { Form = Form_0; rollCount = NextPosition(); } else { Move.dotMove[0]++; Move.dotMove[1]--; } } else if (Move.dotMove[0] > fg.FildGame.GetLength(0) - 3) { Move.dotMove[0]--; Move.dotMove[1]++; if (SupportMethods.Intersection(Form_0, fg)) { Form = Form_0; rollCount = NextPosition(); } else { Move.dotMove[0]++; Move.dotMove[1]--; } } else { Move.dotMove[1]++; if (SupportMethods.Intersection(Form_0, fg)) { Form = Form_0; rollCount = NextPosition(); } else { Move.dotMove[1]--; } } break; case (1): if (Move.dotMove[1] == 0) { Move.dotMove[0]++; if (SupportMethods.Intersection(Form_1, fg)) { Form = Form_1; rollCount = NextPosition(); } else { Move.dotMove[0]--; } } else if (Move.dotMove[1] < fg.FildGame.GetLength(1) - 2 && // offset right (fg.FildGame[Move.dotMove[0] + 1, Move.dotMove[1] - 1] == true || fg.FildGame[Move.dotMove[0] + 2, Move.dotMove[1] - 1] == true)) { Move.dotMove[0]++; if (SupportMethods.Intersection(Form_1, fg)) { Form = Form_1; rollCount = NextPosition(); } else { Move.dotMove[0]--; } } else { Move.dotMove[0]++; Move.dotMove[1]--; if (SupportMethods.Intersection(Form_1, fg)) { Form = Form_1; rollCount = NextPosition(); } else { Move.dotMove[0]--; Move.dotMove[1]++; } } break; case (2): Move.dotMove[0]--; if (SupportMethods.Intersection(Form_2, fg)) { Form = Form_2; rollCount = NextPosition(); } else { Move.dotMove[0]++; } break; case (3): if (Move.dotMove[1] == fg.FildGame.GetLength(1) - 2 && fg.FildGame[Move.dotMove[0] + 1, Move.dotMove[1] + 1] == true) { Move.dotMove[0] -= 2; if (SupportMethods.Intersection(Form_3, fg)) { Form = Form_3; rollCount = NextPosition(); } else { Move.dotMove[1] += 2; } } else if (Move.dotMove[1] == fg.FildGame.GetLength(1) - 2) { Move.dotMove[1]--; if (SupportMethods.Intersection(Form_3, fg)) { Form = Form_3; rollCount = NextPosition(); } else { Move.dotMove[1]++; } } else if (Move.dotMove[1] > 0 && Move.dotMove[1] < fg.FildGame.GetLength(1) - 2 && (fg.FildGame[Move.dotMove[0], Move.dotMove[1] + 2] == true || fg.FildGame[Move.dotMove[0] + 1, Move.dotMove[1] + 2] == true)) { Move.dotMove[1]--; if (SupportMethods.Intersection(Form_3, fg)) { Form = Form_3; rollCount = NextPosition(); } else { Move.dotMove[1]++; } } else if (SupportMethods.Intersection(Form_3, fg)) { Form = Form_3; rollCount = NextPosition(); } break; } }
public void Rotate(Fild fg) => fg.FigNow.RotatePosition(fg.FigNow.NextPosition(), fg);
public void RotatePosition(int rc, Fild fg) { switch (rc) { case (0): Move.dotMove[0]--; Move.dotMove[1]++; if (SupportMethods.Intersection(Form_0, fg)) { Form = Form_0; rollCount = NextPosition(); } else { Move.dotMove[0]++; Move.dotMove[1]--; } break; case (1): bool flagOut1 = false; if ((Move.dotMove[1] > fg.FildGame.GetLength(1) - 3) || fg.FildGame[Move.dotMove[0] + 1, Move.dotMove[1] + 2] == true) { Move.dotMove[0]++; Move.dotMove[1]--; flagOut1 = true; } else { Move.dotMove[0]++; } if (SupportMethods.Intersection(Form_1, fg)) { Form = Form_1; rollCount = NextPosition(); } else { if (flagOut1) { Move.dotMove[0]--; Move.dotMove[1]++; } else { Move.dotMove[0]--; } } break; case (2): bool flagOut2 = false; if (Move.dotMove[0] + fg.FigNow.Form.GetLength(0) == fg.FildGame.GetLength(0) || fg.FildGame[Move.dotMove[0] + 2, Move.dotMove[1] + 1] == true) { Move.dotMove[0]--; flagOut2 = true; } if (SupportMethods.Intersection(Form_2, fg)) { Form = Form_2; rollCount = NextPosition(); } else if (flagOut2) { Move.dotMove[0]++; } break; case (3): bool flagOut3 = false; if (Move.dotMove[1] == 0 || fg.FildGame[Move.dotMove[0] + 1, Move.dotMove[1] - 1] == true) { flagOut3 = true; } else { Move.dotMove[1]--; } if (SupportMethods.Intersection(Form_3, fg)) { Form = Form_3; rollCount = NextPosition(); } else if (!flagOut3) { Move.dotMove[1]++; } break; } }
public void Rotate(Fild fg) { int cc = fg.FigNow.NextPosition(); fg.FigNow.RotatePosition(cc, fg); }
public void RotatePosition(int rc, Fild fg) { switch (rc) { case (0): if (fg.FildGame[Move.dotMove[0], Move.dotMove[1]] == true && fg.FildGame[Move.dotMove[0] - 1, Move.dotMove[1]] == true) { Move.dotMove[0]--; Move.dotMove[1]++; if (SupportMethods.Intersection(Form_0, fg)) { Form = Form_0; rollCount = NextPosition(); } else { Move.dotMove[0]++; Move.dotMove[1]--; } } else { Move.dotMove[0]--; if (SupportMethods.Intersection(Form_0, fg)) { Form = Form_0; rollCount = NextPosition(); } else { Move.dotMove[0]++; } } break; case (1): if (fg.FildGame[Move.dotMove[0], Move.dotMove[1] + 1] == true && Move.dotMove[1] > 1) { Move.dotMove[1] -= 2; if (SupportMethods.Intersection(Form_1, fg)) { Form = Form_1; rollCount = NextPosition(); } else { Move.dotMove[1] += 2; } } else if (((Move.dotMove[1] < fg.FildGame.GetLength(1) - 2) && fg.FildGame[Move.dotMove[0], Move.dotMove[1] + 2] == true && Move.dotMove[1] > 0) || Move.dotMove[1] > fg.FildGame.GetLength(1) - 3) { Move.dotMove[1] -= 1; if (SupportMethods.Intersection(Form_1, fg)) { Form = Form_1; rollCount = NextPosition(); } else { Move.dotMove[1] += 1; } } else { if (SupportMethods.Intersection(Form_1, fg)) { Form = Form_1; rollCount = NextPosition(); } } break; case (2): if (Move.dotMove[1] > 0 && Move.dotMove[0] < fg.FildGame.GetLength(0) - 2 && // +++ (fg.FildGame[Move.dotMove[0] + 1, Move.dotMove[1] + 1] == true || // +*. fg.FildGame[Move.dotMove[0] + 2, Move.dotMove[1] + 1] == true)) // .*. { Move.dotMove[1]--; if (SupportMethods.Intersection(Form_2, fg)) { Form = Form_2; rollCount = NextPosition(); } else { Move.dotMove[1]++; } } else if (Move.dotMove[0] < fg.FildGame.GetLength(0) - 2 && // +++ (fg.FildGame[Move.dotMove[0] + 1, Move.dotMove[1] + 2] == true || // +.* fg.FildGame[Move.dotMove[0] + 2, Move.dotMove[1] + 2] == true)) // ..* { if (SupportMethods.Intersection(Form_2, fg)) { Form = Form_2; rollCount = NextPosition(); } } else { bool flagOut2 = false; if (Move.dotMove[0] == fg.FildGame.GetLength(0) - 2) { flagOut2 = true; } if (flagOut2) { Move.dotMove[0]--; } Move.dotMove[1]++; if (SupportMethods.Intersection(Form_2, fg)) { Form = Form_2; rollCount = NextPosition(); } else { if (flagOut2) { Move.dotMove[0]++; } else { Move.dotMove[1]--; } } } break; case (3): if (Move.dotMove[1] < fg.FildGame.GetLength(1) - 3 && fg.FildGame[Move.dotMove[0] + 2, Move.dotMove[1]] == true) { Move.dotMove[0]++; Move.dotMove[1]++; if (SupportMethods.Intersection(Form_3, fg)) { Form = Form_3; rollCount = NextPosition(); } else { Move.dotMove[0]--; Move.dotMove[1]--; } } else if ((Move.dotMove[1] < fg.FildGame.GetLength(1) - 2 && Move.dotMove[1] > 0 && fg.FildGame[Move.dotMove[0] + 2, Move.dotMove[1] - 1] == true) || Move.dotMove[1] == 0) { Move.dotMove[0]++; if (SupportMethods.Intersection(Form_3, fg)) { Form = Form_3; rollCount = NextPosition(); } else { Move.dotMove[0]--; } } else { Move.dotMove[0]++; Move.dotMove[1]--; if (SupportMethods.Intersection(Form_3, fg)) { Form = Form_3; rollCount = NextPosition(); } else { Move.dotMove[0]--; Move.dotMove[1]++; } } break; } }
public void RotatePosition(int rc, Fild fg) { }
public void Rotate(Fild fg) { }
public void RotatePosition(int rc, Fild fg) { switch (rc) { // 0123456789 // -+----+-- // 10b4-01b9 case (0): int flagOut0 = 0; if (0 < Move.dotMove[1]) { flagOut0 = 0b10000; } if (fg.FildGame.GetLength(1) - 2 > Move.dotMove[1]) { flagOut0 |= 0b01000; // 9 - 2 (7) > 6 } if (Move.dotMove[1] > 0 && fg.FildGame[Move.dotMove[0] + 2, Move.dotMove[1] - 1] == true) { flagOut0 |= 0b00100; // left block } if (Move.dotMove[1] < fg.FildGame.GetLength(1) - 1 && fg.FildGame[Move.dotMove[0] + 2, Move.dotMove[1] + 1] == true) { flagOut0 |= 0b00010; // right block +1 } if (Move.dotMove[1] < fg.FildGame.GetLength(1) - 2 && fg.FildGame[Move.dotMove[0] + 2, Move.dotMove[1] + 2] == true) { flagOut0 |= 0b00001; // right block +2 } if (Move.dotMove[1] == 0 || (flagOut0 & 0b11100) == 0b11100) // zero, left { Move.dotMove[0] += 2; if (SupportMethods.Intersection(Form_0, fg)) { Form = Form_0; rollCount = NextPosition(); } else { Move.dotMove[0] -= 2; } } else if ((flagOut0 & 0b10010) == 0b10010) //right +1 { Move.dotMove[0] += 2; Move.dotMove[1] -= 3; if (SupportMethods.Intersection(Form_0, fg)) { Form = Form_0; rollCount = NextPosition(); } else { Move.dotMove[0] -= 2; Move.dotMove[1] += 3; } } else if ((flagOut0 & 0b10001) == 0b10001) //right +2 { Move.dotMove[0] += 2; Move.dotMove[1] -= 2; if (SupportMethods.Intersection(Form_0, fg)) { Form = Form_0; rollCount = NextPosition(); } else { Move.dotMove[0] -= 2; Move.dotMove[1] += 2; } }
public void Rotate(Fild fg) => RotatePosition(NextPosition(), fg);