{"action":"created","issue":{"url":"https://api.github.com/repos/nneonneo/2048-ai/issues/35","labels_url":"https://api.github.com/repos/nneonneo/2048-ai/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/nneonneo/2048-ai/issues/35/comments","events_url":"https://api.github.com/repos/nneonneo/2048-ai/issues/35/events","html_url":"https://github.com/nneonneo/2048-ai/issues/35","id":67325659,"number":35,"title":"Share optimization ideas with you","user":{"login":"kcwu","id":175566,"avatar_url":"https://avatars.githubusercontent.com/u/175566?v=3","gravatar_id":"","url":"https://api.github.com/users/kcwu","html_url":"https://github.com/kcwu","followers_url":"https://api.github.com/users/kcwu/followers","following_url":"https://api.github.com/users/kcwu/following{/other_user}","gists_url":"https://api.github.com/users/kcwu/gists{/gist_id}","starred_url":"https://api.github.com/users/kcwu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kcwu/subscriptions","organizations_url":"https://api.github.com/users/kcwu/orgs","repos_url":"https://api.github.com/users/kcwu/repos","events_url":"https://api.github.com/users/kcwu/events{/privacy}","received_events_url":"https://api.github.com/users/kcwu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-09T09:59:44Z","updated_at":"2015-04-10T04:10:28Z","closed_at":null,"body":"Sorry this is not a real issue. There is no forum for this project, I don't know better way to talk to you ;)\r\n\r\nFYI, I wrote 2048 ai last year, too. https://github.com/kcwu/2048-c\r\nI used many similar ideas and borrowed some from you, so I'd like to share back to you.\r\n\r\nBefore @xificurk's improvement, if patched my program with your original eval function, my program can get better score than your original program. So I think you may be interested in how do I handle search details and optimizations (ignore my eval. xificurk's is better). I have noted the difference in the README file. The major ones you could reuse are:\r\n  * helper minimax search (only consider tile-2) to avoid dead. It can search 20+ steps ahead.\r\n  * Faster bit operations.\r\n  * Cache: use more than one hash table. Fixed size hash table to avoid allocation. Also take 'depth' into consideration.\r\n  * Use 64 bits for score calculation. (32 bits are not enough and may loss some precision)\r\n"},"comment":{"url":"https://api.github.com/repos/nneonneo/2048-ai/issues/comments/91423833","html_url":"https://github.com/nneonneo/2048-ai/issues/35#issuecomment-91423833","issue_url":"https://api.github.com/repos/nneonneo/2048-ai/issues/35","id":91423833,"user":{"login":"kcwu","id":175566,"avatar_url":"https://avatars.githubusercontent.com/u/175566?v=3","gravatar_id":"","url":"https://api.github.com/users/kcwu","html_url":"https://github.com/kcwu","followers_url":"https://api.github.com/users/kcwu/followers","following_url":"https://api.github.com/users/kcwu/following{/other_user}","gists_url":"https://api.github.com/users/kcwu/gists{/gist_id}","starred_url":"https://api.github.com/users/kcwu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kcwu/subscriptions","organizations_url":"https://api.github.com/users/kcwu/orgs","repos_url":"https://api.github.com/users/kcwu/repos","events_url":"https://api.github.com/users/kcwu/events{/privacy}","received_events_url":"https://api.github.com/users/kcwu/received_events","type":"User","site_admin":false},"created_at":"2015-04-10T04:10:28Z","updated_at":"2015-04-10T04:10:28Z","body":"- Only tile-2 in additional search: this is because the possibility of tile-2 is far larger than tile-4. For example, 0.9<sup>20</sup>=0.1215 > 0.1. That means even the possibility of consecutive 20 tile-2 is still higher than one tile-4. Only consider tile-2 makes the helper search faster.\r\n- bit operations: you can try https://github.com/kcwu/2048-c/blob/master/micro_optimize.cc transpose5() used only 12 operations. And count_blank3() is faster than your count_blank1().\r\n- Yes, depth should be taken into account as #34. \r\n- Regarding to multiple hash tables, they are\r\n  + `cache1[]`: a normal one in normal search . used where like yours.\r\n  + `local_cache1[]`: like cache1, but only cached the search path. It cannot cover more than cache1, but it is very lightweight and high hit-rate.\r\n  + `cache2[]`: a hash table for my extra minimax search.\r\n  + `cache3[]`: I have another search extension in eval_reliable(), which is slow and need cache to optimization.\r\n- Board score is almost used up all bits. There is not much rooms for calculating the average score of random drops accurately. (You need several bits to `*0.9`, to `+=` tens scores, to `/ num_open`.) If taken all these into consideration, even 32 bits may not enough. Needless to say 23 bits.\r\n"}}