Search found 1 match

by eltanin
Wed May 09, 2012 3:11 pm
Forum: Support and Development
Topic: Tic Tac Toe - AI (efficient algorithm?)
Replies: 17
Views: 8846

Re: Tic Tac Toe - AI (efficient algorithm?)

one solution might be to use a lookup table: -- all possible winning states lookup = {{1,2,3}, {4,5,6}, {7,8,9}, {1,4,7}, {2,5,8}, {3,6,9}, {1,5,9}, {3,5,7}} -- returns nil when there is no winner yet function getWinner() -- lets check each state for i, v in ipairs(lookup) do if field[v[1]].owner ==...