{"assets":[],"author_link":"author\/cpowell\/","author_name":"cpowell","cat":"LD #26","categories":["LD #26"],"comments":[],"epoch":1372327140,"event":"LD26","likes":4,"metadata":{"p_key":"80735","p_author":"cpowell","p_authorkey":"0","p_urlkey":"289852","p_title":"Fuzzy logic \u201cFuzzy Associative Memory\u201d Ruby gem released","p_cat":"LD #26","p_event":"LD26","p_time":"1372327140","p_likes":"4","p_comments":"0","p_status":"WAYBACK","us_key":null,"us_name":null,"us_username":null,"event_start":"1366934400","event_key":"16","event_name":"LD26"},"source_url":"2013\/06\/27\/ruby-fuzzy-logic-fuzzy-associative-memory-gem-released\/","text":"<p>A Fuzzy Associative Memory (FAM for short) is a Fuzzy Logic tool for decision making. Fuzzy logic FAMs are highly applicable in Game AI.<\/p>\n<p>A Fuzzy Associative Memory uses Fuzzy Sets to establish a set of linguistic rules , e.g.:<\/p>\n<ul>\n<li>\u201cIf the orc\u2019s hit points are a little low, retreat from the enemy\u201d<\/li>\n<li>\u201cIf the enemy is distant and my rocket ammo is low, the rocket launcher is a poor choice\u201d<\/li>\n<li>\u201cIf the enemy is near and my shotgun ammo is okay, the shotgun is a very desirable choice\u201d<\/li>\n<li>\u201cIf the ship is off course by a little bit, correct just a little to the right\u201d<\/li>\n<li>\u201cIf the bird is much slower than the flock, speed it up a lot\u201d<\/li>\n<\/ul>\n<p>The linguistic rules, and the fuzzy sets they contain, are defined by a human \u201cexpert\u201d (presumably, you). That is to say, the rules\u00a0<em>codify intelligence<\/em>\u00a0and map this knowledge from the human domain to the digital.<\/p>\n<p>After the rules are defined, a FAM is consulted to help your AI make a descision:<\/p>\n<ul>\n<li>The orc retreats, attacks, strafes.<\/li>\n<li>The ship launches long range missiles or fires short range guns.<\/li>\n<li>The control rods are lowered into the reactor or raised out of it.<\/li>\n<\/ul>\n<p>As you can see, the fuzzy rules are deliberately vague and use qualifiers like \u201ca little\u201d and \u201ca lot\u201d. Furthermore, the lines between fuzzy sets are intentionally blurry. This is the nature of fuzzy sets; they capture such human fuzziness in a way that extracts highly natural behavior from the fuzzy rules. When defining these rules, it helps to imagine interviewing a bona fide expert in the domain and writing down the skills necessary to be successful in the domain.<\/p>\n<p>Learn more, and get the Ruby Gem for your own game:<\/p>\n<p><a href=\"https:\/\/github.com\/cpowell\/fuzzy-associative-memory\">https:\/\/github.com\/cpowell\/fuzzy-associative-memory<\/a><\/p>\n<h2><a href=\"https:\/\/github.com\/cpowell\/fuzzy-associative-memory#how-it-works\" name=\"how-it-works\"><\/a><\/h2>\n<p>Tags: <a href=\"http:\/\/ludumdare.com\/compo\/tag\/ai\/\" rel=\"tag\">AI<\/a>, <a href=\"http:\/\/ludumdare.com\/compo\/tag\/artificial-intelligence\/\" rel=\"tag\">artificial intelligence<\/a>, <a href=\"http:\/\/ludumdare.com\/compo\/tag\/fuzzy\/\" rel=\"tag\">fuzzy<\/a>, <a href=\"http:\/\/ludumdare.com\/compo\/tag\/ruby\/\" rel=\"tag\">ruby<\/a><\/p>","time":"June 27th, 2013 9:59 am","title":"Fuzzy logic \u201cFuzzy Associative Memory\u201d Ruby gem released","title_was_empty":false}