Question: You will write a program that generates every unique and valid tic tac-toe board. There are fewer than 6,000 of these once you remove duplicates

 You will write a program that generates every unique and valid
tic tac-toe board. There are fewer than 6,000 of these once you
remove duplicates and unreachable boards! Additionally, you will keep track of the
number of unique a valid) boards where: X wins Owins No one

You will write a program that generates every unique and valid tic tac-toe board. There are fewer than 6,000 of these once you remove duplicates and unreachable boards! Additionally, you will keep track of the number of unique a valid) boards where: X wins Owins No one wins ta tie). These should be output in this exact format: total boards: t, wins foro: o, wins for X: x, ties: 1 where t, 0. X and I are the respective integers you have calculated After that first line, the output from your program should be one line per board, where each tine is a string representing the board using the following indexing scheme below: | 112 3 | 45 +--+---+--- 6 | 7 | 8 For example, the string X o ox X represents the following board: XL 10 10X Additionally, your program's output should be in sorted order ..so if you re storing the strings representing the boards in a vector, youll need to sort it before printing keep in mind the following rutes: . x goes first The empty board is a valid board . The game stops when someone wins--no more moves are made. Your program does not have to be fast, but it should run in less than a minute. With the right algorithm, it is possible to have it run in seconds The following is the first several boards (when printed in sorted order: X XO OX Use recursion or stacks or queues! Use recursion or stacks or queues

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!