Michael Doornbos

Gotta wait for random numbers

Working on a Maze game and need a quick INT(RND(1)*4) to randomly pick the next direction. An interesting (and well-known) side effect of a tight(ish) loop is that you can get the same number back several times in a row if you don’t wait for a few clock cycles between polling $d41b. Not a problem in my actual maze, but my quick print before incorporating it into the actual code shows this quite clearly.

https://videopress.com/v/ar6UJH06?resizeToParent=true&cover=true&preloadContent=metadata&useAverageColor=true

<< Previous Post

|

Next Post >>