Add AI

Add basic control logic

Signed-off-by: Paul Brook <paul@nowt.org>