190 likes | 482 Views
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
E N D
SOS - The Game A Project by ParitoshJ Chandran PrakharBharadwaj Ganesh Mahidhar NagarjunSrinivasan
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
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
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
Working of the Program • The 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
Variables Used • Ch – 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
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