This Gomoku program is based on normal rules.(not renju rules) (Only three three is banned.)
- Input the mode (0,1,2,3) 0-> between users 1-> user->black, AI->white 2-> user->white, AI->black 3-> between AIs.(for debugging)
- input the time limits of AI for one step (It is recommended to input over 1000ms)
- Play the Gomoku
- void init_pan() : initializes board
- void print_pan() : prints board
- boolean insert_dol() : get the input of one step, if one wins it returns true, otherwise it returns false
- get_StoneCount() : this function returns the count of stones in one certain direction
- win_check() : this function returns if one wins or not
- is_Five(),is_Four... is_Two() etc.. : this functions returns whether one player achieved specific number of straight stones in one certain direction.
- print_status() : This function is used for debugging, and it returns the status which is composed of numbers of three straight stones, or numbers of four straight stones, numbers of closed straight three stones,.. etc...
- evaluation() : This function returns the board status score of one color.
- min_value_black(). max_value_black(), min_value_white(),min_value_black() This function performs the evaluation of boards and performs the min-max algorithm and returns the score.
- AI_minmax_Black(), AI_minmax_White() -> This function takes action based on evaluation.
This project is based on min-max algorithm and alpha-beta prunning. I did iterative deepening search on this project, which performs search with increasing search limits until the time limit expires. And before doing search, if AI can win with one step, that state is stored in definite_x, definite_y and return true.
In min-max algorithm, evaluation function is the most important part of program. I evaluated board status with counting each numbers of open or closed count of stones and give each of them different scores. Below are specific scores that I gave. I think I can develop this evaluation function by changing specific scores of each status.
- closed two - 1
- open two - 2
- closed three stones - 3
- open three - 7
- close four - 9
- open three three - (should be banned) -100000
- open four - 2000
- three four - 2000
- five - 500000