{"id":252,"date":"2018-05-07T12:00:49","date_gmt":"2018-05-07T19:00:49","guid":{"rendered":"http:\/\/letsbuildroboticswithshadow8472.com\/?p=252"},"modified":"2018-05-04T12:35:58","modified_gmt":"2018-05-04T19:35:58","slug":"incompetent-rudimentary-functions","status":"publish","type":"post","link":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2018\/05\/07\/incompetent-rudimentary-functions\/","title":{"rendered":"Incompetent Rudimentary Functions"},"content":{"rendered":"<p>Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am reviewing my progress with programming a ComputerCraft Turtle to craft like items together for repair purposes. Let&#8217;s get started.<\/p>\n<p>The program I spent my week putting together is supposed to:<br \/>\n1. Make sure its environment is good.<br \/>\n2. Ensure it is working with matching, non-stackable items with durability.<br \/>\n3. Reject items that don&#8217;t work.<br \/>\n4. Craft valid items together.<br \/>\n5. Accept like new items once they are mended.<br \/>\n6. Be able to handle being unloaded and restarted from any state.<\/p>\n<p>I started out with my code, building up the lower level bits and moving on to the higher lever functionality. Whenever I had a question on how something was supposed to work, I quickly made a tiny program on another computer to test the syntax or output format.<\/p>\n<p>I designed my virtual workstation around this philosophy, and ended up with a main computer with a large screen on one side for viewing code at once, and a disk drive on the other where I save all my programs. Other computers, almost always turtles (robots), can also access the disk drive, and since I can&#8217;t properly test my turtle program on anything but a turtle, I end up saving my program from the larger terminal and testing it on a turtle attached to &#8220;A_drive&#8221; (Named for the in-game representation of a floppy disk drive). Later in the debug phase, I ended up building an even bigger monitor and using a network cable. I logged another avatar in and pulled the keyboard over so I could edit with a little more area than the advanced computer.<\/p>\n<p>As I went, I had new ideas on how to do things, and do them better. But toward the end, those ideas were a little too low level to implement, so I just shelved them. Bug testing is important, especially when your program is intended for deployment on a fleet of identical systems and you don&#8217;t have an &#8220;update all&#8221; option. I eventually finished my program and started bug testing. An attempt to call nil proved to be a typo in a function name, in this case a lower case &#8216;i&#8217; as in getitem() where the function was named in camel case: getItem().<\/p>\n<p>One of the methods of making a good program is doing it over again once you&#8217;ve finished it. I learned that lesson when another bug popped up where it shouldn&#8217;t have. It turns out the function, turtle.craft(), needs a little more babysitting than I gave it credit for. I never really understood this low-level function, but knew it could pull off amazing feats if controlled properly. The documentation said it could craft any item as if on a regular crafting table, but extra items present in the recipe were okay. I understood my bug when I made a tiny test program to tell me if things could be crafted at that moment or not. The turtles&#8217; inventory is a 4&#215;4 grid and a crafting table is 3&#215;3. But turtle.craft() apparently doesn&#8217;t like it when things in the inventory can&#8217;t be fit into the crafting table&#8217;s smaller area when is called to try and craft something.<\/p>\n<p>The next step is to reprogram what I already have, as stated above. This time, though, I want to have that tighter leash on turtle.craft(). While I&#8217;m at it, I intend to implement a low-level error code to make maintenance of the system a little easier.<\/p>\n<p>Final Question: This LootRepair program is the most complex program in the suite of programs for my mob farm automation. What features should I include in a future release if I ever publish this program?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am reviewing my progress with programming a ComputerCraft Turtle to craft like items together for repair purposes. Let&#8217;s get started. The program I spent my week putting together is supposed to: 1. Make sure its environment is good. 2. Ensure it is working &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2018\/05\/07\/incompetent-rudimentary-functions\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Incompetent Rudimentary Functions&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[10,9],"tags":[],"class_list":["post-252","post","type-post","status-publish","format-standard","hentry","category-minecraft","category-programming"],"_links":{"self":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/252","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/comments?post=252"}],"version-history":[{"count":2,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/252\/revisions"}],"predecessor-version":[{"id":254,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/252\/revisions\/254"}],"wp:attachment":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/media?parent=252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/categories?post=252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/tags?post=252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}