{"id":233,"date":"2012-05-28T16:18:19","date_gmt":"2012-05-28T14:18:19","guid":{"rendered":"https:\/\/herr-rau.de\/blogs\/inform\/?page_id=233"},"modified":"2012-06-09T11:02:42","modified_gmt":"2012-06-09T09:02:42","slug":"aktionen-4-neue-aktionen-ein-besserer-wuerfel","status":"publish","type":"page","link":"https:\/\/herr-rau.de\/blogs\/inform\/?page_id=233","title":{"rendered":"Aktionen 4 &#8211; Neue Aktionen (Ein besserer W\u00fcrfel)"},"content":{"rendered":"<p>Ein paar Sachen an unserem W\u00fcrfel sind noch unbefriedigend. Man kann zwar mit &#8220;take dice&#8221; alle vorhandenen W\u00fcrfel nehmen, aber bei &#8220;roll dice&#8221; erhalten wir die Fehlermeldung &#8220;You can&#8217;t use multiple objects with that verb&#8221; &#8211; man kann also immer nur einen W\u00fcrfel auf einmal rollen.<\/p>\n<p>Das liegt an unserer Definition, die dem Parser sagt, dass die Aktion jeweils immer nur auf Objekte angewendet werden darf: <\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">\r\nUnderstand &quot;roll &#x5B;something]&quot; as rolling.\r\n<\/pre>\n<p>Wenn wir stattdessen schreiben:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">\r\nUnderstand &quot;roll &#x5B;things]&quot; as rolling.\r\n<\/pre>\n<p>&#8211; dann kann man auch gleich mehrere W\u00fcrfel auf einmal werfen. Allerdings: die Aktion <code>rolling<\/code> gilt immer noch f\u00fcr genau ein Objekt auf einmal, wir k\u00f6nnen das f\u00fcr mehrere Objekte jetzt nur abk\u00fcrzen:<\/p>\n<blockquote><p><code>>roll dice<br \/>\ngreen die: You roll the green die. When it comes to rest on the ground, it shows a 5.<br \/>\nred die: You roll the red die. When it comes to rest on the ground, it shows a 3.<br \/>\n<\/code><\/p><\/blockquote>\n<hr\/>\n<p>Au\u00dferdem st\u00f6rt noch, dass wir nur einmal als Textausgabe erfahren, welche Zahl ein W\u00fcrfel zeigt. Man m\u00f6chte das aber doch zwischendurch auch mal nachschauen k\u00f6nnen. Dazu haben wir mehrere M\u00f6glichkeiten.<\/p>\n<p>&#8212; Entweder wir fangen die Examine-Regel, W\u00fcrfel betreffend, ab und ersetzen sie durch unsere eigene Regel:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">Instead of examining a die:\r\n\tSay &quot;&#x5B;the description of the noun] Currently, the die shows a &#x5B;face of the noun].&quot;\r\n<\/pre>\n<p>Wenn der Beschreibungs-String allerdings leer ist, h\u00e4tten wir ein unsch\u00f6nes Leerzeichen am Anfang des Wortes, also schreiben wir gr\u00fcndlicher:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">Instead of examining a 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 die shows a &#x5B;face].&quot;\r\n<\/pre>\n<p><code>The noun<\/code> bezieht sich wieder auf das direkte Objekt der Regel, [the description] und [the face] sind Attribute davon. Wenn der Kontekt klar ist, kann man das <code>of the noun<\/code> auch weglassen; daas ginge hier problemlos.<\/p>\n<p>&#8212; Oder wir erg\u00e4nzen eine After-Examining-Regel, W\u00fcrfel betreffend:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">After examining a die:\r\n\tSay &quot;Currently, the die shows a &#x5B;face].&quot;\r\n<\/pre>\n<p>Da gef\u00e4llt mir dann allerdings die Ausgabe nicht so gut.<\/p>\n<p>&#8212; Dritte M\u00f6glichkeit: wir passen das Beschreibungs-Attribut eines W\u00fcrfels an, so dass zur Beschreibung auch die aktuell gew\u00fcrfelte Zahl geh\u00f6rt. Wir schreiben einfach:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">The description of the green die is &quot;A beautiful jade die. Possibly quite valuable. Currently, it shows a &#x5B;face].&quot;<\/pre>\n<p>Unsch\u00f6n daran ist, dass man das f\u00fcr jeden W\u00fcrfel extra machen muss. Klar kann man f\u00fcr alle W\u00fcrfel bei der Klassendefinition festlegen:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">The description usually is &quot;Currently, it shows a &#x5B;face].&quot;<\/pre>\n<p>Aber dann hat man nicht mehr die M\u00f6glichkeit, den W\u00fcrfeln eine weitere Beschreibung zu geben, die nichts mit der Zahl zu tun hat. Andererseits wiederum k\u00f6nnte man der Klasse W\u00fcrfel ein weiteres Textattribut hinzuf\u00fcgen:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">A die has a text called the other description.  The other description usually is &quot;A simple cube.&quot;\r\nThe description of a die is usually &quot;&#x5B;the other description]  Currently, it shows a &#x5B;face].&quot;\r\n<\/pre>\n<p>Wenn man dann seine Objekte so anlegt:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">\r\nThe green die is a die in the Casino. The other description is &quot;A beautiful jade die. Possibly quite valuable.&quot;\r\n<\/pre>\n<p>wird daraus das urspr\u00fcngliche Attribut <code>description<\/code> so belegt, dass es eine Nennung der aktuelle W\u00fcrfelzahl enth\u00e4lt.<\/p>\n<p>&#8212; Und zuletzt bleibt die M\u00f6glichkeit, alle W\u00fcrfel prinzipiell gleich aussehen zu lassen, indem man in der Klasse den Wert des Beschreibungsattributs festlegt:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">\r\nThe description always is &quot;The &#x5B;printed name] is a &#x5B;side number in words]-sided die. Currently, it shows a &#x5B;face].&quot; \r\n<\/pre>\n<p>Aber ich bleibe hier bei meiner ersten L\u00f6sung:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">\r\n&quot;Dice 2&quot; by Herr Rau\r\n\r\nChapter 1 - New 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\n&#x5B;Alternative mit zus\u00e4tzlichem Attribut:]\r\n\r\n&#x5B;A die has a text called the other description.  The other description usually is &quot;A simple cube.&quot;\r\nThe description of a die is usually &quot;&#x5B;the other description] Currently, it shows a &#x5B;face].&quot;]\r\n\r\nChapter 2 - New Actions\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\tNow the face of the noun is a random number from 1 to the side number of 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 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 die shows a &#x5B;face].&quot;\r\n\r\n&#x5B;Alternative mit After-Regel:]\r\n\r\n&#x5B;\r\nAfter examining a die:\r\n\tSay &quot;Currently, the die shows a &#x5B;face].&quot;\r\n]\t\r\n\r\nChapter 3 - The World\r\n\r\nThe Casino is a room.\r\n&#x5B;Nur f\u00fcr Alternative:]\r\n&#x5B;The green die is a die in the Casino. The other description is &quot;A beautiful jade die. Possibly quite valuable.&quot;]\r\nThe green die is a 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;Take dice \/ roll dice  \/ examine red die \/ examine green die.&quot;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Ein paar Sachen an unserem W\u00fcrfel sind noch unbefriedigend. Man kann zwar mit &#8220;take dice&#8221; alle vorhandenen W\u00fcrfel nehmen, aber bei &#8220;roll dice&#8221; erhalten wir die Fehlermeldung &#8220;You can&#8217;t use multiple objects with that verb&#8221; &#8211; man kann also immer &hellip; <a href=\"https:\/\/herr-rau.de\/blogs\/inform\/?page_id=233\">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-233","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/pages\/233","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=233"}],"version-history":[{"count":0,"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/pages\/233\/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=233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}