Skip to main content

Posts

Showing posts from October, 2020

Gerbtris : Coding Tetris in Bash

Coding Tetris in Bash Hi peeps. So you've come here because you've shown some interest in coding Tetris in bash. Goodness knows why, but we'll get straight on it. Firstly though, let me just say that this is MY implementation of the game. I'm aware that the implementations and methods used could probably be enhanced or improved, but they were used as they were the first solution I concocted for the puzzle at hand, and I had a limit of about fie hours (two motorway journeys) to get this coded from start to finish. Lets get into it. To break down what I needed for the very basic model (which ended up roughly 300 lines) I needed to write functions for the following: shape painter - a routine is needed to paint the shape at any point on the screen shape rotation - a routine is needed to rotate the shape shape collision - the shapes have to be "stackable" and not cross over any other shapes or the walls of the playing field shape mover - the user has