This repository was archived by the owner on Jan 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemenation of Square and Tee + Rotation of those
Collission works perfect, nothing to do there anymore When you loose, everything will reset
- Loading branch information
1 parent
aeea93a
commit b8cc24d
Showing
11 changed files
with
304 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp1.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
using System; | ||
using System.Threading; | ||
|
||
/// <summary> | ||
/// By XeeX from https://gist.github.com/XeeX/6220067 | ||
/// </summary> | ||
namespace MusicBox | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.Beep(658, 125); | ||
Console.Beep(1320, 500); | ||
Console.Beep(990, 250); | ||
Console.Beep(1056, 250); | ||
Console.Beep(1188, 250); | ||
Console.Beep(1320, 125); | ||
Console.Beep(1188, 125); | ||
Console.Beep(1056, 250); | ||
Console.Beep(990, 250); | ||
Console.Beep(880, 500); | ||
Console.Beep(880, 250); | ||
Console.Beep(1056, 250); | ||
Console.Beep(1320, 500); | ||
Console.Beep(1188, 250); | ||
Console.Beep(1056, 250); | ||
Console.Beep(990, 750); | ||
Console.Beep(1056, 250); | ||
Console.Beep(1188, 500); | ||
Console.Beep(1320, 500); | ||
Console.Beep(1056, 500); | ||
Console.Beep(880, 500); | ||
Console.Beep(880, 500); | ||
Thread.Sleep(250); | ||
Console.Beep(1188, 500); | ||
Console.Beep(1408, 250); | ||
Console.Beep(1760, 500); | ||
Console.Beep(1584, 250); | ||
Console.Beep(1408, 250); | ||
Console.Beep(1320, 750); | ||
Console.Beep(1056, 250); | ||
Console.Beep(1320, 500); | ||
Console.Beep(1188, 250); | ||
Console.Beep(1056, 250); | ||
Console.Beep(990, 500); | ||
Console.Beep(990, 250); | ||
Console.Beep(1056, 250); | ||
Console.Beep(1188, 500); | ||
Console.Beep(1320, 500); | ||
Console.Beep(1056, 500); | ||
Console.Beep(880, 500); | ||
Console.Beep(880, 500); | ||
Thread.Sleep(500); | ||
Console.Beep(1320, 500); | ||
Console.Beep(990, 250); | ||
Console.Beep(1056, 250); | ||
Console.Beep(1188, 250); | ||
Console.Beep(1320, 125); | ||
Console.Beep(1188, 125); | ||
Console.Beep(1056, 250); | ||
Console.Beep(990, 250); | ||
Console.Beep(880, 500); | ||
Console.Beep(880, 250); | ||
Console.Beep(1056, 250); | ||
Console.Beep(1320, 500); | ||
Console.Beep(1188, 250); | ||
Console.Beep(1056, 250); | ||
Console.Beep(990, 750); | ||
Console.Beep(1056, 250); | ||
Console.Beep(1188, 500); | ||
Console.Beep(1320, 500); | ||
Console.Beep(1056, 500); | ||
Console.Beep(880, 500); | ||
Console.Beep(880, 500); | ||
Thread.Sleep(250); | ||
Console.Beep(1188, 500); | ||
Console.Beep(1408, 250); | ||
Console.Beep(1760, 500); | ||
Console.Beep(1584, 250); | ||
Console.Beep(1408, 250); | ||
Console.Beep(1320, 750); | ||
Console.Beep(1056, 250); | ||
Console.Beep(1320, 500); | ||
Console.Beep(1188, 250); | ||
Console.Beep(1056, 250); | ||
Console.Beep(990, 500); | ||
Console.Beep(990, 250); | ||
Console.Beep(1056, 250); | ||
Console.Beep(1188, 500); | ||
Console.Beep(1320, 500); | ||
Console.Beep(1056, 500); | ||
Console.Beep(880, 500); | ||
Console.Beep(880, 500); | ||
Thread.Sleep(500); | ||
Console.Beep(660, 1000); | ||
Console.Beep(528, 1000); | ||
Console.Beep(594, 1000); | ||
Console.Beep(495, 1000); | ||
Console.Beep(528, 1000); | ||
Console.Beep(440, 1000); | ||
Console.Beep(419, 1000); | ||
Console.Beep(495, 1000); | ||
Console.Beep(660, 1000); | ||
Console.Beep(528, 1000); | ||
Console.Beep(594, 1000); | ||
Console.Beep(495, 1000); | ||
Console.Beep(528, 500); | ||
Console.Beep(660, 500); | ||
Console.Beep(880, 1000); | ||
Console.Beep(838, 2000); | ||
Console.Beep(660, 1000); | ||
Console.Beep(528, 1000); | ||
Console.Beep(594, 1000); | ||
Console.Beep(495, 1000); | ||
Console.Beep(528, 1000); | ||
Console.Beep(440, 1000); | ||
Console.Beep(419, 1000); | ||
Console.Beep(495, 1000); | ||
Console.Beep(660, 1000); | ||
Console.Beep(528, 1000); | ||
Console.Beep(594, 1000); | ||
Console.Beep(495, 1000); | ||
Console.Beep(528, 500); | ||
Console.Beep(660, 500); | ||
Console.Beep(880, 1000); | ||
Console.Beep(838, 2000); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Tetris.Core.Figures | ||
{ | ||
public class Square : BaseFigure | ||
{ | ||
public Square() | ||
{ | ||
for (int i = 0; i < 2; i++) | ||
for (int o = 0; o < 2; o++) | ||
Bricks.Add(new Brick { X = o, Y = i }); | ||
} | ||
|
||
public override void Rotate() | ||
{ | ||
} | ||
public override void CounterRotate() => Rotate(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,5 +38,7 @@ public override void Rotate() | |
} | ||
} | ||
} | ||
public override void CounterRotate() => Rotate(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Tetris.Core.Figures | ||
{ | ||
public class Tee : BaseFigure | ||
{ | ||
public Brick this[int x, int y] | ||
{ | ||
get | ||
{ | ||
var originX = RotationBrick.X - 1; | ||
var originY = RotationBrick.Y - 1; | ||
|
||
return Bricks.FirstOrDefault(o => o.X == x + originX && o.Y == y + originY); | ||
} | ||
} | ||
Brick a; | ||
Brick b; | ||
Brick c; | ||
Brick d; | ||
|
||
public Tee() | ||
{ | ||
var rotBrick = new Brick { X = 1, Y = 1 }; | ||
|
||
var b = new List<Brick> { | ||
new Brick { X = 0, Y = 1 }, | ||
new Brick { X = 2, Y = 1 }, | ||
new Brick { X = 1, Y = 0 }, | ||
rotBrick, }; | ||
Bricks.AddRange(b); | ||
RotationBrick = rotBrick; | ||
|
||
} | ||
|
||
public override void Rotate() | ||
{ | ||
/* | ||
[0,1] (x+1 y+1)=> [1,2] | ||
[1,0] (x-1 y+1)=> [0,1] | ||
[2,1] (x-1 y-1)=> [1,0] | ||
[1,2] (x+1 y-1)=> [2,1] | ||
*/ | ||
a = this[0, 1]; | ||
b = this[1, 0]; | ||
c = this[2, 1]; | ||
d = this[1, 2]; | ||
if (a != null) | ||
a.SetRelativePosition(1, 1); | ||
if (b != null) | ||
b.SetRelativePosition(-1, 1); | ||
if (c != null) | ||
c.SetRelativePosition(-1, -1); | ||
if (d != null) | ||
d.SetRelativePosition(1, -1); | ||
} | ||
|
||
public override void CounterRotate() | ||
{ | ||
for (int i = 0; i < 3; i++) | ||
Rotate(); | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.