preview

Using Alpha Beta Pruning And Minimax

Decent Essays

# include <iostream>
# include <list>
# include <map> using namespace std;
//--------------------------------------------------------------------
//Constants assigned to max, min draw const int MAX = 1; const int MIN = -1; const int DRAWE = 0; const int MAXIMUM_SQRS = 9;
//-------------------------------------------------------------------
// Alpha Beta Pruning turned on bool alpha_beta_on = false;
//compare the results of using alpha beta pruning and minimax static int counter = 0;
//assign each column, row and diagnal values inline bool LC(short x)
{
return (x & 0x49) == 0x49;
}
inline bool MCL(short x)
{
return (x & 0x92) == 0x92;
}
inline bool RC(short x)
{
return (x & 0x124) == 0x124;
}
inline bool TR(short x)
{
return (x & 7) == 7;
}
inline bool MR(short x)
{
return (x & 0x38) == 0x38;
}

inline bool BR(short x)
{
return (x & 0x1C0) == 0x1C0;
}
inline bool D1(short x)
{
return (x & 0x111) == 0x111;
}
inline bool D2(short x)
{
return (x & 0x54) == 0x54;
}
typedef int utility;
//--------------------------------------------------------------------------
//initiate action to achieve a new game state class action { public: action() { a_ = 0; side_ = 0; } action(short a, short side) { a_ = a; side_ = side; } enum { MIN = 1, MAX = 2 }; short a_; short side_;
};
//----------------------------------------------------------------------------
//game state that assigned to each x

Get Access