With machine learning being one of te big things at the moment, I thought I'd cast my mind back to my first ever c programming assignment at university - write the game of Pangolins. The game is based on the 20 Questions game, whereby the user thinks of an object and the machine aims to guess that object by asking simple yes/no style questions - ideally less than 20. the system starts off by knowing about only a single object - a small ant-eating mammal called a Pangolin.
Each time a user thinks of something the system isn't aware of, it learns from this. The internal implementation of this is just a simple set of nodes, which can either be a question, or an object. A question node has two pointers to a yes and a no node. It's probably easiest to illustrate with a walkthough. I created a little demo app which can be accessed here on apex.oracle.com. The sample code to create can be found at the bottom of this post.
We start off with a single entry - and we are therefore asked "are you thinking of a Pangolin"?
So assume we were actually thinking of a pencil, so we say no. The system then asks us what were we actually thinking of. Let's tell it so.
Next we are asked to give a yes/no question that will distinguish between a pencil and a pangolin.
And clearly the answer for that is No.