Edit this page Backlinks This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ===== Homework 3 - Tic Tac Toe ===== In this homework, you will implement some functionality which will allow you to design a completely functional tic-tac-toe AI. The latter will be part of homework 4. ==== About Tic Tac Toe ==== Tic Tac Toe is usually played on a 3 by 3 board, marking positions by each player in rounds. Our game is slightly different: * it can be played on a square board of any size larger or equal to 5. * A player wins if it has marked a line, column or diagonal of 5 consecutive positions in a row. Example of a winning position for ''X'' on a 5x5 board: <code> X...0 0X.0. ..X0. ...X. .0..X </code> Example of a winning position for ''0'' on a 7x7 board: <code> .X...X. ...0... ...0... .X.0..X 0..0..0 ...0... ...X... </code> ==== Coding conventions ==== * In your project template, ''X'' is encoded as the **first** player (''One''), and ''0'', as ''Two''. * A ''Board'' is encoded as a List of Lists of **positions** (i.e. a matrix), where a position can be ''One'', ''Two'' or ''Empty''. We make no distinction in the code between a position and a player, although ''Empty'' cannot be seen as a valid player. This makes the code slightly easier to write. ==== Coding tasks ====