A pure functional way of implementing a Tic Tac Toe in Scala