When I was younger, I remember spending way too much time with a puzzle much like this one. Mine was diamond shaped, and on the back there were triangles to create a 3D pyramid with the same shapes. It came…

## How to use Python generators to save memory

I recently saw a Reddit thread where someone was asking for help managing memory in Python. It was a pretty short script, but it contained the following function: Needless to say, I think I found the memory problem. This function…

## An Experiment with Scala.js

We don’t usually think of Scala as a front-end language, but Scala.js is challenging that assumption. The framework gives you easy access to the DOM and therefore the canvas, making it trivial to develop an HTML5 application. To demonstrate this,…

## How to Use Recursion in Scala

When learning about recursion, a common example is the Fibonacci sequence. In simple terms, we say that the nth Fibonacci number is equal to the sum on the (n-1)th Fibonacci number and the (n-2)th Fibonacci number. By adding in the…

## Implementing Minimax in Scala: Alpha-Beta Pruning

Last time, we built a naive minimax algorithm in Scala. While it was effective, it was unfortunately very slow. To increase the performance of the algorithm, we’ll implement a common variant of minimax with what is called “alpha-beta pruning”. Again,…