Taken less from backgammon-scala