added ai function to TTT class