how to impement tic-tac-toe using STL list

hello! i would like to know how to to create a tic-tac-toe using STL list to implement the game? i do not understand how to make use linked list to implement it. Our conditions for the game are as follows:

Each row of the grid is actually a n+3 offset on the list.
The data structures chosen must first be initialized with space or blank.
A function to check the winning condition can be called each time a position on the grid is used.

So can u tell me how do i go abt with this programming.Thx.





Last edited on
Wow. Now, this is a retarded assignment. I think the only data structure less suited for a tic-tac-toe board is a binary tree.

What do you mean by "a n+3 offset on the list"?

By the way, technically, lists don't have offsets, since their elements are not necessarily adjacent in memory.
Last edited on
I think he means that the game's first row occupy positions 0-2, second row occupy 3-5 and third row occupy 6-8, so that a gven row/column psition (r,c) can be found as 3r+c. That's a guess.

You need to think of which combinations, in terms of rows and columns, constitute winning combinations in tic-tac-toe. For example, if (0,0), (0,1) and (0,2) are all X's, x has won since the first row is full.

Take a chequered piece of parper, write down all winners, and create a program that can check if the current board contents have a winning combination in it...


Topic archived. No new replies allowed.