-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tetromino.cs
36 lines (30 loc) · 863 Bytes
/
Tetromino.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyPersonalTetris
{
public class Tetromino
{
public Tetromino(bool[,] body)
{
this.Body = body;
}
public bool[,] Body { get; private set; }
public int Width => this.Body.GetLength(0);
public int Height => this.Body.GetLength(1);
public Tetromino GetRotate()
{
var newFigure = new bool[this.Height, this.Width];
for (int row = 0; row < this.Width; row++)
{
for (int col = 0; col < this.Height; col++)
{
newFigure[col, this.Width - row - 1] = this.Body[row, col];
}
}
return new Tetromino(newFigure);
}
}
}