{"id":455,"date":"2015-03-29T21:37:03","date_gmt":"2015-03-29T20:37:03","guid":{"rendered":"http:\/\/neurons.dk\/?p=455"},"modified":"2015-04-12T22:18:34","modified_gmt":"2015-04-12T20:18:34","slug":"building-an-ai-the-laws-of-10-000-part-1","status":"publish","type":"post","link":"http:\/\/neurons.dk\/?p=455","title":{"rendered":"Building an AI (part 1)"},"content":{"rendered":"<p>Hi again,<\/p>\n<p>After being in hiatus for quite some time I&#8217;ve gotten back to programming a bit. I guess there is an ebb and flow with everything.<\/p>\n<p>Back in November I was looking into how I could be <a title=\"Building an AI with ASyncTask\" href=\"http:\/\/neurons.dk\/?p=248\" target=\"_blank\">Building an AI with ASyncTask<\/a>, but I never got to feed the thing some rules with regards to how to play the game. This I aim to remedy now. Since this could get pretty lengthy I&#8217;m planning a short series as I go though the process of building an AI for the dice game &#8220;10.000&#8221;.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Choosing a method for problem solving<\/strong><\/p>\n<p>Building an AI can be done in different ways. I haven&#8217;t explored the topic that much, but I could see going about problem solving in different ways; neural networks or some other kinds of fuzzy logic, search algorithms or a basic <a title=\"Wikipedia article on Heuristic\" href=\"http:\/\/en.wikipedia.org\/wiki\/Heuristic_%28computer_science%29\" target=\"_blank\">heuristic<\/a>. I do however have some programming experience with heuristics and I believe that, since we&#8217;re talking about a limited problem space like this a heuristic can do the job just fine.<\/p>\n<p>One of the issues at hand is whether or not we want to get the optimal solution i.e. winning as fast as possible. I can see an argument for building an AI that can do this, but I don&#8217;t think it would be very fun to play against. The probability built into the game somewhat remedies this, but the AI should strike a balance between being challenging to play against and still being beatable. Another plus for using a heuristic is that they can be made to give us an answer in short time consistently, thus giving the user a better experience.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>A basic set of rules<br \/>\n<\/strong><\/p>\n<p>When implementing the heuristic I need to come up with some rules that it will consist of. In principle I want the AI mimics the process of a human player asking himself a set of questions at every decision point during his turn and answering them based on a predefined logic (as humans we have the advantage of being able to adjust our evaluation during a game, whereas my AI will have a fixed set of rules).<\/p>\n<p>Questions you could be asking yourself?<\/p>\n<ul>\n<li>What is the probability of being able to make points with X dices?<\/li>\n<li>What is the reward for rolling the dices?<\/li>\n<li>What is the risk for rolling the dices?<\/li>\n<li>Is it the last round and do I have the most points?<\/li>\n<\/ul>\n<p>Joining these together my heuristic becomes:<\/p>\n<p><em>Rule A)<\/em> If my chance of success times the reward for rolling the dices is bigger than the chance of failure times the risk, then roll the dice. Otherwise bank the points (if able)<\/p>\n<p><em>Rule B)<\/em> If it is the last round and I haven&#8217;t got the most points, then keep rolling.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>What remains to be done?<\/strong><\/p>\n<p>For now I&#8217;ve established a basic set of rules. To determine whether or not the AI should keep rolling I need to feed some numbers into rule A. These numbers I&#8217;ll try and calculate in my next post using statistical analysis.<\/p>\n<p>&nbsp;<\/p>\n<p>That&#8217;s it for now \ud83d\ude42<\/p>\n<p>&nbsp;<\/p>\n<p>EDIT: To read part 2 go <a title=\"Building an AI (part 2)\" href=\"http:\/\/neurons.dk\/?p=476\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi again, After being in hiatus for quite some time I&#8217;ve gotten back to programming a bit. I guess there is an ebb and flow with everything. Back in November I was looking into how I could be Building an &hellip; <a href=\"http:\/\/neurons.dk\/?p=455\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,6],"tags":[8,9,38],"class_list":["post-455","post","type-post","status-publish","format-standard","hentry","category-games","category-tech","tag-10-000","tag-ai","tag-heuristic"],"_links":{"self":[{"href":"http:\/\/neurons.dk\/index.php?rest_route=\/wp\/v2\/posts\/455"}],"collection":[{"href":"http:\/\/neurons.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/neurons.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/neurons.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/neurons.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=455"}],"version-history":[{"count":16,"href":"http:\/\/neurons.dk\/index.php?rest_route=\/wp\/v2\/posts\/455\/revisions"}],"predecessor-version":[{"id":495,"href":"http:\/\/neurons.dk\/index.php?rest_route=\/wp\/v2\/posts\/455\/revisions\/495"}],"wp:attachment":[{"href":"http:\/\/neurons.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/neurons.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=455"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/neurons.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}