···2626- [x] Make Column/Row count configurable, this allows for way bigger playing fields
2727- [x] Add modern multiplayer, where you have to clear the game together
2828- [x] Config persistence
2929-- [ ] Toggle T-Spins
2929+- [x] T-Spins
3030- [ ] Points for perfect clears
3131- [ ] Scoreboard/Leaderboard
3232- [ ] Add classic Tetris multiplayer (deleted rows will be a penalty for the opponent)
+18-11
block.go
···77type I_Block interface {
88 Init(playerId ff.Peer) I_Block
99 GetId() int
1010+ GetOffset() (int, int)
1111+ GetRotationState() int
1012 Draw(offsetX, offsetY int)
1113 DrawPreview(offsetX, offsetY int)
1214 Move(rows, columns int)
1315 GetCellPositions() []Position
1414- TryRotateWithKicks(grid *Grid, clockwise bool) bool
1616+ TryRotateWithKicks(grid *Grid, clockwise bool) (bool, int)
1517 FitsInGrid(grid *Grid) bool
1618}
1719···2426 Id int
2527 Cells [4][]Position
2628 cellPosCache [4]Position
2929+}
3030+3131+func (b *Block) GetOffset() (int, int) {
3232+ return b.RowOffset, b.ColOffset
3333+}
3434+3535+func (b *Block) GetRotationState() int {
3636+ return b.RotationState
2737}
28382939func (b *Block) GetId() int {
···8797 return true
8898}
89999090-// Returns true if rotation was successful, false otherwise
9191-// Adhering to the rules of the SRS system
9292-func (b *Block) TryRotateWithKicks(grid *Grid, clockwise bool) bool {
100100+// TryRotateWithKicks attempts to rotate the block using SRS wall kicks.
101101+// Returns (true, kickIndex) on success, (false, -1) on failure.
102102+func (b *Block) TryRotateWithKicks(grid *Grid, clockwise bool) (bool, int) {
93103 oldState := b.RotationState
9410495105 if clockwise {
···101111102112 kickTests := GetKickTests(b.Id, oldState, newState)
103113104104- // Try each kick test in order
105105- for _, offset := range kickTests {
114114+ for i, offset := range kickTests {
106115 b.Move(offset.Row, offset.Column)
107116108117 if b.FitsInGrid(grid) {
109109- // block is rotated and positioned correctly
110110- return true
118118+ return true, i
111119 }
112120113113- // kick invalid, undo the offset
114121 b.Move(-offset.Row, -offset.Column)
115122 }
116123117117- // kicks invalid, undo rotation
124124+ // All kicks failed — undo rotation
118125 if clockwise {
119126 b.rotateCounterClockwise()
120127 } else {
121128 b.rotateClockwise()
122129 }
123123- return false
130130+ return false, -1
124131}
125132126133func (b *Block) rotateClockwise() {