Download presentation

Presentation is loading. Please wait.

Published byErick Morgan Modified about 1 year ago

1
DATA STRUCTURES AND ALGORITHMS

2
The project that we worked on is a well known game called “Tic Tac Toe”. We implemented this game using a binary tree which is a very flexible data structure along with some other data structures namely link lists & multi dimensional arrays.

3
Tic-tac-toe, also spelled tick tack toe, or noughts and crosses is a pencil paper game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three respective marks in a horizontal, vertical, or diagonal row wins the game.

4
Choose which player will be represented by X and which by O. Let player X go first to put an X in any of the nine sections of the grid. The players take turns putting their symbol on the table. The first player to have 3 of their symbols in a row, whether it is horizontally, vertically, or diagonally, is the winner.

5

6
A binary tree is a tree data structure in which each node has at most two child nodes, usually distinguished as "left" and "right". Nodes with children are parent nodes, and child nodes may contain references to their parents. Any node in the data structure can be reached by starting at root node and repeatedly following references to either the left or right child.

7
JButton JLabel File streaming

8

9
Following classes were used in our program: tttapp Node AI

10
java.util.* java.io.* java.awt.* javax.swing.* java.awt.event.* Firstedge(text file) Firstcorner(text file)

11
AI() setstate() match() load() searchstate() nextmove() display() compwin() compwins() userwins() chktie() getc() actionperformed() init()

12

13

14
Only two strategies i.e. first-corner and first- edge are taken into consideration while developing the program’s logic. The computer always goes first.

15

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google