#include #include using namespace std; bool boardful(); bool check2(int f,bool already); int comp_move(int s); int check(int c,int d); void setBoard(int p); int MAX = 100; int MIN = -100; typedef int depth; typedef int State; typedef int Ply; typedef int ListIndex; vector board(18); /* dummy game tree */ vector solutions(20); /* this function is used to compute the gcd which is in turn * used to deduce possible solutions to game. */ int euclid(int a ,int b) { if(b==0) return a; else return euclid(b,a%b); } int game(int x, int y, int j) { int i1; int i,k,m; cout << endl << endl; board[0] = x; board[1] = y; cout << " " << x << " " << y << " " << endl<< endl; if(x == y) { cout << " DRAW - NO WINNER ! " << endl; return 0; } for(i=0; i> i1; check(i1,j); for(int k=0;k Y) return X; else return Y; } float Min(float X, float Y) //Returns minimum of X and Y. { if (X < Y) return X; else return Y; } int game2(int x, int y, int j) { int i1; int i,k,m; cout << endl << endl; board[0] = x; board[1] = y; cout << " " << x << " " << y << " " << endl<< endl; if(x == y) { cout << " DRAW - NO WINNER ! " << endl; return 0; } for(i=0; i> i1; check(i1,j); for(int k=0;k> ch; cout << endl; switch(ch) { case 1: game2(n1,n2,i); break; case 2: game(n1,n2,i); break; } /*for(int t=0;t