Source: https://www.cs.miami.edu/home/visser/csc329-files/Games-Threads.pdf