The actual intelligence behind artificial intelligence

The function needs to check all eight opportunities to score: 3 columns, 3 rows, and 2 diagonals. The big "aha" moment came when I realized that I couldn't just eject out of the function with a return statement the moment I discovered a chance to block, because (according to our handy prioritized strategy list), winning is of higher priority than blocking. By immediately returning the first opportunity to block I came across, I might be leaving an unsearched opportunity to win on the table.

The actual intelligence behind artificial intelligence

It became clear that I would need to store a list of opportunities to block, and a list of opportunities ...

Get Unity 4.x Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.