Software Beginnings

A project log for Speed Jenga

An augmented version of JENGA® utilizing a kitchen scale and game software

ZacZac 12/21/2019 at 15:070 Comments

Future software updates will be posted in upcoming log entries, but here is a quick summary of how the code base has evolved into what it is now. 

Tower State:

The pyserial library  made Python an easy choice for reading serial data from a kitchen scale. The core of the gameplay is based on reading the 'state' of the tower at any given moment. There are four different states depending on how many blocks are on the tower: on, off, pause, two off (disqualification), and collapse (see snippet from 

        #set scale status variables
        self.on_max = self.tower_wt + (self.avg_block_wt * self.block_variance)
        self.on_min = self.tower_wt - (self.avg_block_wt * self.block_variance)

        self.off_max = self.tower_wt - self.min_block_wt
        self.off_min = self.tower_wt - self.max_block_wt
        self.pause = self.tower_wt + self.min_block_wt
        self.two_off = self.tower_wt - self.min_block_wt * 2
        self.collapse = self.tower_wt - self.min_block_wt * 6


Determining the tower state was challenging since each block varies in weight and the weight of the tower fluctuates as players touch and pull out blocks. 

See block weight distribution below in kg:

Changing state:

Matplotlib was helpful for visualizing change in state. To trigger a change in state the tower weight (blue) must fall within a range of state (grey and yellow). Simultaneously, the standard deviation (red) of the most recent data points must fall below the std trigger (black). Adjusting the std trigger changes the responsiveness. Currently it takes about about a half second to confirm a valid change it state. 

 Below is snapshot of a block being pulled off and placed back on to the tower (