Tetris Written in Go
jjinux.com
Tetris Written in Go
1–10 of 20 posts
Re: Tetris Written in Go
#2Re: Tetris Written in Go
#3 g.piece = 1 + rand.Int()%numTypes
However, the official tetris guidelines say that the 7 types of pieces should all be selected in a random order, as if taken from a bag. After all 7 pieces are picked, you can put all of the pieces back in the bag and select again in a random order. [1]Of course, you don't HAVE to follow the official guidelines. I just thought it would be fun to compare.
Re: Tetris Written in Go
#4The first thing I did when I learned python was to write a tetris game in it (using PyGame). So the first thing I did was look at the random piece generator in the go version. It just picks one at random: g.piece = 1 + rand.Int()%numTypes However, the official tetris guidelines say that the 7 types of pieces should all be selected in a random order, as if taken from a bag. After all 7 pieces are picked, you can put a…
Re: Tetris Written in Go
#5jjinux had been a strong proponent of Python, but happy to see some Go love lately.
Re: Tetris Written in Go
#6The first thing I did when I learned python was to write a tetris game in it (using PyGame). So the first thing I did was look at the random piece generator in the go version. It just picks one at random: g.piece = 1 + rand.Int()%numTypes However, the official tetris guidelines say that the 7 types of pieces should all be selected in a random order, as if taken from a bag. After all 7 pieces are picked, you can put a…
However over the years, even after the guideline was instituted, there have been many different types of randomizers used. Of course, the original having none, and many a long the way having bugs.
Re: Tetris Written in Go
#7Re: Tetris Written in Go
#8The first thing I did when I learned python was to write a tetris game in it (using PyGame). So the first thing I did was look at the random piece generator in the go version. It just picks one at random: g.piece = 1 + rand.Int()%numTypes However, the official tetris guidelines say that the 7 types of pieces should all be selected in a random order, as if taken from a bag. After all 7 pieces are picked, you can put a…
Re: Tetris Written in Go
#9The first thing I did when I learned python was to write a tetris game in it (using PyGame). So the first thing I did was look at the random piece generator in the go version. It just picks one at random: g.piece = 1 + rand.Int()%numTypes However, the official tetris guidelines say that the 7 types of pieces should all be selected in a random order, as if taken from a bag. After all 7 pieces are picked, you can put a…