In today's episode, we're just going to make a new piece come down every time the current piece hits the bottom of the board. Nothing fancy yet, but it's another piece of the game we can implement fairly easily off of the back of the work we did in the last episode.

I've tagged the repo with before_episode_118 if you're following along.

Let's just get into it. We'd like to write a test to verify that when the current piece hits the bottom, we get a new piece and our x/y in the state are reset.

Now, in Tetris the next piece is known ahead of time, so we'll add a next_piece key to the Game State:

defmodule Extris.Game.State do defstruct shape: :ell, rotation: 0, x: 5, y: 0, next_shape: :ell end

This is a test of the game logic, rather than user interaction, so open up test/extris/game_test.exs:

defmodule Extris.GameTest do use ExUnit.Case alias Extris.Game alias Extris.Game.State test "The next piece becomes the current piece when the current...