Perhaps we should begin discussing the Tetris project.
One suggestion has been that we represent a
"J" shape as
_|. We can print that by executing ...
But, of course, in a real Tetris game, the
"J" can be in any one of four positions. It is difficult to rotate the above representation into all of those positions.
We could represent the
"J" shape like this instead, shown here in each of the four possible positions ...
# ### ## #
# # # ###
To print these, we can use this ...
print " #"
print " #"
print " #"
and this ...
Another issue, though, is that on an actual Tetris board, there will be other shapes in addition to the
"J" shape, with the full set being
"Z". Most of these can also be rotated. A problem arises, when several of these shapes are adjacent to each other. If we use the same character to build each one, we cannot distinguish them on the board, when several of them are adjacent. All we would see would be a glob of
"#" symbols. So, maybe we should build each shape by using the letter for which it is named. To print an
"O", then, we would use ...
"S"` would be ...
print " SS"
But there is still another problem. Shapes can interlock with each other, fitting snugly together ...
We cannot simply print a complete
"S", and then a complete
"J" to do that. We would need to intermix the
print statements. Things could then get really messy.
So, another strategy could be to establish the board as a list of rows. Represent each shape as having a row, column location and a particular rotation. Based on that information, we can devise an algorithm to calculate what character needs to be printed at each row, column position on the board. Then print the board, one row at a time.
We should probably write a
draw function that is designed to draw shapes, so we can call the function whenever needed, to insert a shape onto the
drawing would actually consist of storing the characters that represent the shape into the
board list. The function might take a shape name, a row, a column, and a rotation factor as arguments. It would need to make sure the specified location and position are in a valid place on the
board, and that the shape being added does not impinge upon another shape that is already there.
Then once the
board has been composed, we could use a
print_board function to display it. We would, of course, need to create that function.
I'll leave off here for now. Perhaps we can get some other suggestions.