add AI part

mostly done