{"id":234,"date":"2012-05-28T21:37:07","date_gmt":"2012-05-28T19:37:07","guid":{"rendered":"https:\/\/herr-rau.de\/blogs\/inform\/?page_id=234"},"modified":"2012-06-09T11:03:01","modified_gmt":"2012-06-09T09:03:01","slug":"aktionen-5-neue-aktionen-ein-letzter-wuerfel","status":"publish","type":"page","link":"https:\/\/herr-rau.de\/blogs\/inform\/?page_id=234","title":{"rendered":"Aktionen 5 &#8211; Neue Aktionen (Ein letzter W\u00fcrfel)"},"content":{"rendered":"<p>Okay. Wenn man den W\u00fcrfel anschaut, erf\u00e4hrt man, welche Zahl oben liegt. Wenn man den W\u00fcrfel wirft, landet eine neue Zahl oben. Unsch\u00f6n ist noch, dass a) diese Zahl sich nicht \u00e4ndert, auch wenn wir den W\u00fcrfel fallen lassen oder werfen, sondern nur beim W\u00fcrfeln, und b) der W\u00fcrfel immer eine sichtbare Zahl als oben liegend zeigt, auch wenn wir den W\u00fcrfel zum Beispiel in der Jacke herumtragen. Da sollte man nicht davon sprechen k\u00f6nnen, dass eine Zahl oben ist.<\/p>\n<hr\/>\n<p>Problem a) kann man l\u00f6sen, indem man das Fallenlassen eines W\u00fcrfels abf\u00e4ngt und ihn vorher heimlich leise mit unserer neuen Aktion w\u00fcrfelt:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">Instead of dropping a die:\r\n\tsilently try rolling the noun;\r\n\tsay &quot;Dropped.&quot;<\/pre>\n<p>&#8220;Try&#8221; deshalb, weil die Aktion ja aus anderen Gr\u00fcnden immer schiefgehen kann, und weil das grammatisch sch\u00f6n zur ing-Form passt. &#8220;Silently&#8221; deshalb, beim W\u00fcrfeln ja eigentlich auch Text ausgegeben wird, das wollen wir hier aber gar nicht. Der Textausgabeteil des W\u00fcrfelns interessiert uns hier gar nicht, der W\u00fcrfel soll einfach auf dem Boden landen und seine Zahl \u00e4ndern und das war es.<\/p>\n<p>Das geht so aber noch eleganter. Anstatt der Codezeilen oben schreiben wir:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">\r\nAfter dropping a die:\r\n\troll the noun;\r\n\tcontinue the action.\r\n<\/pre>\n<p><em>Nach<\/em> dem regul\u00e4ren Ausf\u00fchren des Fallenlassens, aber vor dessen \u00fcblicher Textausgabe, soll der W\u00fcrfel gerollt werden. Erst danach geht es mit der \u00fcblichen Textausgabe weiter, also &#8220;Dropped.&#8221;<\/p>\n<p>Dieses <code>roll<\/code> + direktes Objekt ist etwas Neues, eine selbst geschriebene Funktion. Die brauchen wir nat\u00fcrlich auch:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">\r\nTo roll (x - a die):\r\n\tnow the face of x is a random number from 1 to the side number of x.\r\n<\/pre>\n<p>Damit k\u00f6nnen wir dann auch unsere Carry-out-rolling-Regel versch\u00f6nern:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">\r\nCarry out rolling:\r\n\troll the noun;\r\n\tnow the noun is in the location of the player.<\/pre>\n<p>Eine Methode ist ja vor allem dann sinnvoll, wenn man sie gleich mehrfach einsetzt. Wann soll sich die W\u00fcrfelzahl denn noch \u00e4ndern?<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">\r\nAfter taking, dropping, pushing or turning a die:\r\n\troll the noun;\r\n\tcontinue the action.\r\n<\/pre>\n<p>Das geht nat\u00fcrlich nur, weil wir uns die Methode <code>roll (x - a die)<\/code> selbst geschrieben haben.<\/p>\n<hr\/>\n<p>Wir legen f\u00fcr Problem b) mal fest, dass ein W\u00fcrfel nur dann eine Zahl oben hat, wenn man ihn nicht mit sich f\u00fchrt. Deshalb erg\u00e4nzen wir unsere Examine-Regel etwas:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">Instead of examining a die:\r\n\tIf the noun is enclosed by the player:\r\n\t\tcontinue the action;\r\n\totherwise:\r\n\t\tIf the description of the noun is not &quot;&quot;:\r\n\t\t\tSay the description of the noun;\r\n\t\t\tSay &quot; &quot;;\r\n\t\tSay  &quot;Currently, the &#x5B;side number in words]-faced die shows a &#x5B;face].&quot;\r\n<\/pre>\n<p>Dann kriegen wir immer, wenn wir den W\u00fcrfel bei uns haben (unmittelbar oder in einem Beh\u00e4lter, den wir haben) die kurze Antwort ohne Nennung der Zahl, und wenn der W\u00fcrfel anderswo ist, kriegen wir die Zahl gesagt.<\/p>\n<p>Das ging nat\u00fcrlich auch \u00fcber ein zus\u00e4tzliches Attribut des W\u00fcrfels. Den Attributwert m\u00fcsste man immer anpassen, und sich in der Examine-Regel darauf beziehen.<br \/>\nOder man definiert ein Adjektiv (quasi eine boolesche Funktion): <\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">Definition: A die is resting if it is not enclosed by the player.<\/pre>\n<p>Dann k\u00f6nnen wir unsere Examine-Regel wieder vereinfachen:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">\r\nInstead of examining a resting die:\r\n\tIf the description of the noun is not &quot;&quot;:\r\n\t\tSay the description of the noun;\r\n\t\tSay &quot; &quot;;\r\n\tSay  &quot;Currently, the &#x5B;side number in words]-faced die shows a &#x5B;face].&quot;<\/pre>\n<p>Unsere Ausnahmeregel gilt nur f\u00fcr W\u00fcrfel, die <em>resting<\/em> sind, die anderen werden regul\u00e4r beschrieben.<\/p>\n<hr\/>\n<p>Au\u00dferdem brauchen wir noch zehnseitige W\u00fcrfel.<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">A ten-sided die is a kind of die. The side number is always 10.\r\n<\/pre>\n<hr\/>\n<p>Der fertige Code:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">\r\n&quot;Dice 3&quot; by Herr Rau\r\n\r\nChapter 1 - Kinds\r\n\r\nA die is a kind of thing.\r\nIt has a number called side number. The side number is usually 6.\r\nIt has a number called face. The face is usually 1.\r\nUnderstand &quot;dice&quot; as the plural of die.\r\n\r\nA ten-sided die is a kind of die. The side number is always 10.\r\n\r\nChapter 2 - Actions &amp; Methods\r\n\r\nRolling is an action applying to one carried thing and requiring light.\r\n\r\nUnderstand &quot;roll &#x5B;things]&quot; as rolling.\r\nUnderstand &quot;shake &#x5B;things]&quot; as rolling.\r\n\r\nCheck rolling:\r\n\tIf the noun is not a die, say &quot;You can do that with dice only.&quot; instead.\r\nCarry out rolling:\r\n\troll the noun;\r\n\tnow the noun is in the location of the player.\r\nReport rolling:\r\n\tSay &quot;You roll &#x5B;the noun]. When it comes to rest on the ground, it shows a &#x5B;face].&quot;\r\n\r\nInstead of examining a resting die:\r\n\tIf the description of the noun is not &quot;&quot;:\r\n\t\tSay the description of the noun;\r\n\t\tSay &quot; &quot;;\r\n\tSay  &quot;Currently, the &#x5B;side number in words]-faced die shows a &#x5B;face].&quot;\r\n\r\nAfter taking, dropping, pushing or turning a die:\r\n\troll the noun;\r\n\tcontinue the action.\r\n\r\nTo roll (x - a die):\r\n\tnow the face of x is a random number from 1 to the side number of x.\r\n\r\nDefinition: A die is resting if it is not enclosed by the player.\r\n\r\nChapter 3 - The World\r\n\r\nThe Casino is a room.\r\nThe green die is a ten-sided die in the Casino. The description is &quot;A beautiful jade die. Possibly quite valuable.&quot;\r\nThe red die is a die in the Casino. The description is &quot;A perfect plastic cube, sharp-edged with white dots.&quot;\r\nThe basket is a container in the Casino.\r\n\r\nTest me with &quot;x green die \/ take dice \/ x green die \/ roll green die \/ x green die \/ put red die in basket \/ x red die \/ take basket \/x red die.&quot;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Okay. Wenn man den W\u00fcrfel anschaut, erf\u00e4hrt man, welche Zahl oben liegt. Wenn man den W\u00fcrfel wirft, landet eine neue Zahl oben. Unsch\u00f6n ist noch, dass a) diese Zahl sich nicht \u00e4ndert, auch wenn wir den W\u00fcrfel fallen lassen oder &hellip; <a href=\"https:\/\/herr-rau.de\/blogs\/inform\/?page_id=234\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":148,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-234","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/pages\/234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=234"}],"version-history":[{"count":0,"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/pages\/234\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/pages\/148"}],"wp:attachment":[{"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}