11
Indian Institute of Technology Hyderabad SOS - The Game A Project by Paritosh J Chandran Prakhar Bharadwaj Ganesh Mahidhar Nagarjun Srinivasan

Indian Institute of Technology Hyderabad SOS - The Game A Project by Paritosh J Chandran Prakhar Bharadwaj Ganesh Mahidhar Nagarjun Srinivasan

Embed Size (px)

Citation preview

Page 1: Indian Institute of Technology Hyderabad SOS - The Game A Project by Paritosh J Chandran Prakhar Bharadwaj Ganesh Mahidhar Nagarjun Srinivasan

Indian Institute of TechnologyHyderabad

SOS - The Game

A Project by

Paritosh J Chandran

Prakhar Bharadwaj

Ganesh Mahidhar

Nagarjun Srinivasan

Page 2: Indian Institute of Technology Hyderabad SOS - The Game A Project by Paritosh J Chandran Prakhar Bharadwaj Ganesh Mahidhar Nagarjun Srinivasan

Rules of SOS

Two people, here, the computer and you play against each other

Both the players play the same card, i.e. An “S” or an “O” alternatively, in terms of both the card and the play

The one who forms SOS in a horizontal or vertical line

In our version of the game diagonal victory are not allowed

Page 3: Indian Institute of Technology Hyderabad SOS - The Game A Project by Paritosh J Chandran Prakhar Bharadwaj Ganesh Mahidhar Nagarjun Srinivasan

About the Program

The program began in hopes of achieving AI

As of now the program just follows certain rules defined in the source code

Which basically entails that the program has a set of defined rules, checks and moves(such as double tricks, wins etc.)

The rules and checks are pre-defined by the rules of the game

Page 4: Indian Institute of Technology Hyderabad SOS - The Game A Project by Paritosh J Chandran Prakhar Bharadwaj Ganesh Mahidhar Nagarjun Srinivasan

The moves to entice a sure win each time has been developed the project team

Logic for each move has been tried and tested

In the future what we hope to achieve is a program that can learn from its mistakes and play. Like a human basically against players

Page 5: Indian Institute of Technology Hyderabad SOS - The Game A Project by Paritosh J Chandran Prakhar Bharadwaj Ganesh Mahidhar Nagarjun Srinivasan

Working of the ProgramThe program first begins by checking if a player has won

Then, it looks if it can finish a win by playing a good move, if not, it checks if the player it’s playing against can win in his next move and the program prevents such a move from happening

If the above 2 situations don’t arise, then, the program proceeds to make a set of pre-defined double tricks(defined by the project team)

If no such possibility is present, the computer plays a neutral/random move such that it does not hinder its chances of winning or being held in a double trick by the player

Page 6: Indian Institute of Technology Hyderabad SOS - The Game A Project by Paritosh J Chandran Prakhar Bharadwaj Ganesh Mahidhar Nagarjun Srinivasan

Variables UsedCh – Two dimensional character array

I, j – Loop variables

Tot – Total number of moves made so far

Turnmade – Keeps track of which move has been made and who has made it

Win – flag variable

G, h – input values from user

Page 7: Indian Institute of Technology Hyderabad SOS - The Game A Project by Paritosh J Chandran Prakhar Bharadwaj Ganesh Mahidhar Nagarjun Srinivasan

Functions Used

Print() – Prints the present status of the board

Main() – Primary function of the program. This programme contains the code on how the game should move on. What plays the computer should make and ultimately

win. The main() function is the most important part of the program

Page 8: Indian Institute of Technology Hyderabad SOS - The Game A Project by Paritosh J Chandran Prakhar Bharadwaj Ganesh Mahidhar Nagarjun Srinivasan

Screen-Shot 1

Page 9: Indian Institute of Technology Hyderabad SOS - The Game A Project by Paritosh J Chandran Prakhar Bharadwaj Ganesh Mahidhar Nagarjun Srinivasan

Screen-Shot 2

Page 10: Indian Institute of Technology Hyderabad SOS - The Game A Project by Paritosh J Chandran Prakhar Bharadwaj Ganesh Mahidhar Nagarjun Srinivasan

Screen-Shot 3

Page 11: Indian Institute of Technology Hyderabad SOS - The Game A Project by Paritosh J Chandran Prakhar Bharadwaj Ganesh Mahidhar Nagarjun Srinivasan

Screen-Shot 4