public void GetTotalLines() { var bottomStack = new BottomStack(); var square1 = new TetriminoO(); var square2 = new TetriminoO(3); var square3 = new TetriminoO(5); var square4 = new TetriminoO(7); var square5 = new TetriminoO(9); var square6 = new TetriminoO(11); Call.Action(Game.Height, () => { square1.MoveDown(); square2.MoveDown(); square3.MoveDown(); square4.MoveDown(); square5.MoveDown(); square6.MoveDown(); }); bottomStack.Add(square1); bottomStack.Add(square2); bottomStack.Add(square3); bottomStack.Add(square4); bottomStack.Add(square5); bottomStack.CompletedLineCount.Should().Be(0); bottomStack.Add(square6); bottomStack.CompletedLineCount.Should().Be(2); bottomStack.CompletedLineBlocks.Should().HaveCount(24); }
public void RemoveTotalLines() { var bottomStack = new BottomStack(); var square1 = new TetriminoO(); var square2 = new TetriminoO(3); var square3 = new TetriminoO(5); var square4 = new TetriminoO(7); var square5 = new TetriminoO(9); var tetriminoJ = new TetriminoJ(10); tetriminoJ.Turn(); tetriminoJ.MoveRight(); Call.Action(Game.Height, () => { square1.MoveDown(); square2.MoveDown(); square3.MoveDown(); square4.MoveDown(); square5.MoveDown(); tetriminoJ.MoveDown(); }); bottomStack.Add(square1); bottomStack.Add(square2); bottomStack.Add(square3); bottomStack.Add(square4); bottomStack.Add(square5); bottomStack.Add(tetriminoJ); bottomStack.RemoveCompletedLines(); bottomStack.CompletedLineCount.Should().Be(0); bottomStack.Count().Should().Be(12); Check.That(bottomStack).IsEquivalentTo((24, 1), (24, 2), (24, 3), (24, 4), (24, 5), (24, 6), (24, 7), (24, 8), (24, 9), (24, 10), (24, 12), (23, 12)); }
public void SignalCollisionIfTouchingBottom(int padding, bool expected) { var shape = new TetriminoJ(); var bottomStack = new BottomStack(); Call.Action(Game.Height - padding, shape.MoveDown); bottomStack.WillCollideBottom(shape).Should().Be(expected); }
public void AddSomeShape() { var shape = new TetriminoJ(); Call.Action(Game.Height, shape.MoveDown); var bottomStack = new BottomStack(); bottomStack.Add(shape); bottomStack.Should().NotBeEmpty(); }
/// <summary> /// Moves the top card of the bottom stack to the current playing card. /// </summary> /// <returns>true if a move was possible and successful, otherwise false.</returns> public bool TryMoveStackToCurrent() { if (BottomStack.Count == 0) { return(false); } CurrentCard = BottomStack.Pop(); CurrentCard.Hidden = false; RaisePropertyChanged(nameof(CurrentCard)); RaisePropertyChanged(nameof(StackCount)); return(true); }
public void RemoveLineSeparated() { var bottomStack = new BottomStack(); var t1_1 = new TetriminoT(1); Call.Action(2, () => t1_1.Turn()); var t1_2 = new TetriminoT(4); Call.Action(2, () => t1_2.Turn()); var t1_3 = new TetriminoT(7); Call.Action(2, () => t1_3.Turn()); var o1_1 = new TetriminoO(10); var i3_1 = new TetriminoI(1); var i3_2 = new TetriminoI(5); var l3_1 = new TetriminoJ(9); Call.Action(2, () => l3_1.Turn()); var i4_1 = new TetriminoI(1); var i4_2 = new TetriminoI(5); var o4_1 = new TetriminoO(10); var lastBar = new TetriminoI(); bottomStack.PushBottom(t1_1); bottomStack.PushBottom(t1_2); bottomStack.PushBottom(t1_3); bottomStack.PushBottom(o1_1); bottomStack.PushBottom(i3_1); bottomStack.PushBottom(i3_2); bottomStack.PushBottom(l3_1); bottomStack.PushBottom(i4_1); bottomStack.PushBottom(i4_2); bottomStack.PushBottom(o4_1); lastBar.Turn(); Call.Action(12, () => lastBar.MoveRight()); bottomStack.PushBottom(lastBar); bottomStack.CompletedLineCount.Should().Be(3); bottomStack.RemoveCompletedLines(); bottomStack.Count().Should().Be(8); Check.That(bottomStack).IsEquivalentTo((24, 2), (24, 5), (24, 8), (24, 10), (24, 11), (24, 12), (23, 10), (23, 11)); }
public void SignalCollisionIfTouchingOtherBlock(int padding, bool expected) { var bottomStack = new BottomStack(); var shape1 = new TetriminoJ(); var shape2 = new TetriminoL(); shape1.Turn(); Call.Action(Game.Height, shape1.MoveDown); bottomStack.Add(shape1); Call.Action(Game.Height - padding, shape2.MoveDown); bottomStack.WillCollideBottom(shape2).Should().Be(expected); }
private async void TapGestureRecognizer_Tapped(object sender, EventArgs e) { if (!BottomStack.IsVisible) { headerImage.Source = "droparrow.png"; BottomStack.IsVisible = true; await BottomStack.TranslateTo(0, 0, 250); } else { headerImage.Source = "droparrow.png"; BottomStack.IsVisible = false; await BottomStack.TranslateTo(0, -10, 250); } }
public static void PushBottom(this BottomStack stack, Tetrimino shape) { Call.ActionUntil(() => !stack.WillCollideBottom(shape), shape.MoveDown); stack.Add(shape); }