 	add_move(x,y)
 	return [x,y]
 
-ais["greedy"] = () ->
+# The greedy ai picks the first open square on the currently active subboard.
+ais["greedy"] = {}
+ais["greedy"].move = () ->
 	subboard = subboard_next[-1..][0]
-	selection = first_unfilled(subboard)
+	selection = ais.first_unfilled(subboard)
 	x = selection % 3 + 3 * (subboard % 3)
 	y = selection // 3 + 3 * (subboard // 3)
 	add_move(x,y)
 	return [x,y]
 
+# The focused ai will play the best move for the current active subboard.
+# That is, it 'focuses' on winning subboards.
+
 reset()

	subboard_next.push square_index
	return

# This is the call to get the next move to make
ais["random"] = () ->
	subboard = subboard_next[-1..][0]

	# selection = first_unfilled(subboard)

	options = unfilled_squares(subboard)
	console.log options
	selection = options[Math.random() * options.length // 1]


get_square_on_subboard = (x,y) ->
	3 * (y % 3) + (x % 3)

ais.first_unfilled = (subboard_index) ->
	return i for v,i in boards[subboard_index] when v is 0

ais.unfilled_squares = (subboard_index) ->
	return (i for v,i in boards[subboard_index] when v is 0)

# This is the call to mutate the board from user-space
