Tic Tac Toe Algorithm for Terminal. School work.