SciKit-Learn Assignment

Purpose

SciKit-Learn enables easy machine learning in Python. With machine learning influencing so much of the modern world, knowing the basics is a useful skill to have. This assignment will give you an overview of machine learning through SciKit-Learn.

Provided Starting Materials

The tictactoe.py file is where you will be doing all your work. This file is commented to help you in the creation of your learning algorithm. Additionally, this is the only file you will need to turn in. While you can create new files and turn them in alongside this one, you shouldn't be making any changes to the other provided three files listed below.

You will also be provided the tictactoe_gui.py file. This file is 'external' and you should not make any changes to it – it contains the code necessary to render a game board, and doesn't have to be used in your solution.

There are two other files provided. ttt_data_o_training contains data to train the AI player to play as O. There are many lines with eighteen numbers each. Every line contains 2 3x3 matrices transformed to text. The provided code already contains function to read this data. All you need to do is to load the data with the function and then train your AI with this data.

The second file ttt_data_x_training contains training data for X player in the same format.

Assignment

The world's best Tic-Tac-Toe player has challenged you to a duel!

The reward is 45% of your final grade so naturally you take them up on the challenge. But as a computer scientist, you have no intention of playing the game with your own two hands.

Your task is to utilize machine learning to create a program that will accurately win Tic-Tac-Toe.

The provided tictactoe.py contains the basic structure of the game engine and your AI. You must implement the game engine and the AI part. The TODOs in comments will tell you what to do.

Approach

There are a few different approaches to this problem, but you'll receive credit so long as your solution uses scikit learn and isn't just a series of if statements.

The provided tictactoe_gui.py file allows for easy board rendering. You can read the comments in the file to get an in-depth look at how it works, but an explanation for how to use the file can be found below.

For more insight, read this article to get an overview about the problem of predicting in artificial intelligence. You could also read about minimax algorithm, but the purpose of this assignment is to develop an AI which can play TicTacToe in a non random manner.

Grading - 100 Points Possible

100 points will be given for making a functioning program. Even if the program isn't 100% accurate, good comments can show thought process and award partial credit.