Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of el17ajf by
Grid/Grid.h@3:a1b058ff66c2, 2019-03-12 (annotated)
- Committer:
- el17ajf
- Date:
- Tue Mar 12 16:37:43 2019 +0000
- Revision:
- 3:a1b058ff66c2
- Child:
- 4:aa433f9865a6
added Grid class for the board
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17ajf | 3:a1b058ff66c2 | 1 | class Block { |
el17ajf | 3:a1b058ff66c2 | 2 | public: |
el17ajf | 3:a1b058ff66c2 | 3 | int x; |
el17ajf | 3:a1b058ff66c2 | 4 | int y; |
el17ajf | 3:a1b058ff66c2 | 5 | }; |
el17ajf | 3:a1b058ff66c2 | 6 | |
el17ajf | 3:a1b058ff66c2 | 7 | class Tetromino { |
el17ajf | 3:a1b058ff66c2 | 8 | public: |
el17ajf | 3:a1b058ff66c2 | 9 | Tetromino(); |
el17ajf | 3:a1b058ff66c2 | 10 | Block[] blocks = new Block[4]; |
el17ajf | 3:a1b058ff66c2 | 11 | }; |
el17ajf | 3:a1b058ff66c2 | 12 | |
el17ajf | 3:a1b058ff66c2 | 13 | class Grid { |
el17ajf | 3:a1b058ff66c2 | 14 | public: |
el17ajf | 3:a1b058ff66c2 | 15 | void update(); |
el17ajf | 3:a1b058ff66c2 | 16 | bool isSpaceForTetromino(Tetromino tetromino); |
el17ajf | 3:a1b058ff66c2 | 17 | void placeTetromino(Tetromino tetromino); |
el17ajf | 3:a1b058ff66c2 | 18 | private: |
el17ajf | 3:a1b058ff66c2 | 19 | const int height = 20; |
el17ajf | 3:a1b058ff66c2 | 20 | const int width = 10; |
el17ajf | 3:a1b058ff66c2 | 21 | int * grid = new int[width][height]; |
el17ajf | 3:a1b058ff66c2 | 22 | }; |