I am creating a program in C Gomoku . He uses Minimax to choose the best move. However, he can only search for the best move for 10 seconds. How to determine when my search function spent 10 seconds of searching. If you could provide me with either an example or a link to documentation that would be highly appreciated.
#include <time.h> time_t start_time = time(NULL); while (((int)(time(NULL) - start_time)) < 10) { //search }
That is what comes to mind. He has not been tested.
, . Minmax, . Minmax . , Iterative Deepening Minmax a Sentinel Value, .
!. - , , . 30 , , , 1 , !
- , , , , ! ( -) . , .
alarm. okWereDoneNow , reset.
alarm
okWereDoneNow
, . , . , - . - !
time() time.h. , . , difftime() .
- .
++, - C.
Source: https://habr.com/ru/post/1769912/More articles:ะะฑัะตะทะฐัั ะพัะธะฑะบั ะฒ PHP Imagick? - phphttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1769908/how-can-i-determine-whether-remote-desktop-is-running-at-a-given-ip-address&usg=ALkJrhhgrSRN4jxdrbnYs0IhD-dSLy_DMgAWK to find average rainfall in three states - awkQuestion about C ++ inheritance - c ++HTML 5 Web Sockets and XMPP Server Dialog Box - socketsWebsite page layout width - htmlMany-page form - javascriptEXC_BAD_ACCESS if I call an Objective-C block directly - objective-cExecuting multiple MySQL queries in a single query? - mysqlTranslucent PictureBox (C # application for Windows Forms) - c #All Articles