Page 131 -
P. 131

243_MasterPieces_02b.qxd  4/18/03  6:59 PM  Page 103




                                                                      The Learning Brick Sorter • Masterpiece 2  103



                    efficient in this task. Can you improve the UpdateKnowledgeBase() routine to take max-
                    imum advantage from the feedback provided by the user?


                     NOTE

                         When updating the knowledge base with a new data that contradicts the infor-
                         mation previously stored, some cells need to be assigned to KB_UNKNOWN.




                        Another possible extension to the software is making it able to place more than a
                    single color in the same bin. For example, it could handle the case where you have five
                    different colors and three bins, and two pairs of colors share a common bin.This requires
                    that the knowledge base have more rows than columns, that is more ranges than bins.
                    However, changing the constants BINS and RANGES is not enough: you have to modify
                    the UpdateKnowledgeBase() routine, because the assumption that when a color is assigned
                    to a bin the others cannot use that bin is no more valid.
                        If you are a teacher and use this project for some classroom work, you can assign
                    some theoretical analysis of the algorithm. For example, you can ask them to discover
                    what’s the shortest sequence that makes the knowledge base complete in the luckiest case,
                    and what’s the longest sequence in the worst case.


                    Summary

                    As you discovered in the chapter, the apparently trivial brick sorting application offered
                    many arguments for discussion and investigation.
                        A few tricks we used can prove useful for other robots and other situations.The posi-
                    tion tracking system of my Learning Brick Sorter — built around a touch sensor and a
                    pulley — not only avoids the missed-counts problem which affect the rotation sensors,
                    but shows a general solution to emulate a rotation sensor when you don’t have one. We
                    have also seen a practical application of the well-known trick of connecting a light sensor
                    and a touch sensor together on the same input port, thus expanding the possibilities of
                    our RCX.
                        While developing the software, we have explored a few programming techniques. For
                    example, how to emulate a bi-dimensional array over a mono-dimensional one, and more
                    generally, how to  write a solid program that can handle any possible situation and is easy
                    to understand and maintain. We also had a quick look at trivalent logic, something dif-
                    ferent from the more common Boolean logic based on the true/false values, but a pow-
                    erful tool when facing problems that contain some degree of indetermination.
                        More importantly, my Learning Brick Sorter lets you enter the world of machines
                    that learn.Although the software of the Learning Brick Sorter is very simple compared to
                    most actual AI programs, it nevertheless has merit and provides some insight that doesn’t
                    require the reader to have strong technical competence in this field already.
   126   127   128   129   130   131   132   133   134   135   136