<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel rdf:about="https://community.wolfram.com">
    <title>Community RSS Feed</title>
    <link>https://community.wolfram.com</link>
    <description>RSS Feed for Wolfram Community showing any discussions tagged with Game Development sorted by most replies.</description>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2445356" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/478669" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/974303" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/870698" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1731686" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2435403" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1214169" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2420295" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1032663" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/307516" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2983903" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2552665" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2417276" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2164714" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/596537" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1380021" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/587562" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/328726" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3092013" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2413178" />
      </rdf:Seq>
    </items>
  </channel>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2445356">
    <title>A Wolfram Language facsimile of Wordle</title>
    <link>https://community.wolfram.com/groups/-/m/t/2445356</link>
    <description>![enter image description here][1]&#xD;
&#xD;
The popular game Wordle can take up a lot of your time.  The author designed it so that it you can only play it once a day, thus saving us from ourselves :-).&#xD;
&#xD;
[Wordle][2]&#xD;
&#xD;
[NYTimes article on Wordle][3]&#xD;
&#xD;
But I couldn&amp;#039;t resist the challenge to create a version of it in Mathematica, just for fun and because I was bored this past weekend. &#xD;
&#xD;
See the attached notebook and enjoy.  Alas, since you can run it any number of times you are only to blame for yourself it you spend too much time on it. &#xD;
&#xD;
After executing the notebook just execute &#xD;
&#xD;
    MWordle[Deploy]&#xD;
&#xD;
to bring up the game.&#xD;
&#xD;
A few additional comments.  The notebook MWordle.nb has the option&#xD;
&#xD;
AutoGeneratedPackage -&amp;gt; Automatic&#xD;
&#xD;
which causes it, when saved, to create an MWordle.m package file in its same directory. &#xD;
&#xD;
The code in MWordle.nb is set up as a package with the context MWordle`Mwordle`&#xD;
&#xD;
If you want to set things up so that the package gets loaded and the MWordle game is automatically launched, do the following.&#xD;
&#xD;
Create a directory MWordleGame on your disk  (The name MWordleGame can actually be whatever you wish.)  And in the MWordleGame directory create a new directory called MWordle.  (This name must be exactly that so that the MWordle`Mwordle` Context is property respected.)  Put the MWordle.nb notebook in the MWordle dierectory, open it in Mathematica and save it so that the MWordle.m file is created in the MWordle directory.  Then you can close the MWordle.nb notebook.&#xD;
&#xD;
Now in your MWordleGame directory save a new notebook -- you can call it whatever you wish, but something like LaunchMwordle.nb is a sensible choice.&#xD;
&#xD;
In that notebook create a button with the following command:&#xD;
&#xD;
&#xD;
    CellPrint[TextCell[Button[&amp;#034;Launch MWordle&amp;#034;,&#xD;
       Monitor[&#xD;
        If[! MemberQ[$Path, NotebookDirectory[]], &#xD;
         AppendTo[$Path, NotebookDirectory[]]];&#xD;
        Needs[&amp;#034;MWordle`MWordle`&amp;#034;]; MWordle`MWordle`MWordle[Deploy],&#xD;
        Row[{ProgressIndicator[Appearance -&amp;gt; &amp;#034;Necklace&amp;#034;, &#xD;
           ImageSize -&amp;gt; Small], Spacer[5], &#xD;
          Style[&amp;#034;Launching MWordle...&amp;#034;, 12, Blue, &#xD;
           FontFamily -&amp;gt; &amp;#034;Arial&amp;#034;]}]],&#xD;
       Method -&amp;gt; &amp;#034;Queued&amp;#034;], &amp;#034;Text&amp;#034;, GeneratedCell -&amp;gt; False, &#xD;
      CellAutoOverwrite -&amp;gt; False]]&#xD;
&#xD;
You now have a button in your LaunchMwordle.nb notebook which you can use any time you want to launch MWordle without having to execute the cells in the MWordle.nb notebook.&#xD;
&#xD;
Download the actual notebook from the link at the end of this post. The following is a version here to read.&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][4]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Wordle.gif&amp;amp;userId=20103&#xD;
  [2]: https://www.powerlanguage.co.uk/wordle/&#xD;
  [3]: https://www.nytimes.com/2022/01/03/technology/wordle-word-game-creator.html&#xD;
  [4]: https://www.wolframcloud.com/obj/08c015e2-0d65-4634-bf54-4b73e518f6d5</description>
    <dc:creator>David Reiss</dc:creator>
    <dc:date>2022-01-13T21:47:44Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/478669">
    <title>Doing a KenKen in Wolfram Language</title>
    <link>https://community.wolfram.com/groups/-/m/t/478669</link>
    <description>Here&amp;#039;s today&amp;#039;s New York Times 4x4 KenKen solved in Mathematica.  The approach is to first construct all possible arrays with different numbers in each row, from that select all arrays that have different numbers in each column, then apply the constraints on various cells.  For this particular example, it was not necessary to apply all the constraints to get the unique answer.  It is necessary to take the absolute value of some difference and ratio constraints, since it the order of the difference or ratio is not known.&#xD;
&#xD;
    Dimensions[p4 = Permutations[Range[4]]]&#xD;
    &#xD;
    Out[1]= {24, 4}&#xD;
    &#xD;
    Dimensions[a1 = Flatten[Outer[List, p4, p4, p4, p4, 1], 3]] &#xD;
    &#xD;
    Out[2]= {331776, 4, 4}&#xD;
    &#xD;
    Dimensions[&#xD;
     a2 = Select[&#xD;
       a1, (And @@ (And @@ Unequal[Sequence @@ #] &amp;amp;) /@ Transpose[#]) &amp;amp;]] &#xD;
    &#xD;
    Out[3]= {576, 4, 4}&#xD;
    &#xD;
    Dimensions[a3 = Select[a2, #[[1, 1]]*#[[1, 2]]*#[[2, 2]] == 12 &amp;amp;]]&#xD;
    &#xD;
    Out[4]= {112, 4, 4}&#xD;
    &#xD;
    Dimensions[a4 = Select[a3, Abs[Log[#[[1, 3]]/#[[1, 4]]]] == Log[2] &amp;amp;]]&#xD;
    &#xD;
    Out[5]= {64, 4, 4}&#xD;
    &#xD;
    In[6]:= Dimensions[&#xD;
     a5 = Select[&#xD;
       a4, #[[2, 1]] + #[[3, 1]] + #[[3, 2]] + #[[4, 1]] == 11 &amp;amp;]]&#xD;
    &#xD;
    Out[6]= {8, 4, 4}&#xD;
    &#xD;
    In[7]:= Dimensions[a6 = Select[a5, Abs[#[[2, 3]] - #[[3, 3]]] == 2 &amp;amp;]]&#xD;
    &#xD;
    Out[7]= {6, 4, 4}&#xD;
    &#xD;
    In[8]:= Dimensions[a7 = Select[a6, #[[2, 4]] == 2 &amp;amp;]]&#xD;
    &#xD;
    Out[8]= {1, 4, 4}&#xD;
    &#xD;
    In[10]:= a7&#xD;
    &#xD;
    Out[10]= {{{1, 3, 2, 4}, {3, 4, 1, 2}, {4, 2, 3, 1}, {2, 1, 4, 3}}}</description>
    <dc:creator>Frank Kampas</dc:creator>
    <dc:date>2015-04-13T20:56:51Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/974303">
    <title>Solving Sudoku as an integer programming problem</title>
    <link>https://community.wolfram.com/groups/-/m/t/974303</link>
    <description>It is fairly straight forward to solve a Sudoku as an integer programming problem, by creating 9 binary variables for each cell, only one of which is one in the solution.  The walk-through below and attached notebook illustrates this for the problem shown.&#xD;
&#xD;
![enter image description here][1]&#xD;
&#xD;
# Implementation &#xD;
&#xD;
 Given values, as `{row, column, value}`&#xD;
&#xD;
    input = {&#xD;
    {1,4,4},{1,5,9},{1,8,5},{2,1,6},{2,5,3},{3,1,4},&#xD;
    {3,2,5},{3,4,6},{3,5,2},{3,7,3},{3,9,7},{4,1,5},&#xD;
    {4,3,2},{4,4,7},{4,7,9},{4,8,8},{5,1,3},{5,3,6},&#xD;
    {5,7,2},{5,9,1},{6,2,9},{6,3,1},{6,6,2},{6,7,6},&#xD;
    {6,9,5},{7,1,2},{7,3,5},{7,5,1},{7,6,4},{7,8,3},&#xD;
    {7,9,8},{8,5,8},{8,9,9},{9,2,1},{9,5,7},{9,6,3}};&#xD;
&#xD;
 Display given values&#xD;
&#xD;
    viewmat = Table[&amp;#034;&amp;#034;, {9}, {9}];    &#xD;
    Do[viewmat[[input[[i, 1]], input[[i, 2]]]] = ToString[input[[i, 3]]], {i, Length[input]}]&#xD;
    Grid[viewmat, Frame -&amp;gt; All]&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
 Variables, as 9 x 9 x 9 matrix&#xD;
&#xD;
    varmat = Table[m[i, j, k], {i, 9}, {j, 9}, {k, 9}];&#xD;
&#xD;
 Variables as a list&#xD;
&#xD;
    vars = Flatten[varmat];&#xD;
&#xD;
 Constrain the input cells to their value&#xD;
&#xD;
    cons1 = (varmat[[Sequence @@ #]] == 1 &amp;amp;) /@ input&#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
 The sum of the binary variables for each cell is 1&#xD;
&#xD;
    cons2 = Flatten @ Table[ (Sum[varmat[[i, j, k]], {k, 9}] == 1), {i, 9}, {j, 9}];&#xD;
&#xD;
 All different constraint for the rows&#xD;
&#xD;
    cons3 = Flatten @ Table[ (Sum[varmat[[i, j, k]], {i, 9}] == 1), {j, 9}, {k, 9}];&#xD;
&#xD;
 All different constraint for the columns&#xD;
&#xD;
    cons4 = Flatten @ Table[ (Sum[varmat[[i, j, k]], {j, 9}] == 1), {i, 9}, {k, 9}];&#xD;
&#xD;
 All different constraint for the submatrices&#xD;
&#xD;
    sm[di_, dj_] := Flatten [Table[{i, j}, {i, 1 + 3*(di - 1), 3*di}, {j, 1 + 3*(dj - 1), 3*dj}],1]&#xD;
    cons5 = Flatten @ Table[(Total[m[Sequence @@ #, k] &amp;amp; /@ sm[i, j]] == 1), {i, 3}, {j, 3}, {k, 9}];&#xD;
&#xD;
 Confine the variables to the range 0 to 1&#xD;
&#xD;
    cons6 = Thread[0 &amp;lt;= vars &amp;lt;= 1];&#xD;
&#xD;
 Combine the constraints&#xD;
&#xD;
    Length[allcons = Join[cons1, cons2, cons3, cons4, cons5, cons6]]&#xD;
&#xD;
`1089`&#xD;
&#xD;
 Solve the problem, specifying that the variables are integers.&#xD;
&#xD;
    AbsoluteTiming[sol = FindMinimum[{0, allcons, Element[vars, Integers]}, vars];]&#xD;
&#xD;
`{0.0946335, Null}`&#xD;
&#xD;
 Find the values for each cell&#xD;
&#xD;
    resmat = Table[Sum[k*m[i, j, k], {k, 9}], {i, 9}, {j, 9}] /. sol[[2]]&#xD;
&#xD;
![enter image description here][4]&#xD;
&#xD;
 Display the input and result&#xD;
&#xD;
    {Grid[viewmat, Frame -&amp;gt; All], Grid[resmat, Frame -&amp;gt; All]}&#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
Check the result &#xD;
&#xD;
    And @@ Table[Unequal[Sequence @@ resmat[[i]]], {i, 9}]&#xD;
&#xD;
`True`&#xD;
&#xD;
    And @@ Table[Unequal[Sequence @@ Transpose[resmat][[i]]], {i, 9}]&#xD;
&#xD;
`True`&#xD;
&#xD;
    And @@ Flatten @ Table[Unequal[resmat[[Sequence @@ #]] &amp;amp; /@ sm[i, j]], {i, 3}, {j, 3}]&#xD;
&#xD;
`True`&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=sukoku_problem.jpg&amp;amp;userId=29126&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=sdsdf4qehtrngfsbdvsd.png&amp;amp;userId=11733&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=sdafq4356y4trett4egqrafzgber.png&amp;amp;userId=11733&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=dfg657q43wregdfsbdg.png&amp;amp;userId=11733&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=afgdfgtyuiytouuyrter24356.png&amp;amp;userId=11733</description>
    <dc:creator>Frank Kampas</dc:creator>
    <dc:date>2016-12-05T14:23:11Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/870698">
    <title>Computationally solving &amp;#034;Easy Cube&amp;#034; and &amp;#034;Soma Cube&amp;#034; games / puzzles</title>
    <link>https://community.wolfram.com/groups/-/m/t/870698</link>
    <description>**Easy Cube** is a reflexion game from Japan. It consists of a set of 7 pieces which are &amp;#034;tetris&amp;#034;-like (each piece is a simple geometrical shape made from 3,4 or 5 cubes), and a collection of 48 problems, where the goal is to use the pieces to fill a given shape (in 2d, or in 3d for the hardest problems). &#xD;
&#xD;
The game box ![enter image description here][1]&#xD;
&#xD;
The 7 pieces ![enter image description here][2]&#xD;
&#xD;
2 examples of problems ![enter image description here][3]&#xD;
&#xD;
It is pleasant to play, with the difficulty slowly increasing whit the hardest problems.  I decided to try to solve it using Mathematica. I did not use any advanced mathematics for this (which anyway I would not know :-)), and I wanted a method general enough so it could solve all the problems without any specific adpatation. I went for a purely random method, where the program places a first piece at random, then try to put a second piece, etc.  When it fails to add a piece after a fixed number of attemps, it simply starts the whole process again. So this program does not learn anything... It just tries many many different possibilities, until it finds a solution !    Using Wolfram language, the code to make it and to vizualize to result was quite simple and effective (I show the code details at the end of this post for people interested). In particular, going from the 2d case to the 3d case needed very small changes only.&#xD;
&#xD;
The two followings animations show the program in action for a 2d problem and a 3d problem&#xD;
![enter image description here][4]  &#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
The number of attempts needed to reach a solution is of course random, and depends on the difficulty of the problem. Typically, it takes between a few hundreds and a few thousands iterations, which takes between a few seconds to 1-2 minutes.   Here a sample of 4 solutions found for a 2d problem :&#xD;
![Sample solutions from a 2d problem][6] &#xD;
&#xD;
And 2 solutions from a 3d problem :&#xD;
![Sample solutions from a 2d problem][7]&#xD;
&#xD;
Finally, I considered it if was possible to use this method to find **all solutions** for a given problem (the number of different solutions is an info given on the description of each problem). In principle, because the method is random, it is not well suited for this (one can never be sure that all solutions have been found). However, since the method is quite fast, I decided to try anyway. For a given problem, I computed 10000 solutions.  Here is a plot of the number of attempts needed for each solution, and a histogram of this:&#xD;
![Number of attempts for 10000 solutions][8]&#xD;
&#xD;
On average, finding a solution to this problem requested 2882 attempts...&#xD;
&#xD;
From the 10000 solutions, one wants only different solutions. This is easily done with the **DeleteDuplicates** command:&#xD;
&#xD;
    SolgridQ26ListMReduced = &#xD;
     DeleteDuplicates@SolgridQ26ListM; Length@SolgridQ26ListMReduced&#xD;
    &#xD;
    362&#xD;
&#xD;
which gives 362 different solutions. However, since this problem geometry has a simple central symmetry, one also want to get rid of &amp;#034;symmetric copies&amp;#034; of the solutions. Defining the symmetry operation as the GsymGrid function, this is again done with a **DeleteDuplicates** command :&#xD;
&#xD;
    SolgridQ26ListMReducedSym = &#xD;
     DeleteDuplicates[&#xD;
      SolgridQ26ListMReduced, #2 == &#xD;
        GSymGrid[#1] &amp;amp;]; Length@SolgridQ26ListMReducedSym&#xD;
    &#xD;
    188&#xD;
&#xD;
which gives 188 unique solutions. This is precisely the number which is given in the problem description ! So the method was able to find all solutions.&#xD;
Here is plot with the 188 solutions:&#xD;
![all solutions][9]&#xD;
&#xD;
----------&#xD;
&#xD;
&#xD;
Details of the code&#xD;
-------------------&#xD;
&#xD;
**Definition of the pieces** (2d case). Each piece is a simple list of the points make the piece. When then construct, for each piece, a list of copies of it with all possible orientations. &#xD;
&#xD;
    Pieces Definitions&#xD;
    PTriangle = {{0, 0}, {0, 1}, {1, 0}};&#xD;
    PSquare = {{0, 0}, {0, 1}, {1, 0}, {1, 1}};&#xD;
    PLine = {{0, 0}, {0, 1}, {0, 2}};&#xD;
    PL = {{0, 0}, {0, 1}, {1, 0}, {2, 0}};&#xD;
    PPodium = {{0, 0}, {0, 1}, {-1, 0}, {1, 0}};&#xD;
    PSnake = {{0, 0}, {0, 1}, {1, 0}, {-1, 1}};&#xD;
    PBulky = {{0, 0}, {1, 0}, {0, 1}, {1, 1}, {-1, 1}};&#xD;
    (* Rotation by angle \[Pi]/2 matrix*)&#xD;
    Mrot = {{0, 1}, {-1, 0}};&#xD;
    (* Reflection by y-axis matrix *)&#xD;
    Mref = {{-1, 0}, {0, 1}};&#xD;
    MUnit = {{1, 0}, {0, 1}};&#xD;
    (*Operators which perform a given number of rotation, and of \&#xD;
    reflection*)&#xD;
    RotatePiece[piece_, n_] := Nest[Mrot.# &amp;amp;, #, n] &amp;amp; /@ piece&#xD;
    ReflectPiece[piece_, n_] := &#xD;
     If[n == 0, (MUnit.#) &amp;amp; /@ piece, (Mref.#) &amp;amp; /@ piece]&#xD;
    Each piece with all the possible orientations&#xD;
    PTriangleAll = {PTriangle, RotatePiece[PTriangle, 1], &#xD;
       RotatePiece[PTriangle, 2], RotatePiece[PTriangle, 3]};&#xD;
    PSquareAll = {PSquare};&#xD;
    PLineAll = {PLine, RotatePiece[PLine, 1]};&#xD;
    PLAll = Module[{PLr = ReflectPiece[PL, 1]}, {PL, RotatePiece[PL, 1], &#xD;
        RotatePiece[PL, 2], RotatePiece[PL, 3], PLr, RotatePiece[PLr, 1], &#xD;
        RotatePiece[PLr, 2], RotatePiece[PLr, 3]}];&#xD;
    PPodiumAll = {PPodium, RotatePiece[PPodium, 1], &#xD;
       RotatePiece[PPodium, 2], RotatePiece[PPodium, 3]};&#xD;
    PSnakeAll = {PSnake, RotatePiece[PSnake, 1], ReflectPiece[PSnake, 1], &#xD;
       RotatePiece[ReflectPiece[PSnake, 1], 1]};&#xD;
    PBulkyAll = &#xD;
      Module[{PBulkyr = ReflectPiece[PBulky, 1]}, {PBulky, &#xD;
        RotatePiece[PBulky, 1], RotatePiece[PBulky, 2], &#xD;
        RotatePiece[PBulky, 3], PBulkyr, RotatePiece[PBulkyr, 1], &#xD;
        RotatePiece[PBulkyr, 2], RotatePiece[PBulkyr, 3]}];&#xD;
    tPieces = {PBulkyAll, PLAll, PPodiumAll, PSnakeAll, PSquareAll, &#xD;
       PLineAll, PTriangleAll};&#xD;
    tPiecesNames = {&amp;#034;Bu&amp;#034;, &amp;#034;Ll&amp;#034;, &amp;#034;Po&amp;#034;, &amp;#034;Sn&amp;#034;, &amp;#034;Sq&amp;#034;, &amp;#034;Li&amp;#034;, &amp;#034;Tr&amp;#034;};&#xD;
&#xD;
&#xD;
**Functions which place the pieces**&#xD;
&#xD;
    Piece placement functions&#xD;
    PutPiece[piece_, piecename_, grid_] := &#xD;
     Module[{IniPt, IniPtxy, Pts, Vcheck, PtsinGrid, Pos, i, gridx}, &#xD;
      gridx = grid;&#xD;
      IniPt = RandomChoice[Position[gridx, 0]];&#xD;
      Pts = Map[IniPt + # &amp;amp;, RandomChoice[piece]];&#xD;
      PtsinGrid = gridx[[Sequence @@ #]] &amp;amp; /@ Pts;&#xD;
      Vcheck = &#xD;
       If[PtsinGrid ==  Table[0, Length[PtsinGrid]], &amp;#034;success&amp;#034;, &amp;#034;failure&amp;#034;];&#xD;
      If[Vcheck == &amp;#034;success&amp;#034;, &#xD;
       Do[gridx[[Sequence @@ Pts[[i]]]] = piecename, {i, &#xD;
         Length[Pts]}]; {&amp;#034;success&amp;#034;, gridx}, {&amp;#034;failure&amp;#034;, gridx}]&#xD;
      ]&#xD;
    AddOnePiece[gridin_, piece_, piecename_, nmax_] := &#xD;
     Module[{cc = &amp;#034;failure&amp;#034;, nn = 0, aa}, &#xD;
      While[(cc != &amp;#034;success&amp;#034;) &amp;amp;&amp;amp; (nn &amp;lt; nmax), &#xD;
       aa = PutPiece[piece, piecename, gridin]; cc = aa[[1]]; &#xD;
       nn = nn + 1]; aa]&#xD;
&#xD;
**Grid definition, and plotting functions**  The initial grid is a ensemble of 0, embedded in a series of 1, forming a matrix.  When a piece is placed the 0&amp;#039;s it occupies are replaced by the name of the piece&#xD;
&#xD;
    General Grid Definitions&#xD;
    TheGrid0 = Table[1, {i, -6, 6, 1}, {j, -6, 6, 1}];&#xD;
    GridDefine[coord_] :=  &#xD;
     Module[{gridout}, gridout = TheGrid0; &#xD;
      Do[gridout[[Sequence @@ (coord[[i]] + {7, 7}) ]] = 0, {i, &#xD;
        Length[coord]}]; gridout]&#xD;
    DrawPieceRectangle[piecename_, grid_, color_] := {color, &#xD;
      Map[Rectangle[{#[[1]] - 0.5 - 7, #[[2]] - 0.5 - 7}, {#[[1]] + 0.5 - &#xD;
           7, #[[2]] + 0.5 - 7}, RoundingRadius -&amp;gt; 0.] &amp;amp;, &#xD;
       Position[grid, piecename]]}&#xD;
    mycolors = ColorData[24];&#xD;
    PlotGrid[grid_, plotrange_] := &#xD;
     Graphics[{{White, Rectangle[{-6, -6}, {6, 6}]},&#xD;
       DrawPieceRectangle[0, grid, White], &#xD;
       DrawPieceRectangle[1, grid, Black], &#xD;
       DrawPieceRectangle[tPiecesNames[[#]], grid, &#xD;
          mycolors[If[# != 6, #, # + 4]]] &amp;amp; /@ Range[7]}, &#xD;
      PlotRange -&amp;gt; plotrange]&#xD;
&#xD;
**The final solving functions**&#xD;
&#xD;
    Full solving function&#xD;
    Get the solution, and at each step provides a plot named p, which can be dynamically visualized using a cell with Dynamic[p]&#xD;
    SolveGrid[InitGrid_, plotrange_] := &#xD;
     Module[{imax, nattempt, grid, i, vc}, imax = 0; nattempt = 0; &#xD;
      While[imax &amp;lt; 8, grid[1] = InitGrid; i = 1; vc = &amp;#034;success&amp;#034;; &#xD;
       While[(i &amp;lt; 8) &amp;amp;&amp;amp; (vc == \!\(\*&#xD;
    TagBox[&#xD;
    StyleBox[&amp;#034;\&amp;#034;\&amp;lt;success\&amp;gt;\&amp;#034;&amp;#034;,&#xD;
    ShowSpecialCharacters-&amp;gt;False,&#xD;
    ShowStringCharacters-&amp;gt;True,&#xD;
    NumberMarks-&amp;gt;True],&#xD;
    FullForm]\)),&#xD;
         {vc, grid[i + 1]} =  &#xD;
         AddOnePiece[grid[i], tPieces[[i]], tPiecesNames[[i]], 30]; &#xD;
        p = PlotGrid[grid[i + 1], plotrange]; &#xD;
        If[vc == &amp;#034;success&amp;#034; || i &amp;lt; 7, i++; imax = i, i++]]; nattempt++]; &#xD;
      Print[nattempt]; PlotGrid[grid[8], plotrange]; grid[8]]&#xD;
    Get ony the solution, without final plot, nor dynamical vizualisation&#xD;
    SolveGridBare[InitGrid_] := &#xD;
     Module[{imax, nattempt, grid, i, vc}, imax = 0; nattempt = 0; &#xD;
      While[imax &amp;lt; 8, grid[1] = InitGrid; i = 1; vc = &amp;#034;success&amp;#034;; &#xD;
       While[(i &amp;lt; 8) &amp;amp;&amp;amp; (vc == \!\(\*&#xD;
    TagBox[&#xD;
    StyleBox[&amp;#034;\&amp;#034;\&amp;lt;success\&amp;gt;\&amp;#034;&amp;#034;,&#xD;
    ShowSpecialCharacters-&amp;gt;False,&#xD;
    ShowStringCharacters-&amp;gt;True,&#xD;
    NumberMarks-&amp;gt;True],&#xD;
    FullForm]\)),&#xD;
         {vc, grid[i + 1]} =  &#xD;
         AddOnePiece[grid[i], tPieces[[i]], tPiecesNames[[i]], 30]; &#xD;
        If[vc == &amp;#034;success&amp;#034; || i &amp;lt; 7, i++; imax = i, i++]]; nattempt++]; &#xD;
      Print[nattempt]; grid[8]]&#xD;
    SolveGridBare2[InitGrid_] := &#xD;
     Module[{imax, nattempt, grid, i, vc}, imax = 0; nattempt = 0; &#xD;
      While[imax &amp;lt; 8, grid[1] = InitGrid; i = 1; vc = &amp;#034;success&amp;#034;; &#xD;
       While[(i &amp;lt; 8) &amp;amp;&amp;amp; (vc == \!\(\*&#xD;
    TagBox[&#xD;
    StyleBox[&amp;#034;\&amp;#034;\&amp;lt;success\&amp;gt;\&amp;#034;&amp;#034;,&#xD;
    ShowSpecialCharacters-&amp;gt;False,&#xD;
    ShowStringCharacters-&amp;gt;True,&#xD;
    NumberMarks-&amp;gt;True],&#xD;
    FullForm]\)),&#xD;
         {vc, grid[i + 1]} =  &#xD;
         AddOnePiece[grid[i], tPieces[[i]], tPiecesNames[[i]], 30]; &#xD;
        If[vc == &amp;#034;success&amp;#034; || i &amp;lt; 7, i++; imax = i, i++]]; &#xD;
       nattempt++]; {grid[8], nattempt}]&#xD;
&#xD;
**Example of use**   &#xD;
&#xD;
    coordQ35 = &#xD;
      Join[Table[{i, 2}, {i, -2, 3}], Table[{i, -2}, {i, -2, 3}], &#xD;
       Table[{i, 1}, {i, 0, 3}], Table[{i, 0}, {i, 0, 3}], &#xD;
       Table[{i, -1}, {i, 0, 3}], Table[{-2, j}, {j, -1, 1}]];&#xD;
    &#xD;
    TheGridQ35 = GridDefine[coordQ35];&#xD;
    SolgridQ35ex1 = SolveGridBare[TheGridQ35];&#xD;
    PlotGrid[SolgridQ35ex1, {{-3.5, 4.5}, {-3.5, 3.5}}]&#xD;
&#xD;
A dynamic view of the process (similar to the animations shown above) is obtained by running a cell &amp;#034;**Dynamic[p]**&amp;#034; before calling SolveGrid[TheGridQ35,{{-3.5, 4.5}, {-3.5, 3.5}}]&#xD;
&#xD;
**Pieces definition for the 3 case**  (here all the possible orientations are obtained by applying randomly rotations and reflection on the initial piece)&#xD;
&#xD;
     &#xD;
    Pieces Definitions&#xD;
    PTriangle = {{0, 0, 0}, {0, 1, 0}, {1, 0, 0}};&#xD;
    PSquare = {{0, 0, 0}, {0, 1, 0}, {1, 0, 0}, {1, 1, 0}};&#xD;
    PLine = {{0, -1, 0}, {0, 0, 0}, {0, 1, 0}};&#xD;
    PL = {{0, 0, 0}, {0, 1, 0}, {1, 0, 0}, {2, 0, 0}};&#xD;
    PPodium = {{0, 0, 0}, {0, 1, 0}, {-1, 0, 0}, {1, 0, 0}};&#xD;
    PSnake = {{0, 0, 0}, {0, 1, 0}, {1, 0, 0}, {-1, 1, 0}};&#xD;
    PBulky = {{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {1, 1, 0}, {-1, 1, 0}};&#xD;
    (* Rotation by angle \[Pi]/2 matrix*)&#xD;
    Mrotz = {{0, 1, 0}, {-1, 0, 0}, {0, 0, 1}};&#xD;
    Mrotx = {{1, 0, 0}, {0, 0, 1}, {0, -1, 0}};&#xD;
    Mrotx = {{0, 0, -1}, {0, 1, 0}, {1, 0, 0}};&#xD;
    (* Reflection  matrix *)&#xD;
    Mrefx = {{-1, 0, 0}, {0, 1, 0}, {0, 0, 1}};&#xD;
    Mrefy = {{1, 0, 0}, {0, -1, 0}, {0, 0, 1}};&#xD;
    Mrefz = {{1, 0, 0}, {0, 1, 0}, {0, 0, -1}};&#xD;
    MUnit = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};&#xD;
    (*Operators which perform a given number of rotation, and of \&#xD;
    reflection*)&#xD;
    RotatePiecex[piece_, n_] := Nest[Mrotx.# &amp;amp;, #, n] &amp;amp; /@ piece&#xD;
    RotatePiecey[piece_, n_] := Nest[Mrotx.# &amp;amp;, #, n] &amp;amp; /@ piece&#xD;
    RotatePiecez[piece_, n_] := Nest[Mrotz.# &amp;amp;, #, n] &amp;amp; /@ piece&#xD;
    ReflectPiecex[piece_, n_] := &#xD;
     If[n == 0, (MUnit.#) &amp;amp; /@ piece, (Mrefx.#) &amp;amp; /@ piece]&#xD;
    ReflectPiecey[piece_, n_] := &#xD;
     If[n == 0, (MUnit.#) &amp;amp; /@ piece, (Mrefy.#) &amp;amp; /@ piece]&#xD;
    ReflectPiecez[piece_, n_] := &#xD;
     If[n == 0, (MUnit.#) &amp;amp; /@ piece, (Mrefz.#) &amp;amp; /@ piece]&#xD;
    Each piece with all the possible orientations&#xD;
    MakeAllPieces[piece_] := &#xD;
     DeleteDuplicates@&#xD;
      Table[Module[{Rota, Rotb, Rotc, Refa, Refb, Refc, na, nb, nc, ma, &#xD;
         mb, mc},&#xD;
        Rota = RandomChoice[{RotatePiecex, RotatePiecey, RotatePiecez}];&#xD;
        Rotb = RandomChoice[{RotatePiecex, RotatePiecey, RotatePiecez}]; &#xD;
        Rotc = RandomChoice[{RotatePiecex, RotatePiecey, RotatePiecez}];&#xD;
        Refa = RandomChoice[{ReflectPiecex, ReflectPiecey, ReflectPiecez}];&#xD;
        Refb = RandomChoice[{ReflectPiecex, ReflectPiecey, ReflectPiecez}];&#xD;
        Refc = RandomChoice[{ReflectPiecex, ReflectPiecey, ReflectPiecez}];&#xD;
        na = RandomInteger[{0, 3}]; nb = RandomInteger[{0, 3}]; &#xD;
        nc = RandomInteger[{0, 3}];&#xD;
        ma = RandomInteger[{0, 1}]; mb = RandomInteger[{0, 1}]; &#xD;
        mc = RandomInteger[{0, 1}];&#xD;
        Refc[Rotc[Refb[Rotb[ Refa[Rota[piece, na], ma], nb], mb], nc], &#xD;
         mc]], {i, 1, 2000}]&#xD;
    PTriangleAll = MakeAllPieces[PTriangle]; Length@PTriangleAll&#xD;
    24&#xD;
    PSquareAll = MakeAllPieces[PSquare]; Length@PSquareAll&#xD;
    24&#xD;
    PLineAll = MakeAllPieces[PLine]; Length@PLineAll&#xD;
    6&#xD;
    PLAll = MakeAllPieces[PL]; Length@PLAll&#xD;
    24&#xD;
    PPodiumAll = MakeAllPieces[PPodium]; Length@PPodiumAll&#xD;
    24&#xD;
    PSnakeAll = MakeAllPieces[PSnake]; Length@PSnakeAll&#xD;
    24&#xD;
    PBulkyAll = MakeAllPieces[PBulky]; Length@PBulkyAll&#xD;
    24&#xD;
    tPieces = {PBulkyAll, PLAll, PPodiumAll, PSnakeAll, PSquareAll, &#xD;
       PLineAll, PTriangleAll};&#xD;
    tPiecesNames = {&amp;#034;Bu&amp;#034;, &amp;#034;Ll&amp;#034;, &amp;#034;Po&amp;#034;, &amp;#034;Sn&amp;#034;, &amp;#034;Sq&amp;#034;, &amp;#034;Li&amp;#034;, &amp;#034;Tr&amp;#034;};&#xD;
&#xD;
**Grid definition and visualisation for the 3d case** &#xD;
&#xD;
    General Grid Definitions&#xD;
    TheGrid0 = Table[1, {i, -6, 6, 1}, {j, -6, 6, 1}, {k, -6, 6, 1}];&#xD;
    GridDefine[coord_] :=  &#xD;
     Module[{gridout}, gridout = TheGrid0; &#xD;
      Do[gridout[[Sequence @@ (coord[[i]] + {7, 7, 7}) ]] = 0, {i, &#xD;
        Length[coord]}]; gridout]&#xD;
    DrawPieceCube[piecename_, grid_, color_] := {Glow[color], &#xD;
      Opacity[0.75], Specularity[0], EdgeForm[Thick], &#xD;
      Map[Cuboid[{#[[1]] - 0.5 - 7, #[[2]] - 0.5 - 7, #[[3]] - 0.5 - &#xD;
           7}] &amp;amp;, Position[grid, piecename]]}&#xD;
    mycolors = ColorData[24];&#xD;
    PlotGrid3D[grid_, plotrange_] := &#xD;
     Graphics3D[{(*{White,Cuboid[{-6,-6,-6},{6,6,6}]},*)&#xD;
       &#xD;
       DrawPieceCube[0, grid, White],(*DrawPieceCube[1,grid,Black],*)&#xD;
       DrawPieceCube[tPiecesNames[[#]], grid, &#xD;
          mycolors[If[# != 6, #, # + 4]]] &amp;amp; /@ Range[7]}, &#xD;
      PlotRange -&amp;gt; plotrange, Lighting -&amp;gt; None, Boxed -&amp;gt; False]&#xD;
    PlotGrid3D[grid_, plotrange_, pov_] := &#xD;
     Graphics3D[{(*{White,Cuboid[{-6,-6,-6},{6,6,6}]},*)&#xD;
       &#xD;
       DrawPieceCube[0, grid, White],(*DrawPieceCube[1,grid,Black],*)&#xD;
       DrawPieceCube[tPiecesNames[[#]], grid, &#xD;
          mycolors[If[# != 6, #, # + 4]]] &amp;amp; /@ Range[7]}, &#xD;
      PlotRange -&amp;gt; plotrange, Lighting -&amp;gt; None, Boxed -&amp;gt; False, &#xD;
      ViewPoint -&amp;gt; pov]&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=IMG_3757small.JPG&amp;amp;userId=867329&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=IMG_3758small.JPG&amp;amp;userId=867329&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=IMG_3756small.JPG&amp;amp;userId=867329&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PlacePieces_Q35_anim.gif&amp;amp;userId=867329&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PlacePieces_Q48_anim.gif&amp;amp;userId=867329&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=solutionExample1.png&amp;amp;userId=867329&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=solutionExample2.png&amp;amp;userId=867329&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=solutionHisto.jpg&amp;amp;userId=867329&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PlacePieces_Q26_allsoluces.gif&amp;amp;userId=867329</description>
    <dc:creator>Thibaut Jonckheere</dc:creator>
    <dc:date>2016-06-11T13:29:52Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1731686">
    <title>[WSC19] Creating Crossword Puzzles</title>
    <link>https://community.wolfram.com/groups/-/m/t/1731686</link>
    <description>Early in the summer of 2019, I attended the Wolfram High School Summer Camp. I worked on a project for two weeks which generates a crossword with random words that the user can solve and check. In this post, I will give a general outline of my project, then go into detail about my though process, and finally show the finished product.&#xD;
&#xD;
How it Works&#xD;
==========&#xD;
My project is basically a grid of variables, with the variables containing strings. This may seem simple, but it isn&amp;#039;t as easy at it looks. The tricky part is having the strings change to very specific things based on random data each time the user evaluates. This makes the words in the crossword random each time in order to truly generate new crosswords each time.&#xD;
&#xD;
-------------------------------------------------&#xD;
Initial Start&#xD;
--------------&#xD;
I started by simply trying to overlay two words, but that didn&amp;#039;t work out well...    ![enter image description here][1]&#xD;
&#xD;
After that attempt, I tried a completely different approach by using grid, variables, and then associations to make a primitive crossword with a few words in it.&#xD;
&#xD;
    Grid[Join[{{Black, Black, AsNwWord[1], Black, Black, &#xD;
        Black}}, {SmpWord}, &#xD;
      Table[{Black, Black, AsNwWord[n], Black, Black, Black}, {n, &#xD;
        RevAsNwWord[AsSmpWord[3]] + 1, Length[NwWord], 1}]], Frame -&amp;gt; All]&#xD;
This made the nice output of the following:     ![enter code here][2]&#xD;
&#xD;
--------------------------------------------&#xD;
Preparation&#xD;
---------------&#xD;
Firstly, I filtered out all profane words, just to be safe...&#xD;
&#xD;
    lotswords = Pick[WordData[], First /@ Values[&#xD;
        KeyTake[Classify[&amp;#034;Profanity&amp;#034;, WordData[], &amp;#034;Probabilities&amp;#034;], &#xD;
         True]], p_ /; p &amp;lt; 0.5]&#xD;
&#xD;
Then I defined functions to make associations and character lists for all of the words in the crossword.&#xD;
&#xD;
    charwordprep[Word_] := Flatten[Characters[Word]]&#xD;
    aswordprep[Word_] := &#xD;
     With[{wWord = Flatten[Characters[Word]]}, &#xD;
      AssociationThread[Range[Length[wWord]], wWord]]&#xD;
    hintwordprep[Word_] := &#xD;
     Part[Flatten[&#xD;
       Part[WordData[StringDrop[StringDrop[ToString[Word], 1], -1], &#xD;
         &amp;#034;Definitions&amp;#034;], 1]], 2]&#xD;
    lengthwordprep[Word_] := ToString@Length[charwordprep[Word]]&#xD;
After that, I made variables for hints, hint helpers, and the correct solution. Then came the really fun part: I made the actual crossword. This could be done with such little code; I was amazed beyond belief!&#xD;
&#xD;
    fillercross = Framed[Grid[Partition[&#xD;
         MapIndexed[If[#1 == 1, BlackSquare, WhiteSquares[#2[[1]]]] &amp;amp;, &#xD;
          Flatten[pattern]], 10], Background -&amp;gt; Black], &#xD;
       Background -&amp;gt; Black];&#xD;
This had an output that looked like a crossword and that the user could type into which stored the data:&#xD;
![enter image description here][3]&#xD;
I then created a variable that checked the solution that the user typed in by using a simple if statement.&#xD;
&#xD;
    solvecheck = Dynamic[If[&#xD;
       StringReplace[ToString[input], &amp;#034;Null&amp;#034; -&amp;gt; &amp;#034; &amp;#034;] == &#xD;
        StringDrop[StringDrop[ToLowerCase[ToString[correctlist]], 1], -1],&#xD;
        Style[colorize2[&amp;#034;This is correct!&amp;#034;, ColorData[&amp;#034;Rainbow&amp;#034;]], Bold, &#xD;
        140], Style[&amp;#034;Sorry... try again...&amp;#034;, Bold, 40]]]&#xD;
&#xD;
---------------------------------------------------&#xD;
Final Input&#xD;
=========&#xD;
After making all the variables and functions in preparation for this, I finally made the manipulate! &#xD;
The code follows:&#xD;
&#xD;
    Framed[Manipulate[&#xD;
      Column[{&#xD;
        Style[&amp;#034;Crossword Creator!&amp;#034;, Bold, 50],&#xD;
        &amp;#034;&amp;#034;,&#xD;
        &amp;#034;&amp;#034;,&#xD;
        &amp;#034;Please fill the generated crossword.&amp;#034;,&#xD;
        &amp;#034;You can type in the words, but make sure to click on each box and&#xD;
    insert only one letter per box.&amp;#034;, &#xD;
        &amp;#034;Fill the crossword with words which have the following HINTS: &amp;#034;,&#xD;
        &amp;#034;&amp;#034;,&#xD;
        horizhintz,&#xD;
        &amp;#034;&amp;#034;,&#xD;
        verthintz,&#xD;
        &amp;#034;&amp;#034;,&#xD;
        HintFirstLetters,&#xD;
        &amp;#034;&amp;#034;,&#xD;
        HintLength,&#xD;
        &amp;#034;&amp;#034;,&#xD;
        Wordbank,&#xD;
        &amp;#034;&amp;#034;,&#xD;
        minicross,&#xD;
        &amp;#034;&amp;#034;,&#xD;
        fillercross,&#xD;
        &amp;#034;&amp;#034;,&#xD;
        SolutionChecker,&#xD;
        &amp;#034;&amp;#034;,&#xD;
        Answers ,&#xD;
        &amp;#034;&amp;#034;,&#xD;
        Style[&amp;#034;Thank you for playing and have a great day!&amp;#034; , 50, &#xD;
         Italic]}],&#xD;
      {HintFirstLetters, {&amp;#034;&amp;#034; -&amp;gt; &amp;#034;Hide&amp;#034;, &#xD;
        firstletters -&amp;gt; &amp;#034;Show&amp;#034;}}, {HintLength, {&amp;#034;&amp;#034; -&amp;gt; &amp;#034;Hide&amp;#034;, &#xD;
        hintlength -&amp;gt; &amp;#034;Show&amp;#034;}}, {Wordbank, {&amp;#034;&amp;#034; -&amp;gt; &amp;#034;Hide&amp;#034;, &#xD;
        wordbank -&amp;gt; &amp;#034;Show&amp;#034;}}, {Answers, {&amp;#034;&amp;#034; -&amp;gt; &amp;#034;Hide&amp;#034;, &#xD;
        showanswers -&amp;gt; &amp;#034;Show&amp;#034;}}, {SolutionChecker, {&amp;#034;&amp;#034; -&amp;gt; &amp;#034;Not Yet&amp;#034;, &#xD;
        solvecheck -&amp;gt; &amp;#034;Check!&amp;#034;}}, ImageMargins -&amp;gt; Large], &#xD;
     FrameMargins -&amp;gt; 0]&#xD;
&#xD;
---------------------------------------------------------&#xD;
The Final Output&#xD;
=============&#xD;
Here is the project&amp;#039;s summative output:![enter image description here][4]&#xD;
&#xD;
---------------------------------------------------------&#xD;
Reflection&#xD;
========&#xD;
Throughout the process of the development of my project, I learned a few very valuable things. I learnt that even if one sets impossible goals, with time, one will accomplish said goals. Also, I realized that hard problems can be overcome with relatively simple solutions, it&amp;#039;s just a matter of choosing the correct approach.&#xD;
&#xD;
I would like to thank my mentor Sylvia Haas for helping me in so many ways throughout the stressful and difficult process of making this project.&#xD;
&#xD;
https://github.com/SimeonButtery/WSS-Template&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at2.50.19PM.png&amp;amp;userId=1725103&#xD;
  [2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at3.07.00PM.png&amp;amp;userId=1725103&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at3.27.00PM.png&amp;amp;userId=1725103&#xD;
  [4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at4.28.52PM.png&amp;amp;userId=1725103</description>
    <dc:creator>Simeon Buttery</dc:creator>
    <dc:date>2019-07-11T20:59:58Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2435403">
    <title>Designing Townscaper town on computable base-grid</title>
    <link>https://community.wolfram.com/groups/-/m/t/2435403</link>
    <description>![Designing Townscaper town on computable base-grid][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=frames2.gif&amp;amp;userId=20103&#xD;
  [2]: https://www.wolframcloud.com/obj/0d953f64-4678-4d55-9d6b-17997fa2f42a</description>
    <dc:creator>Silvia Hao</dc:creator>
    <dc:date>2022-01-02T11:23:53Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1214169">
    <title>Jigsaw Puzzle</title>
    <link>https://community.wolfram.com/groups/-/m/t/1214169</link>
    <description>![enter image description here][1]&#xD;
&#xD;
Dear all, from the resemblance of a Voronoi mesh to a jigsaw puzzle I came to the idea for the following little program I want to share. The essential function is &#xD;
&#xD;
    (* in: points p1, p2;&#xD;
      out: BSplineCurve = jigsaw side if distance &amp;gt; minLength;  *)&#xD;
    jigsawSide[minLength_][pts : {p1_, p2_}] := Module[{m, u, o, vx, vy, n, dist, r, c, angle0, cPts},&#xD;
      dist = EuclideanDistance @@ pts;&#xD;
      If[dist &amp;lt; minLength, Return[Line[pts]]];&#xD;
      (* avoid borders: *)      &#xD;
      If[Times @@ (p2 - p1) == 0, Return[Line[pts]]];&#xD;
      m = Mean[pts];&#xD;
      {u, o} = SortBy[pts, Last];  (* lower/upper point *)&#xD;
      {vx, vy} = o - u; &#xD;
      n = {vy, -vx};  (* normal vector *)&#xD;
      r = .15 dist;  (* radius *)&#xD;
      c = m + n/4.;  (* center *)&#xD;
      angle0 = Sign[Last[n]] VectorAngle[{1, 0}, n];&#xD;
      (* points on circle: *)&#xD;
      cPts = c + r {Cos[angle0 + #], Sin[angle0 + #]} &amp;amp; /@ (60 \[Degree] {-2, -1, 0, 1, 2});&#xD;
      Return[BSplineCurve[{u, m, Sequence @@ cPts, m, o}]]&#xD;
      ]&#xD;
   &#xD;
which connects two points with a `BSplineCurve` having the typical elementary shape of a jigsaw puzzle. If the distance is too short then the connection becomes a straight line. The same happens if the points share the same x- or y-coordinate to exclude the jigsaws borders. Here is a simple test of the function:&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
Anything else is straightforward:&#xD;
&#xD;
 - start with &amp;#034;randomized&amp;#034; lattice points;&#xD;
 - from these a Voronoi mesh is created;&#xD;
 - extract its polygons;&#xD;
 - convert the polygon sides into the new (puzzle) shape;&#xD;
 - build new polygons out of these  sides;&#xD;
 - apply a texture.&#xD;
&#xD;
The result is a bunch of jigsaw pieces one can play with:&#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
I was impressed by the consistent behavior of `Texture`. The whole (short) code is attached.&#xD;
&#xD;
Best regards -- Henrik&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=9927ezgif.com-optimize.gif&amp;amp;userId=11733&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PieceSide.gif&amp;amp;userId=32203&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=JigsawsExample.png&amp;amp;userId=32203</description>
    <dc:creator>Henrik Schachner</dc:creator>
    <dc:date>2017-11-04T19:25:59Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2420295">
    <title>Creating composite ambigrams from Chinese characters in Voxelverse</title>
    <link>https://community.wolfram.com/groups/-/m/t/2420295</link>
    <description>![enter image description here][1]&#xD;
&#xD;
If we were to develop three dimensional voxel shanshui (山水) art, then we would definitely need three dimensional voxelized creator and collector stamps when processing transactions. I almost didn&amp;#039;t say anything, but Erik Mahieu and Frederick Wu brought up ambigrams in [another recent successful team effort][2]. The purpose of this memo (at min) is to uncover a new mathematical conjecture, which occurs when creating composite ambigrams from Chinese characters in the voxelverse. &#xD;
&#xD;
Here&amp;#039;s the scenario. &#xD;
&#xD;
An exercise involving a $3 \times 3$ matrix.&#xD;
&#xD;
    九gram = &amp;#034;道江湖金水木山自然&amp;#034;;&#xD;
    dat = Rasterize[#] &amp;amp; /@ Characters[九gram];&#xD;
    RastToBitmap[im_, trim_] := With[{&#xD;
       rect = Map[Mod[Mean[#] + 1, 2] &amp;amp;,&#xD;
         Round[ImageData[im]], {2}]},&#xD;
      Map[Join[{0, 0, 0}, #, {0, 0, 0}] &amp;amp;,&#xD;
        rect][[1 + trim ;; -1 - trim, 1 + trim ;; -1 - trim]]]&#xD;
    bitmaps = RastToBitmap[#, 2] &amp;amp; /@ dat;&#xD;
    bitmapIms = Image[Mod[# + 1, 2]] &amp;amp; /@ bitmaps;&#xD;
    Partition[bitmapIms, 3] // Grid  &#xD;
&#xD;
![nine gram][3]&#xD;
&#xD;
The mission objective that shows up on the teleprompter is to encipher this matrix into the form of $8$ &amp;amp; an extra perfectly decodable voxel ambigrams. The problem (as mentioned by Fredrick) is that the symbols are too high genus for monotonic data to suffice.  &#xD;
&#xD;
Here&amp;#039;s the solution I came up with, using the chosen topology of rows + columns + diagonals + knight moves from Square $1$. The lexicon is over three symbols $\{R,G,B\}$ plus another for clear space. After encoding, we can check partial projections: &#xD;
&#xD;
    Partials[gram1_, gram2_, gram3_] := With[{&#xD;
       dat123 = Position[Outer[&#xD;
          gram1[[#1, #2]] gram2[[#2, #3]] gram3[[#3, #1]] &amp;amp; ,&#xD;
          Range[14], Range[14], Range[14], 1], 1]},&#xD;
      MapIndexed[Function[{grams, ind},&#xD;
          Complement[RotateRight[#, ind] &amp;amp; /@ Position[&#xD;
             Outer[grams[[1, #1, #2]] grams[[2, #2, #3]] &amp;amp; ,&#xD;
              Range[14], Range[14], Range[14], 1], 1], dat123]&#xD;
          ][#1, #2[[1]] - 1] &amp;amp;, Partition[{gram1, gram2, gram3}, 2, 1, 1]]]&#xD;
    &#xD;
    imDat[partials_] := Outer[Image[ReplacePart[&#xD;
         Table[1, {i, 1, 14}, {j, 1, 14}],&#xD;
         # -&amp;gt; 0 &amp;amp; /@ #1[[All, #2]]]] &amp;amp;,&#xD;
      partials[[{2, 3, 1}]], {{1, 2}, {2, 3}, {3, 1}}, 1]&#xD;
    &#xD;
    rowDat = Partition[bitmaps, 3];&#xD;
    colDat = Transpose[Partition[bitmaps, 3]];&#xD;
    xDat = {bitmaps[[{1, 5, 9}]], bitmaps[[{3, 5, 7}]], &#xD;
       bitmaps[[{1, 6, 8}]]};&#xD;
    &#xD;
    rows = Map[imDat[Partials[Sequence @@ #]] &amp;amp;, rowDat];&#xD;
    cols = Map[imDat[Partials[Sequence @@ #]] &amp;amp;, colDat];&#xD;
    diags = Map[imDat[Partials[Sequence @@ #]] &amp;amp;, xDat];&#xD;
    &#xD;
    TableForm /@ rows&#xD;
    TableForm /@ cols&#xD;
    TableForm /@ diags&#xD;
&#xD;
![partials][4]&#xD;
&#xD;
These matrices in themselves have some interesting structure and are worth more detailed analysis, but for now, we need only one superposition function  &#xD;
&#xD;
    Superpose[mat_] :=  Map[ImageMultiply@mat[[Complement[Range[3], {#}], #]] &amp;amp;, Range[3]]&#xD;
    TableForm[Superpose /@ #] &amp;amp; /@ {rows, cols, diags}&#xD;
&#xD;
![valid outs][5]&#xD;
&#xD;
These look correct, but for sake of rigor ++ QA + &#xD;
&#xD;
    MapThread[ImageSubtract[#1, #2] &amp;amp;,&#xD;
     {Flatten[Superpose /@ rows], bitmapIms}]&#xD;
    &#xD;
    MapThread[ImageSubtract[#1, #2] &amp;amp;,&#xD;
     {Flatten[Superpose /@ cols],&#xD;
      Flatten[Transpose[Partition[bitmapIms, 3]]]}]&#xD;
    &#xD;
    MapThread[ImageSubtract[#1, #2] &amp;amp;,&#xD;
     {Flatten[Superpose /@ diags],&#xD;
      bitmapIms[[{1, 5, 9, 3, 5, 7, 1, 6, 8}]]}]&#xD;
&#xD;
![blackbox1][6]&#xD;
![blackbox2][7]&#xD;
![blackbox3][8]&#xD;
&#xD;
These $9 \times 3$ black boxes mean proof complete, and it may even be possible to recover the secret extra data &amp;#034;knight&amp;#039;s move&amp;#034; by comparing regular first two prints, with odd third (proof unknown). More importantly, since this experiment was successful on 9 varied attempts, we have a new mission objective to prove the conjecture that the same process produces perfectly decodable data for any possible bitmap input.&#xD;
&#xD;
We can also formulate another similar conjecture for fully layered projections. Using the following functions, we obtain [new results in three colors][9]:&#xD;
    &#xD;
    Ambigram[TriadData_] := With[&#xD;
    {partials = Partials[Sequence @@ #] &amp;amp;@TriadData},&#xD;
      Graphics3D[ Transpose[{{Blue, Red, Green}, Map[Cuboid, partials, {2}]}]]]&#xD;
    &#xD;
    OrthoProj[Ambigram_] :=  GraphicsGrid[&#xD;
    Transpose[Partition[MapThread[Show[Ambigram,&#xD;
           Boxed -&amp;gt; False, ViewProjection -&amp;gt; &amp;#034;Orthographic&amp;#034;, &#xD;
           ViewPoint -&amp;gt; #1, ViewVertical -&amp;gt; #2] &amp;amp;,&#xD;
         {{{0, 0, 1}, {0, 0, -1}, {1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}},&#xD;
          {{-1, 0, 0}, {-1, 0, 0}, {0, -1, 0}, {0, -1, 0}, {0, 0, -1}, {0, 0, -1}}}], 2]]]&#xD;
    &#xD;
    RGBResults[TriadData_] := With[{amb = Ambigram[TriadData]},&#xD;
      GraphicsRow[Show[#, ImageSize -&amp;gt; 400] &amp;amp; /@ {&#xD;
         Show[amb, ViewProjection -&amp;gt; &amp;#034;Orthographic&amp;#034;,&#xD;
          ViewPoint -&amp;gt; {1, 1, 1}, Boxed -&amp;gt; False], OrthoProj[amb]}]]&#xD;
&#xD;
 ![amb1][10]&#xD;
&#xD;
![amb2][11]&#xD;
&#xD;
![amb3][12]&#xD;
&#xD;
![amb4][13]&#xD;
&#xD;
![amb5][14]&#xD;
&#xD;
![amb6][15]&#xD;
&#xD;
![amb7][16]&#xD;
&#xD;
![amb8][17]&#xD;
&#xD;
![amb9][18]&#xD;
&#xD;
Face first projections appear to be correct, but is this always the case? Does correctness of Black and White projections imply correctness of RGB projections? These questions must be answered, and theorems proven before we can even begin to think about making voxel NFTs for certain choices of three ASCII characters (or about 玄学X). &#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=AmbAnim.gif&amp;amp;userId=234448&#xD;
  [2]: https://community.wolfram.com/groups/-/m/t/2419704&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=NineGram.png&amp;amp;userId=234448&#xD;
  [4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=PartialsOut.png&amp;amp;userId=234448&#xD;
  [5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ValidOuts.png&amp;amp;userId=234448&#xD;
  [6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=BlackBox.png&amp;amp;userId=234448&#xD;
  [7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=BlackBox.png&amp;amp;userId=234448&#xD;
  [8]: https://community.wolfram.com//c/portal/getImageAttachment?filename=BlackBox.png&amp;amp;userId=234448&#xD;
  [9]: https://github.com/bradklee/OpenAssets/tree/main/Ambigrams&#xD;
  [10]: https://community.wolfram.com//c/portal/getImageAttachment?filename=amb1.png&amp;amp;userId=234448&#xD;
  [11]: https://community.wolfram.com//c/portal/getImageAttachment?filename=amb2.png&amp;amp;userId=234448&#xD;
  [12]: https://community.wolfram.com//c/portal/getImageAttachment?filename=amb3.png&amp;amp;userId=234448&#xD;
  [13]: https://community.wolfram.com//c/portal/getImageAttachment?filename=amb4.png&amp;amp;userId=234448&#xD;
  [14]: https://community.wolfram.com//c/portal/getImageAttachment?filename=amb5.png&amp;amp;userId=234448&#xD;
  [15]: https://community.wolfram.com//c/portal/getImageAttachment?filename=amb6.png&amp;amp;userId=234448&#xD;
  [16]: https://community.wolfram.com//c/portal/getImageAttachment?filename=amb7.png&amp;amp;userId=234448&#xD;
  [17]: https://community.wolfram.com//c/portal/getImageAttachment?filename=amb8.png&amp;amp;userId=234448&#xD;
  [18]: https://community.wolfram.com//c/portal/getImageAttachment?filename=amb9.png&amp;amp;userId=234448</description>
    <dc:creator>Brad Klee</dc:creator>
    <dc:date>2021-12-07T21:44:48Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1032663">
    <title>Code puzzles: turning docs into educational games</title>
    <link>https://community.wolfram.com/groups/-/m/t/1032663</link>
    <description>Teaching programing and assessing learning progress is often a very custom task. I wanted to create a completely automated &amp;#034;practically&amp;#034; infinite stream of random puzzles that guide a leaner towards improving programing skills. I think the major problem is content creation. To test whether the learner knows a programming concept, an exercise needs to be wisely designed. And it is better to have a randomized set of such exercises to definitely test the knowledge and exclude guesses and cheating and so on. Often creating such educational materials is very tedious, time consuming, and manual. Exactly like creating good documentation. I will explain one simple idea of using docs to make an educational game. This is just a barebone prototype to clearly follow the inner workings (try it out &amp;amp; share: https://wolfr.am/bughunter ). Please comment with feedback on how we can develop this idea further. &#xD;
&#xD;
[![enter image description here][1]][3]&#xD;
&#xD;
# Introduction: efficient use of resources &#xD;
&#xD;
The docs are the finest wealth and depth of information and should be explored beyond their regular usage. Manual painstaking time consuming effort of creating good programing documentation should be used to its fullest potential. An automated game play would be a novel take on docs. We can use existing code examples in docs to randomly pull pieces of code and make programing exercises automatically. Being able to read code and find bugs is, in my experience, one of the most enlightening practices. The goal of the linked above game is to find a defect of the input code (bug) and fix it. Hence, the &amp;#034;bug hunter&amp;#034;. There are just 2 possible outcomes of a single game cycle, --- and after each you can &amp;#034;try again&amp;#034;: &#xD;
&#xD;
![enter image description here][4]&#xD;
&#xD;
# Core game code: making puzzles&#xD;
&#xD;
Wolfram Language (WL) documentation is one of the best I&amp;#039;ve seen. It has pages and pages of examples starting from simple ones and going though the all details of the usage. Moreover the docs are written in WL itself and furthermore, WL can access docs and even has internal self-knowledge of its structure via WolframLanguageData. For instance, this is how you can show a relationship community graph for symbols related to `GatherBy`:&#xD;
&#xD;
    WolframLanguageData[&amp;#034;GatherBy&amp;#034;, &amp;#034;RelationshipCommunityGraph&amp;#034;]&#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
We can use `WolframLanguageData` to access docs examples and then drop some parts of the code. The puzzle is then for the learner to find what is missing. For the sake of clarity designing a small working prototype lets limit test WL functions and corresponding docs&amp;#039; pages to some small number. So out of ~5000 (and we [just released a new addition][6]):&#xD;
&#xD;
    WolframLanguageData[] // Length&#xD;
&#xD;
`4838`&#xD;
&#xD;
built in symbols I just take 30&#xD;
&#xD;
    functions = {&amp;#034;Append&amp;#034;, &amp;#034;Apply&amp;#034;, &amp;#034;Array&amp;#034;, &amp;#034;Cases&amp;#034;, &amp;#034;Delete&amp;#034;, &amp;#034;DeleteCases&amp;#034;, &amp;#034;Drop&amp;#034;, &amp;#034;Except&amp;#034;, &#xD;
    &amp;#034;Flatten&amp;#034;, &amp;#034;FlattenAt&amp;#034;, &amp;#034;Fold&amp;#034;, &amp;#034;Inner&amp;#034;, &amp;#034;Insert&amp;#034;, &amp;#034;Join&amp;#034;, &amp;#034;ListConvolve&amp;#034;, &amp;#034;Map&amp;#034;, &amp;#034;MapThread&amp;#034;, &#xD;
     &amp;#034;Nest&amp;#034;, &amp;#034;Outer&amp;#034;, &amp;#034;Partition&amp;#034;, &amp;#034;Prepend&amp;#034;, &amp;#034;ReplacePart&amp;#034;, &amp;#034;Reverse&amp;#034;, &amp;#034;RotateLeft&amp;#034;, &amp;#034;RotateRight&amp;#034;, &#xD;
    &amp;#034;Select&amp;#034;, &amp;#034;Sort&amp;#034;, &amp;#034;Split&amp;#034;, &amp;#034;Thread&amp;#034;, &amp;#034;Transpose&amp;#034;};&#xD;
    &#xD;
    functions // Length&#xD;
    30&#xD;
&#xD;
that are listed on a [very old but neat animated page][7] of some essential core-language collection. I will also add some &amp;#034;sugar syntax&amp;#034; to potential removable parts of code:&#xD;
&#xD;
    sugar = {&amp;#034;@@&amp;#034;, &amp;#034;@&amp;#034;, &amp;#034;/@&amp;#034;, &amp;#034;@@@&amp;#034;, &amp;#034;#&amp;#034;, &amp;#034;^&amp;#034;, &amp;#034;&amp;amp;&amp;#034;};&#xD;
&#xD;
So, for instance, out of the following [example in docs][8] we could remove a small part to make a puzzle:&#xD;
&#xD;
![enter image description here][9]&#xD;
&#xD;
Here is an example of &amp;#034;sugar syntax&amp;#034; removal, which for novice programmers would be harder to solve:&#xD;
&#xD;
![enter image description here][10]&#xD;
&#xD;
Next step is to define a function that can check if a string is a built-in symbol (function, all 5000) or if it is some of sugar syntax we defined above:&#xD;
&#xD;
    ClearAll[ExampleHeads];&#xD;
    ExampleHeads[e_]:=&#xD;
    Select[&#xD;
    	Cases[e,_String, Infinity],&#xD;
    	(NameQ[&amp;#034;System`&amp;#034;&amp;lt;&amp;gt;#]||MemberQ[sugar,#])&amp;amp;&amp;amp;#=!=&amp;#034;Input&amp;#034;&amp;amp;&#xD;
    ]&#xD;
&#xD;
Next function essentially makes a single quiz question. First it randomly picks a function from list of 30 symbols we defined. Then it goes to the doc page of that symbol to the section called &amp;#034;Basic Examples&amp;#034;. It finds a random example and removes a random part out of it:&#xD;
&#xD;
    ranquiz[]:=Module[&#xD;
    	{ranfun=RandomChoice[functions],ranexa,ranhead},&#xD;
    	ranexa=RandomChoice[WolframLanguageData[ranfun,&amp;#034;DocumentationBasicExamples&amp;#034;]][[-2;;-1]];&#xD;
    	ranhead=RandomChoice[ExampleHeads[ranexa[[1]]]];&#xD;
    	{&#xD;
    		ReplacePart[#,Position[#,ranhead]-&amp;gt;&amp;#034;&amp;#034;]&amp;amp;@ranexa[[1]],&#xD;
    		ranexa[[2]],&#xD;
    		ranhead,&#xD;
    		ranfun&#xD;
    	}&#xD;
    ]&#xD;
&#xD;
Now we will define a few simple variables and tools. &#xD;
&#xD;
# Image variables&#xD;
&#xD;
I keep marveling how convenient it is that Mathematica front end can make images to be part of code. This makes notebooks a great IDE:&#xD;
&#xD;
![enter image description here][11]&#xD;
&#xD;
# Databin for tracking stats&#xD;
&#xD;
It is important to have statistics of your learning game: to understand how to improve it where the education process should go. [Wolfram Datadrop][12] is an amazing tool for these purposes. &#xD;
&#xD;
[![enter image description here][13]][14]&#xD;
&#xD;
We define the databin as &#xD;
&#xD;
    bin = CreateDatabin[&amp;lt;|&amp;#034;Name&amp;#034; -&amp;gt; &amp;#034;BugHunter&amp;#034;|&amp;gt;]&#xD;
&#xD;
# Deploy game to the web&#xD;
&#xD;
To make an actual application usable by everyone with internet access I will use [Wolfram Development Platform][15] and [Wolfram Cloud][16]. First I define a function that will build the &amp;#034;result of the game&amp;#034; web page. It will check is answer is wrong or right and give differently designed pages accordingly.&#xD;
&#xD;
    quiz[answer_String,check_String,fun_String]:=&#xD;
    (&#xD;
    DatabinAdd[Databin[&amp;#034;kd3hO19q&amp;#034;],{answer,check,fun}];&#xD;
    Grid[{&#xD;
    	{If[answer===check,&#xD;
    		Grid[{{Style[&amp;#034;Right! You got the bug!&amp;#034;,40,Darker@Red,FontFamily-&amp;gt;&amp;#034;Chalkduster&amp;#034;]},{First[imgs]}}],&#xD;
    		Grid[{{Style[&amp;#034;Wrong! The bug got you!&amp;#034;,40,Darker@Red,FontFamily-&amp;gt;&amp;#034;Chalkduster&amp;#034;]},{Last[imgs]}}]&#xD;
    	]},&#xD;
    	&#xD;
    	{Row[&#xD;
    	{Hyperlink[&amp;#034;Try again&amp;#034;,&amp;#034;https://www.wolframcloud.com/objects/user-3c5d3268-040e-45d5-8ac1-25476e7870da/bughunter&amp;#034;],&#xD;
    	&amp;#034;|&amp;#034;,&#xD;
    	hyperlink[&amp;#034;Documentation&amp;#034;,&amp;#034;http://reference.wolfram.com/language/ref/&amp;#034;&amp;lt;&amp;gt;fun&amp;lt;&amp;gt;&amp;#034;.html&amp;#034;],&#xD;
    	&amp;#034;|&amp;#034;,&#xD;
    	hyperlink[&amp;#034;Fun hint&amp;#034;,&amp;#034;http://reference.wolfram.com/legacy/flash/animations/&amp;#034;&amp;lt;&amp;gt;fun&amp;lt;&amp;gt;&amp;#034;.html&amp;#034;]},&#xD;
    	Spacer[10]&#xD;
    	]},&#xD;
    	{Style[&amp;#034;====================================================&amp;#034;]},&#xD;
    	{hyperlink[&amp;#034;An Elementary Introduction to the Wolfram Language&amp;#034;,&amp;#034;https://www.wolfram.com/language/elementary-introduction&amp;#034;]},&#xD;
    	{hyperlink[&amp;#034;Fast introduction for programmers&amp;#034;,&amp;#034;http://www.wolfram.com/language/fast-introduction-for-programmers/en&amp;#034;]},&#xD;
    	{logo}&#xD;
    }]&#xD;
    )&#xD;
&#xD;
This function is used inside `CloudDeploy[...FormFunction[...]...]` construct to actually deploy the application. `FormFunction` builds a query form, a web user interface to formulate a question and to get user&amp;#039;s answer. Note for random variables to function properly `Delayed` is used as a wrapper for `FormFunction`.&#xD;
&#xD;
     CloudDeploy[Delayed[&#xD;
    	quizloc=ranquiz[];&#xD;
    	FormFunction[&#xD;
    		{{&amp;#034;code&amp;#034;,None} -&amp;gt; &amp;#034;String&amp;#034;,&#xD;
    		{&amp;#034;x&amp;#034;,None}-&amp;gt;&amp;lt;|&#xD;
    			&amp;#034;Input&amp;#034;-&amp;gt;StringRiffle[quizloc[[3;;4]],&amp;#034;,&amp;#034;],&#xD;
    			&amp;#034;Interpreter&amp;#034;-&amp;gt;DelimitedSequence[&amp;#034;String&amp;#034;],&#xD;
    			&amp;#034;Control&amp;#034;-&amp;gt;Function[Annotation[InputField[##],{&amp;#034;class&amp;#034;-&amp;gt;&amp;#034;sr-only&amp;#034;},&amp;#034;HTMLAttrs&amp;#034;]]|&amp;gt;}, &#xD;
    		quiz[#code,#x[[1]],#x[[2]]]&amp;amp;,&#xD;
    		AppearanceRules-&amp;gt; &amp;lt;|&#xD;
    			&amp;#034;Title&amp;#034; -&amp;gt; Grid[{{title}},Alignment-&amp;gt;Center],&#xD;
    			&amp;#034;MetaTitle&amp;#034;-&amp;gt;&amp;#034;BUG HUNTER&amp;#034;,&#xD;
    			&amp;#034;Description&amp;#034;-&amp;gt; Grid[{&#xD;
    			{Style[&amp;#034;Type the missing part of input code&amp;#034;,15, Darker@Red,FontFamily-&amp;gt;&amp;#034;Ayuthaya&amp;#034;]},&#xD;
    			{Rasterize@Grid[{&#xD;
    				{&amp;#034;In[1]:=&amp;#034;,quizloc[[1]]},&#xD;
    				{&amp;#034;Out[1]=&amp;#034;,quizloc[[2]]}},Alignment-&amp;gt;Left]}&#xD;
    			}]&#xD;
    		 |&amp;gt;]],&#xD;
    	&amp;#034;bughunter&amp;#034;,&#xD;
    	Permissions-&amp;gt;&amp;#034;Public&amp;#034;&#xD;
    ]&#xD;
&#xD;
The result of the deployment is a cloud object at a URL:&#xD;
&#xD;
    CloudObject[https://www.wolframcloud.com/objects/user-3c5d3268-040e-45d5-8ac1-25476e7870da/bughunter]&#xD;
&#xD;
with the short version:&#xD;
&#xD;
    URLShorten[&amp;#034;https://www.wolframcloud.com/objects/user-3c5d3268-040e-45d5-8ac1-25476e7870da/bughunter&amp;#034;, &amp;#034;bughunter&amp;#034;]&#xD;
&#xD;
https://wolfr.am/bughunter&#xD;
&#xD;
And we are done! You can go at the above URL and play.&#xD;
&#xD;
# Further thoughts&#xD;
&#xD;
Here are some key points and further thoughts.&#xD;
&#xD;
## Advantages:&#xD;
&#xD;
- Automation of content: NO new manual resource development, use existing code bases.&#xD;
- Automation of testing: NO manual labor of grading.&#xD;
- Quality of testing: NO multiple choice, NO guessing.&#xD;
- Quality of grading: almost 100% exact detection of mistakes and correct solutions.&#xD;
- Fight cheating: clear to identify question type &amp;#034;find missing code part&amp;#034; helps to ban help from friendly forums (such as this one).&#xD;
- Almost infinite variability of examples if whole docs system is engaged.&#xD;
- High range from very easy to very hard examples (exclusion of multiple functions and syntax can make this really hard).&#xD;
&#xD;
## Improvements:&#xD;
&#xD;
- Flexible scoring system based on function usage frequencies.&#xD;
- Optional placeholder as hint where the code is missing.&#xD;
- Using network of related functions (see above) to move smoothly through the topical domains.&#xD;
- Using functions frequency to feed easier or harder exercises based on test progress.&#xD;
&#xD;
***Please comment with your own thoughts and games and code!***&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-03-17at10.37.46AM.png&amp;amp;userId=11733&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-03-16at6.49.58PM.png&amp;amp;userId=11733&#xD;
  [3]: https://www.wolframcloud.com/objects/user-3c5d3268-040e-45d5-8ac1-25476e7870da/bughunter&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-03-16at6.58.45PM.png&amp;amp;userId=11733&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=sgfq354ythwrgsf.png&amp;amp;userId=11733&#xD;
  [6]: http://blog.wolfram.com/2017/03/16/the-rd-pipeline-continues-launching-version-11-1/&#xD;
  [7]: http://reference.wolfram.com/legacy/flash/&#xD;
  [8]: http://reference.wolfram.com/language/ref/Except.html&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-03-16at7.21.05PM.png&amp;amp;userId=11733&#xD;
  [10]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-03-16at7.25.52PM.png&amp;amp;userId=11733&#xD;
  [11]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-03-16at7.34.59PM.png&amp;amp;userId=11733&#xD;
  [12]: https://datadrop.wolframcloud.com/&#xD;
  [13]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-03-16at7.41.35PM.png&amp;amp;userId=11733&#xD;
  [14]: https://datadrop.wolframcloud.com/&#xD;
  [15]: https://www.wolfram.com/development-platform/&#xD;
  [16]: http://www.wolfram.com/cloud/</description>
    <dc:creator>Vitaliy Kaurov</dc:creator>
    <dc:date>2017-03-17T01:13:24Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/307516">
    <title>Fruit grid sums</title>
    <link>https://community.wolfram.com/groups/-/m/t/307516</link>
    <description>Knowing that it is horizontal and vertical sums, find the value of each fruit, you can actually do this?, as you would do because I give a long code and I think to do some shorter way, greetings to all&#xD;
&#xD;
![enter image description here][1]&#xD;
&#xD;
&#xD;
  [1]: /c/portal/getImageAttachment?filename=Pantallazo-3.png&amp;amp;userId=133435</description>
    <dc:creator>Luis Ledesma</dc:creator>
    <dc:date>2014-07-29T23:50:31Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2983903">
    <title>Solving Sudoku puzzles with Graph Theory</title>
    <link>https://community.wolfram.com/groups/-/m/t/2983903</link>
    <description>![enter image description here][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=SudokuBlog-heroimage.png&amp;amp;userId=2028758&#xD;
  [2]: https://www.wolframcloud.com/obj/b9ea0b6a-1200-4c69-bd69-1e27edaa0a1b</description>
    <dc:creator>Alejandra Ortiz Duran</dc:creator>
    <dc:date>2023-08-04T23:54:58Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2552665">
    <title>Project L board game analysis</title>
    <link>https://community.wolfram.com/groups/-/m/t/2552665</link>
    <description>In [recent investigations of multiway games][1], we generated more content than was really necessary to get the point across. In addition to [RandomSierpinskiMaze][2] (the subject of [another post][3]) the list of omissions also includes a few insightful results about the [Project L board game][4]. The purpose of this memo is to pose a problem about polyomino tilings in which summer school students have a chance of joining our efforts by reproducing our findings. If verifying reproducibility is not enough for the terribly ambitious, there is also chance for innovation and originality. My personal solution of the following problem did not use an optimal time algorithm, and more comprehensive analysis remains to be done if we can improve efficiency of our methodology. &#xD;
&#xD;
&#xD;
From a mathematical viewpoint the board game &amp;#034;Project L&amp;#034; simply asks players to solve exact cover problems given limited resources and time constraints. It is an &amp;#034;engine building&amp;#034; game in the sense that, as time progresses, players build up a collection of tiles, which are used as resources for completing puzzles. So let&amp;#039;s start there, with a complete depiction of all available resources, the polyomino pieces which are used to solve tiling puzzles: &#xD;
&#xD;
![project L pieces ][5]&#xD;
&#xD;
What we see here is a particularly nice, almost-symmetrical tiling comprised of yellow monominos, green dominos, orange and blue trominos, and five colors of tetrominos (yes, the tetris pieces). No one player ever has control over all pieces, so such an aggregation could never be created in game. In fact, the rules state that each player starts with one yellow monomino and one green domino, and it takes time and puzzles solved to build up a larger hand of tiles (probably not exceeding 20 pieces). &#xD;
&#xD;
Just to give you readers an idea how small and relatively easy the puzzles are, here is a sample of five taken from the entire set of 52 (digitized by yours truly): &#xD;
&#xD;
![puzzles][6]&#xD;
&#xD;
When a player solves such a puzzle by filling it in with polyomino pieces, they are awarded a new polyomino for their collection (top right) and possibly points toward their total score (top left). At the end of the game the player with the highest score wins (but the winning player can also be expected to have collected a pretty nice and diverse protfolio of tiles).&#xD;
&#xD;
If you look closely, each puzzle is characterized by three weight metrics: The number of points awarded in the top left corner, the grid size (or weight) of the polyomino reward piece, and the total &amp;#034;cost&amp;#034; to solve the puzzle, which is counted by the grid size of the recessed, white, inner regions. There is definitely a cost ~= reward balance in each of these puzzles, which we will return to shortly. &#xD;
&#xD;
Now before going any farther into game mechanics, let&amp;#039;s talk about classical mechanics. When someone gives you a finite, spendable resource, the first physical quantity you should think of is *energy*. Indeed, during the game, tiles are a form of energy, which are spent toward completing patterns at variable rates of *power*. When considering points taken per turn, and gauging against power, it also becomes possible to define *efficiency*. Luck aside, we generally assume that the most efficient players are the ones who should win the engine building games.&#xD;
&#xD;
Now, let us get to the games basic per turn mechanic. Each player&amp;#039;s turn consists of three consecutive actions, which are chosen from a list of energy-rated alternatives:  &#xD;
&#xD;
0. A puzzle is drawn from the bank at no cost.&#xD;
1. A tile of weight N is played into a puzzle. &#xD;
2. A tile of weight 1 is drawn from the bank. &#xD;
3. A tile of weight N is traded to the bank for another of max weight N+1.&#xD;
4. Multiple tiles of total weight X can be played into consecutive puzzles.&#xD;
&#xD;
The fourth alternative is the odd one out, and may only be used once per turn. Since total weight is a summation of up to four individual tile weights (players can have at max four puzzles on board), the play of X per one time interval is usually the player&amp;#039;s maximum power action. If used properly, &amp;#034;master actions&amp;#034; should lead to advantageous gains. But dominant play also requires one to know which are the best pieces to have in hand, and which are the best puzzles to have on board.&#xD;
&#xD;
Now for some insight toward winning the game, let&amp;#039;s define efficiency with regard to  gaining points. &#xD;
&#xD;
Assume that every point value P is in fact an expected time T = P to completion. The weight W of the interior puzzle can be considered an energy E = W, such that the nominal power rating of a puzzle is E / T = W / P. Now let&amp;#039;s call the actual time to completion T&amp;#039; and the actual completion power W / T&amp;#039;, such that the efficiency of solving is simply P / T&amp;#039;. In this definition, efficiency can also be thought of as a scale factor: actual completion power = efficiency * nominal completion power [W/T&amp;#039; = (P/T&amp;#039;)*W/P ].  &#xD;
&#xD;
According to my comprehensive data analysis, most puzzles in the game are balanced such that P / T&amp;#039; is less than or equal to one. However, all 5-point puzzles (and a few more at 3, 4 points) allow that P / T&amp;#039; can be greater than one. Quite obviously, such puzzles are desirable to have on board during the end game when &amp;#034;engine building&amp;#034; is no longer as important as &amp;#034;engine spending&amp;#034;.&#xD;
&#xD;
So finally, we&amp;#039;re done with a practical, real-life example set up, and we are motivated to find out all the possible ways that five point puzzles from Project L can be solved with a relative efficiency greater than one. Here they are, the particular five point puzzles: &#xD;
&#xD;
![enter image description here][7]&#xD;
&#xD;
     &#xD;
    rawData={{{1, 0, 0, 1, 1}, {1, 0, 0, 0, 0}, {1, 0, 0, 0, 0}, {0, 0, 0, 0, &#xD;
       1}, {1, 1, 0, 0, 1}}, {{0, 0, 0, 0, 1}, {0, 0, 0, 0, 1}, {1, 0, 0, &#xD;
       0, 0}, {1, 0, 0, 0, 0}, {1, 1, 1, 1, 1}}, {{1, 0, 0, 0, 1}, {0, 0, &#xD;
       0, 0, 0}, {0, 0, 0, 0, 0}, {1, 0, 0, 0, 1}, {1, 1, 1, 1, 1}}, {{0, &#xD;
       0, 0, 0, 1}, {1, 0, 0, 0, 0}, {1, 0, 0, 0, 0}, {0, 0, 0, 0, 1}, {1,&#xD;
        1, 1, 1, 1}}, {{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, &#xD;
       0}, {1, 1, 0, 1, 1}, {1, 1, 1, 1, 1}}};&#xD;
&#xD;
But the challenge is not only to solve these puzzles in all possible ways (assuming maximum efficiency), but also to give a quantitative comparison of the most useful tetrominos when attempting to do so! Which tetromino is most useful in the end game of Project L?&#xD;
&#xD;
HINT: it is possible to modify [MultiwayDeletionsGraph][8] to solve this problem (what I did), but it would probably be faster to implement D. Knuth&amp;#039;s [Dancing Links][9]. Extra Credit: If it is possible to implement DLX, what is the graph structure on which the DLX backtracker operates? &#xD;
&#xD;
&#xD;
  [1]: https://writings.stephenwolfram.com/2022/06/games-and-puzzles-as-multicomputational-systems/&#xD;
  [2]: https://resources.wolframcloud.com/FunctionRepository/resources/RandomSierpinskiMaze/&#xD;
  [3]: https://community.wolfram.com/groups/-/m/t/2506196&#xD;
  [4]: https://www.youtube.com/watch?v=nCOJigSozSE&#xD;
  [5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=peices.png&amp;amp;userId=234448&#xD;
  [6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=puzzles.png&amp;amp;userId=234448&#xD;
  [7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=fivepointers.png&amp;amp;userId=234448&#xD;
  [8]: https://resources.wolframcloud.com/FunctionRepository/resources/MultiwayDeletionsGraph/&#xD;
  [9]: https://arxiv.org/abs/cs/0011047</description>
    <dc:creator>Brad Klee</dc:creator>
    <dc:date>2022-06-18T02:18:56Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2417276">
    <title>Understanding Graphics3D&amp;#039;s view options: the intuitive way</title>
    <link>https://community.wolfram.com/groups/-/m/t/2417276</link>
    <description>![Graphics3D with anchored rotation axis][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ViewPoint.gif&amp;amp;userId=93201&#xD;
  [2]: https://www.wolframcloud.com/obj/586d1953-bb18-4697-aa0a-6fe757a33fa3&#xD;
&#xD;
&#xD;
  [Original NB]: https://www.wolframcloud.com/obj/a3f6b88f-6f46-4015-b64d-9b824b36ee10</description>
    <dc:creator>Silvia Hao</dc:creator>
    <dc:date>2021-12-01T19:32:46Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2164714">
    <title>Drawing a chess position from FEN (Forsyth&amp;#x2013;Edwards Notation)</title>
    <link>https://community.wolfram.com/groups/-/m/t/2164714</link>
    <description>![enter image description here][1]&#xD;
&#xD;
I&amp;#039;m sure there have been many proposals on how to do this.  I gave it a try, and after a few painful attempts I came up with a visually decent result, without too much code (IMHO). Also I really wanted to use unicode symbols, not drawing of pieces found on the web.&#xD;
&#xD;
&amp;amp;[chess.nb][2]&#xD;
&#xD;
TODO:&#xD;
&#xD;
 - Avoid using a hard-coded font size ;&#xD;
 - White pieces should not look &amp;#034;transparent&amp;#034; on a dark square.&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2021-01-20at11.26.07AM.jpg&amp;amp;userId=11733&#xD;
  [2]: https://www.wolframcloud.com/obj/d1a7c97f-e00d-4519-ac7c-7d953f8c96aa</description>
    <dc:creator>Lucien Grondin</dc:creator>
    <dc:date>2021-01-16T13:12:04Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/596537">
    <title>Help with Halloween costumes</title>
    <link>https://community.wolfram.com/groups/-/m/t/596537</link>
    <description>Every year our family makes costumes, and this time we are making &amp;#034;the world&amp;#034; and an &amp;#034;oak tree&amp;#034;.  Does anyone have any ideas for doing these in Wolfram Language?&#xD;
&#xD;
Maybe for the world, I am thinking of projecting the map of the world onto two halves of an icosahedron.   One half attached to the front of a shirt and the other half attached to the back. I am close on this part, but maybe it has become too complicated.  Something Is wrong here, and this approach also involves more cutting and taping than I would prefer.&#xD;
&#xD;
    ToMapCoordinates[v_] := N[ToPolarCoordinates[v][[{3, 2}]]/Degree]&#xD;
    verts = Map[ToMapCoordinates,  PolyhedronData[&amp;#034;Icosahedron&amp;#034;, &amp;#034;VertexCoordinates&amp;#034;]];&#xD;
    GeoTriangle[{a_, b_, c_}] := GeoGraphics[Polygon[{a, b, c}]]&#xD;
    GeoTriangle[verts[[#]]] &amp;amp; /@  PolyhedronData[&amp;#034;Icosahedron&amp;#034;, &amp;#034;FaceIndices&amp;#034;]&#xD;
&#xD;
For the oak tree, I was trying to make oak leaves and acorns using PolarPlot.  Does anyone have an Oak leaf?  Here is my attempt at an acorn.&#xD;
&#xD;
    PolarPlot[1.4 - CubeRoot[1 + Sin[x]], {x, 0, 2 Pi}]&#xD;
    &#xD;
![acorn][1]&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=acorn-fruit-image.jpg&amp;amp;userId=23275</description>
    <dc:creator>Todd Rowland</dc:creator>
    <dc:date>2015-10-24T14:51:08Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1380021">
    <title>[WSS18] Generating Music with Expressive Timing and Dynamics</title>
    <link>https://community.wolfram.com/groups/-/m/t/1380021</link>
    <description>![Cover][1]&#xD;
&#xD;
## Goal ##&#xD;
There are many ways to generate music and one of them is algorithmic, where music is generated with the help of a list of handcrafted rules.    &#xD;
&#xD;
The approach in this project is different - I build a neural network that knows nothing about music but learns it from thousands of songs given in MIDI format.&#xD;
    &#xD;
_Apart from just generating a meaningful sequence of notes I also wanted to add **dynamics** in loudness and humanlike mistakes in timing with **no restrictions for note durations**._&#xD;
&#xD;
 - **Why dynamics and timing?**  &#xD;
There is no human who is able to play on a musical instrument with precisely the same loudness and strictly in time with a metronome(at least I can&amp;#039;t). People do mistakes, but in the case of music, they are helping in creating what we call more alive music. It is a fact that dynamic music with slight time shifts sounds more interesting, so even when you write music in a program you supposed to add these &amp;#034;mistakes&amp;#034; by yourself.&#xD;
&#xD;
  - **Why performances?**  &#xD;
The dataset that I use for the project contains performances of [Yamaha e-piano competition][2] participants. This gives us a possibility to learn the dynamics and mistakes in timings.&#xD;
&#xD;
__Here&amp;#039;s an [example][3] generated by the model.__&#xD;
&#xD;
All the code, data and trained models can be found on [GitHub][32]. &#xD;
&#xD;
The examples will be attached to this post as files just in case.&#xD;
&#xD;
----------&#xD;
## Inspiration ##&#xD;
This is not an original work and mostly it&amp;#039;s an attempt to recreate the work of [Magenta][4] team from their blog [post][5]. &#xD;
&#xD;
Nevertheless, in this post, I will try to add more details to the **preprocessing** steps and how you can build a similar neural network model in Wolfram Language.&#xD;
&#xD;
## Data ##&#xD;
I&amp;#039;ve used a [site][6] that has the Yamaha e-piano performances but also contains a set of classic and jazz compositions.&#xD;
 &#xD;
In the original [work][7] Magenta team has used only the Yamaha dataset but with a heavy augmentation on top of that: Time-stretching (making each performance up to 5% faster or slower), Transposition (raising or lowering the pitch of each performance by up to a major third).&#xD;
&#xD;
Also, you can create your own list of MIDI files and build a dataset with the help of the code provided below in the post.    &#xD;
Here are links to find a lot of free MIDI songs: [The Lakh MIDI Dataset][8](very well prepared a dataset for ML projects), [MidiWorld][9] and [FreeMidi][10]&#xD;
&#xD;
## MIDI ##&#xD;
MIDI is short for Musical Instrument Digital Interface. Its a language that allows computers, musical instruments, and other hardware to communicate.&#xD;
MIDI carries event messages that specify musical notation, pitch, velocity, vibrato, panning, and clock signals (which set tempo).&#xD;
&#xD;
_For the project, we need only events that denote where is every note starts/ends and with what are velocity and pitch._&#xD;
&#xD;
## Preprocessing The Data ##&#xD;
Even though MIDI is already a digital representation of music, we can&amp;#039;t just take raw bytes of a file and feed it to an ML model as in the case of the models working with images. First of all, images and music are conceptually different tasks: the first is a single event(data) per item(an image), the second is a sequence of events per item(a song). Another reason is that raw MIDI representation and a single MIDI event itself contain a lot of irrelevant information to our task.&#xD;
&#xD;
Thus we need a special data representation, a MIDI-like stream of musical events. Specifically, I use the following set of events:&#xD;
&#xD;
- 88 **note-on** events, one for each of the 88 MIDI pitches of piano range. These events start a new note.&#xD;
- 88 **note-off** events, one for each of the 88 MIDI pitches of piano range. These events release a note.&#xD;
- 100 **time-shift** events in increments of 10 ms up to 1 second. These events move forward in time to the next note event.&#xD;
- 34 **velocity** events, corresponding to MIDI velocities quantized into 32 bins. These events change the velocity applied to subsequent notes.&#xD;
&#xD;
The neural network operates on a one-hot encoding over these 310 different events. This is the very same representation as in the original work but the number of note-on/note-off is fewer, I encode 88 notes in piano range instead of 127 notes in MIDI pitch range to reduce one-hot encoding vector size and make the process of learning easier.&#xD;
&#xD;
**For example**, if you want to encode 4 notes from C major with durations of a half second and with different velocities your sequence of events would be somewhat like this(for clarity I use only indices instead of the whole one-hot encoding):    &#xD;
&#xD;
`{288, 60, 226, 148, 277,  62, 226, 150, 300, 64, 226, 152, 310, 67, 226, 155}`&#xD;
![Preprocessing encoding C major example][11]&#xD;
&#xD;
In this particular example:    &#xD;
- _60, 62, 64, 67_ are **note on** events(C5,  D5, E5, G5). Values in a range from 1 to 88.    &#xD;
- _148, 150, 152, 155_ are **note off** events. Values in a range from 89 to 176.    &#xD;
- _226_ is a half second **time shift** event. Values in a range from 177 = 10 ms to 276 = 1 sec.  &#xD;
- _288, 277, 300, 310_ are **velocity** events. Values in a range from 277 to 310.&#xD;
&#xD;
In this way, you can encode music that is expressive in dynamics and timing.    &#xD;
Now, let&amp;#039;s take a look on another example with a chord from the same notes but with different durations:&#xD;
&#xD;
`{300, 60, 62, 64, 67, 226, 152, 155, 226, 150, 226, 148}`&#xD;
![C major chord][12]    &#xD;
As you can see, if you want to play more than one note at once you just need to put them in a single bunch of note-on events(60, 62, 64, 67).    &#xD;
Then you add time shift and note-off events as you needed. If you need a duration longer than 1 sec you can stack together more than one time-shift events({310, 310} = 2 sec time-shift).&#xD;
&#xD;
**WL and MIDI**&#xD;
&#xD;
Wolfram Language has a **built-in** support of MIDI files what is really simplifying initial work.    &#xD;
To get data from MIDI file you need to import it with specific elements:&#xD;
![WL MIDI Import Elements][13]    &#xD;
In the code below I also extract and calculate needed information related to a tempo of a song.&#xD;
&#xD;
	{raw, header} = Import[path, #]&amp;amp; /@ {&amp;#034;RawData&amp;#034;, &amp;#034;Header&amp;#034;};&#xD;
&#xD;
	tempos = Cases[Flatten[raw], HoldPattern[&amp;#034;SetTempo&amp;#034; -&amp;gt; tempo_] :&amp;gt; tempo];&#xD;
&#xD;
	microsecondsPerBeat = If[Length@tempos &amp;gt; 0, First[tempos], 500000]; (* If there is no explicit tempo we use default 120 bpm *)&#xD;
	&#xD;
	timeDivision = First@Cases[header, HoldPattern[&amp;#034;TimeDivision&amp;#034; -&amp;gt; division_] :&amp;gt; division];&#xD;
    (* Convert timeDivision value to base of 2 *)&#xD;
	timeDivisionBits = IntegerDigits[timeDivision, 2];&#xD;
    (* Pad zeros at the beginning if the value takes less then 16 bits *)&#xD;
	timeDivisionBits = If[Length@timeDivisionBits &amp;lt; 16, PadLeft[timeDivisionBits, 16], timeDivisionBits]; &#xD;
    (* The top bit responsible for the type of TimeDivision *)&#xD;
	timeDivisionType = timeDivisionBits[[1]];&#xD;
	framesPerSecond = timeDivisionBits[[2 ;; 8]];&#xD;
	ticksPerFrame = timeDivisionBits[[9 ;; 16]];&#xD;
	&#xD;
	ticksPerBeat = If[timeDivisionType == 0, timeDivision, 10^6 /(framesPerSecond * ticksPerFrame)];&#xD;
	&#xD;
	secondsPerTick = (microsecondsPerBeat / ticksPerBeat) * 10^-6.;&#xD;
&#xD;
An example of raw data and header info from MIDI file in Wolfram Language:    &#xD;
![Raw MIDI output][14]    &#xD;
**SetTempo** is a number of microseconds per beat(microseconds per quarter note).    &#xD;
**Time Division** has two type of interpreting. If the top bit is 0 then the type is &amp;#034;ticks per beat&amp;#034; (or pulses per quarter note) otherwise, the type is &amp;#034;frames per second&amp;#034;. We need those two values to calculate time per one **MIDI tick** that used in MIDI events as a time measurement. &#xD;
&#xD;
One MIDI event in WL representation looks like this&#xD;
&#xD;
`{56, {9, 0}, {46, 83}}`&#xD;
&#xD;
- 56 is a number of **MIDI ticks** that means the total amount of time that must pass from the previous MIDI event.    &#xD;
It represents our **time-shift** event by simple multiplication of this number with **secondsPerTick**.&#xD;
- 9 is a status byte of MIDI events(9,8 are **note-on**, **note-off** respectively).&#xD;
- 0 is MIDI channel(irrelevant for us).&#xD;
- 46 indicates what is a pitch of this note(related to **note-on**/**note-off** events).&#xD;
- 83 is a number we encode in a **velocity** event.&#xD;
&#xD;
If you want to understand how a real raw MIDI data structured, this [blog][15] is specifically useful.&#xD;
&#xD;
Now, what we need is to parse a sequence of MIDI events and filter them only for events that are **note-on**, **note-off** and all the events that have the number of **MIDI ticks** greater than 0. Some of the meta-messages have irrelevant MIDI ticks thus we need to exclude them from final sequence - we just skip the events with value **F**(Meta message) in the MIDI status byte.&#xD;
&#xD;
After filtering MIDI data you get a sequence that is ready to be encoded to the final representation and will be fed to the model.&#xD;
![Filtered MIDI events][16]    &#xD;
&#xD;
To encode the sequence of MIDI events to the final representation I use the code below:&#xD;
&#xD;
    EncodeMidi[track_, secondsPerTick_] := Block[{lastVelocity = 0},&#xD;
      ClearAll[list];&#xD;
      Flatten[&#xD;
        Map[&#xD;
          Block[{list = {}},&#xD;
          (* Add time shifts when needed *)&#xD;
            If[TimeShiftByte[#, secondsPerTick] &amp;gt; 0, list = Join[list, EncodeTimeShift[TimeShiftByte[#, secondsPerTick]]]];&#xD;
    &#xD;
            (* Proceed with logic only if it&amp;#039;s a note event *)&#xD;
            If[StatusByte[#] == NoteOnByte || StatusByte[#] == NoteOffByte,&#xD;
    &#xD;
            (* Add velocity if it&amp;#039;s different from the last seen *)&#xD;
              If[lastVelocity != QuantizedVelocity[VelocityByte[#]] &amp;amp;&amp;amp; StatusByte[#] == NoteOnByte,&#xD;
    &#xD;
                lastVelocity = QuantizedVelocity[VelocityByte[#]];&#xD;
                list = Join[list, List[EncodeVelocity[VelocityByte[#]]]];&#xD;
              ];&#xD;
    &#xD;
              (* Add note event *)&#xD;
              list = Join[list, List[EncodeNote[NoteByte[#], StatusByte[#] == NoteOnByte]]];&#xD;
            ];&#xD;
    &#xD;
            (* Return encoded list*)&#xD;
            list&#xD;
          ]&amp;amp;,&#xD;
          track]&#xD;
        , 1]];&#xD;
&#xD;
This code has a lot of functions that I&amp;#039;ve written during the summer school but they are mostly utility short functions.&#xD;
You can check them and complete implementation on [GitHub][17].    &#xD;
&#xD;
When the code for the preprocessing is ready it&amp;#039;s time to build a dataset.&#xD;
&#xD;
**Building Dataset**&#xD;
&#xD;
I&amp;#039;ve made a [notebook][18] that takes care of preprocessing of MIDI files and encode them into the final representation.&#xD;
&#xD;
    (* Take all files names in Midi folder *)&#xD;
    files = FileNames[&amp;#034;*&amp;#034;, NotebookDirectory[] &amp;lt;&amp;gt; &amp;#034;Midi&amp;#034;];&#xD;
    dataset = Flatten[EncodeTrack /@ files, 1];&#xD;
&#xD;
During the encoding, each track is partitioning into smaller segments:&#xD;
&#xD;
    encodings = Partition[EncodeMidi[GetMidiEvents[raw, secondsPerTick], secondsPerTick], 500];&#xD;
&#xD;
In the original work, Magenta team split each song into 30-second segments to keep each example of manageable size. The problem is that partition by equal time doesn&amp;#039;t give you the equal size of examples. Even though you can use varying input size in sequence models I wanted to use a static size of examples to speed up the training process. I was told that internally in WL(or maybe everywhere) it&amp;#039;s more efficient to have the same size of every example for a model.    &#xD;
However, I believe this kind of partition has a drawback, in a way that an equal number of encoded events could have a different duration in time thus adding inconsistency in the dataset.&#xD;
&#xD;
In my case, I&amp;#039;ve divided each song into segments of 500 encoded events.&#xD;
![One Song Final Encoding][19]    &#xD;
To reduce the size of the final dataset I use only indices for one-hot encodings.    &#xD;
As the result, the final dimension of my dataset was **{99285, 500}**&#xD;
&#xD;
If you want to try partition by the time you need to edit `EncodeTrack` function in [`Midi.m`][20].    &#xD;
With this code, you will find positions of where to split a sequence on equal time segments:&#xD;
&#xD;
    GetTimePositions[track_, seconds_, secondsPerTick_] := &#xD;
     Block[{positions = {}, time = 0},&#xD;
      Do[&#xD;
       time = time + track[[i]][[1]] * secondsPerTick;&#xD;
       If[time &amp;gt; seconds, positions = Append[positions, i]; time = 0;],&#xD;
       {i, Length@track}];&#xD;
      positions&#xD;
      ]&#xD;
&#xD;
Where parameter `track` is a sequence of MIDI events. Then you split the same `track` with the positions you&amp;#039;ve got from the function.&#xD;
&#xD;
    segments = FoldPairList[TakeDrop, track, positions];&#xD;
&#xD;
After that, you need to encode `segments` with the help of `EncodeMidi` function. If you do that there is one thing left - rework the model to accept varying input size but the next part will cover how to build a model with a static size of example.&#xD;
&#xD;
----------&#xD;
&#xD;
## Building a Model ##&#xD;
Because music data is a sequence of events we need an architecture that knows how to remember, and predicts what is the next event based on all previous. This is exactly what Recurrent Neural Networks try to do - RNNs can use their internal state (memory) to process sequences of inputs. If you want to check more details I would recommend to watch this [introduction][21] video.&#xD;
&#xD;
On the abstract level, RNN learns the probabilities of events that follow after each other. Take for example this language model from Wolfram Neural Repository, it predicts the next character of a given sequence.&#xD;
&#xD;
    NetModel[&amp;#034;Wolfram English Character-Level Language Model V1&amp;#034;][&amp;#034;hello worl&amp;#034;]&#xD;
&#xD;
The output is **d**.&#xD;
&#xD;
You can get top 5 probabilities if you want.&#xD;
&#xD;
    NetModel[&amp;#034;Wolfram English Character-Level Language Model V1&amp;#034;][&amp;#034;hello worl&amp;#034;, {&amp;#034;TopProbabilities&amp;#034;, 5}]&#xD;
You will get:&#xD;
&#xD;
    {&amp;#034;d&amp;#034; -&amp;gt; 0.980898, &amp;#034;e&amp;#034; -&amp;gt; 0.00808785, &amp;#034;h&amp;#034; -&amp;gt; 0.0045687,  &amp;#034; &amp;#034; -&amp;gt; 0.00143807, &amp;#034;l&amp;#034; -&amp;gt; 0.000681855}&#xD;
&#xD;
In my work, I needed similar behavior but instead of characters, I wanted to predict encoded MIDI events. That is why the basis of the model I build is [Wolfram English Character-Level Language Model V1][22]. Also, after reading a [guide][23] about sequence learning with neural networks in WL I&amp;#039;ve decided to improve the training process with &amp;#034;teacher forcing&amp;#034; technique.&#xD;
&#xD;
**Teacher Forcing**&#xD;
&#xD;
In a simple language model, a model takes the last prediction from an input sequence and compute the class of it. But for &amp;#034;teacher forcing&amp;#034; we need to get classes of all predictions.&#xD;
&#xD;
![Model comparison][24]&#xD;
&#xD;
Comparatively to the language model I&amp;#039;ve removed one `GatedReccurentLayer` and `Dropoutlayer` due to the not so big dataset(as precautions to avoid overfitting). Another benefit of using &amp;#034;teacher forcing&amp;#034; is that you don&amp;#039;t need to separately create labels for every example. To compute the loss we make out of an input example two sequences:&#xD;
&#xD;
1. Everything but the **last** element(Sequence**Most**Layer)&#xD;
2. Everything but the **first** element(Sequence**Rest**Layer)&#xD;
&#xD;
![Teacher Forcing Net][25]&#xD;
&#xD;
As you can notice the input is only one vector of indices with size 500 and labels for computing the loss are generating inside of a `NetGraph`.&#xD;
Here is a visualized example of the flow with simple input:&#xD;
&#xD;
![Input flow explanation][26]&#xD;
&#xD;
You can find the code for creating the model in this [PerfrormanceRnnModel][27] notebook. &#xD;
After all the data is ready and the model is finalized we can start training.&#xD;
&#xD;
    NetTrain[teacherForcingNet, &#xD;
     	&amp;lt;|&amp;#034;Input&amp;#034; -&amp;gt; dataTrain|&amp;gt;, &#xD;
     	All, &#xD;
     	TrainingProgressCheckpointing -&amp;gt; {&amp;#034;File&amp;#034;,  checkPointDir,  &amp;#034;Interval&amp;#034; -&amp;gt; Quantity[5, &amp;#034;Minutes&amp;#034;]},&#xD;
     	BatchSize -&amp;gt; 64, &#xD;
     	MaxTrainingRounds -&amp;gt; 10,&#xD;
     	TargetDevice -&amp;gt; &amp;#034;GPU&amp;#034;,  (* Use CPU if you don&amp;#039;t have Nvidia GPU *)&#xD;
     	ValidationSet -&amp;gt; &amp;lt;|&amp;#034;Input&amp;#034; -&amp;gt; dataValidate|&amp;gt;&#xD;
     ]&#xD;
A friendly advice - it&amp;#039;s better to use **&amp;#034;Checkpoining&amp;#034;** during the training. This will keep your mental health safe and will work as assurance that all training progress is saved.&#xD;
&#xD;
I was training the model 30 rounds and it took around 4-5 hours on AWS&amp;#039; GPUs.&#xD;
First 10-15 rounds weren&amp;#039;t showing any sight of problems but later training clearly started to overfit.&#xD;
![Training loss][28]&#xD;
&#xD;
Unfortunately, I haven&amp;#039;t had time to fix this problem because of the limited time but to overcome this problem I might reduce the size of GRUs from 512 to 256 and return Dropout layer.&#xD;
&#xD;
## Generate Music ##&#xD;
To generate music we need a model that predicts the next event in a sequence as it was in the language model. To do that I take the trained model and extract out of it &amp;#034;PerformanceRNN Predict Model&amp;#034; part.&#xD;
&#xD;
    predictNet = NetExtract[trainedNet, &amp;#034;predict&amp;#034;];&#xD;
&#xD;
Next step is to convert this `predictNet` to a model that takes varying input size and return the class of the next event.&#xD;
&#xD;
    generateModel = NetJoin[NetTake[predictNet, 3], {&#xD;
      SequenceLastLayer[],&#xD;
      NetExtract[predictNet, {4, &amp;#034;Net&amp;#034;}],&#xD;
      SoftmaxLayer[]},&#xD;
     &amp;#034;Input&amp;#034; -&amp;gt;  Automatic,&#xD;
     &amp;#034;Output&amp;#034; -&amp;gt; NetDecoder[{&amp;#034;Class&amp;#034;, Range[310]}]&#xD;
     ]&#xD;
&#xD;
The resulting architecture is pretty the same as the language model from which I&amp;#039;ve started - it takes a sequence with varying size of encoded MIDI events `{177, 60, 90}` and predicts what could be next event `{177, 60, 90, ?}`.&#xD;
&#xD;
![Model Comparison(Generation)][29]&#xD;
&#xD;
**Now, let&amp;#039;s the fun begin!**&#xD;
&#xD;
    generateDemo[net_, start_, len_] :=  Block[{obj = NetStateObject[net]}, &#xD;
     Join@NestList[{obj[#, &amp;#034;RandomSample&amp;#034;]} &amp;amp;, start, len]&#xD;
    ]&#xD;
&#xD;
This small function is all we need to generate a sequence of the desired length.    &#xD;
&#xD;
`NetStateObject` helps to keep track of all sequences that were applied to the network, meaning every next prediction is the result of all previous events not only the recent one.&#xD;
&#xD;
`start` should be a sequence of encoded MIDI events. It also can be a single item sequence, say you want to start from a pause or a particular note. This is a possibility to some extent put the generation process in a particular direction.&#xD;
&#xD;
Okay, two lines of code left and you can hear play with generating of music:&#xD;
&#xD;
    generatedSequence = Flatten[generateDemo[generateModel,  {60, 216, 148,  62, 200, 150, 64, 236, 152, 67, 198, 155}, 500]];&#xD;
    ToSound[generatedSequence]&#xD;
&#xD;
These are other examples: [2][30], [3][31].    &#xD;
You can generate your own demos if download [repository][32] and open [PerformanceRNN][33] notebook.&#xD;
&#xD;
## Further Work ##&#xD;
That was a very fun and challenging task for me. I can&amp;#039;t say that I&amp;#039;m satisfied with the results but this a good start and I have a direction now.&#xD;
What I want to explore is Variational Autoencoder, especially [MusicVAE][34] that is made by the same Magenta team.&#xD;
&#xD;
However, I&amp;#039;ll start with improving the existing model by changing the architecture and cleaning the dataset to have only performances from the Yamaha dataset.&#xD;
&#xD;
Thank you for reading the post, and feel free to ask any questions.&#xD;
&#xD;
![Peace!][35]&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=2433article_cover.png&amp;amp;userId=1352227&#xD;
  [2]: http://www.piano-e-competition.com&#xD;
  [3]: https://drive.google.com/open?id=1I7l6hrecWsuMxqvEdUiRWtg6N6NCW34R&#xD;
  [4]: https://magenta.tensorflow.org/&#xD;
  [5]: https://magenta.tensorflow.org/performance-rnn&#xD;
  [6]: http://www.kuhmann.com/Yamaha.htm&#xD;
  [7]: https://github.com/tensorflow/magenta/tree/master/magenta/models/performance_rnn&#xD;
  [8]: http://colinraffel.com/projects/lmd/&#xD;
  [9]: http://www.midiworld.com/&#xD;
  [10]: https://freemidi.org/&#xD;
  [11]: http://community.wolfram.com//c/portal/getImageAttachment?filename=5707Preprocessing_explanation.png&amp;amp;userId=1352227&#xD;
  [12]: http://community.wolfram.com//c/portal/getImageAttachment?filename=6109Prep_ex_2.png&amp;amp;userId=1352227&#xD;
  [13]: http://community.wolfram.com//c/portal/getImageAttachment?filename=MIDIimportelements.png&amp;amp;userId=1352227&#xD;
  [14]: http://community.wolfram.com//c/portal/getImageAttachment?filename=7717raw_midi_output.png&amp;amp;userId=1352227&#xD;
  [15]: http://www.recordingblogs.com/wiki/musical-instrument-digital-interface-midi&#xD;
  [16]: http://community.wolfram.com//c/portal/getImageAttachment?filename=filtered_midi_events.png&amp;amp;userId=1352227&#xD;
  [17]: https://github.com/Apisov/Performance-RNN-WL/blob/master/Project/Midi.m&#xD;
  [18]: https://github.com/Apisov/Performance-RNN-WL/blob/master/BuildData.nb&#xD;
  [19]: http://community.wolfram.com//c/portal/getImageAttachment?filename=One_track_final_encoding.png&amp;amp;userId=1352227&#xD;
  [20]: https://github.com/Apisov/Performance-RNN-WL/blob/master/Project/Midi.m&#xD;
  [21]: http://www.wolfram.com/wolfram-u/catalog/wl036/&#xD;
  [22]: https://resources.wolframcloud.com/NeuralNetRepository/resources/Wolfram-English-Character-Level-Language-Model-V1&#xD;
  [23]: http://reference.wolfram.com/language/tutorial/NeuralNetworksSequenceLearning.html#1013067167&#xD;
  [24]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Modelcomparison.png&amp;amp;userId=1352227&#xD;
  [25]: http://community.wolfram.com//c/portal/getImageAttachment?filename=3750Teacher_forcing.png&amp;amp;userId=1352227&#xD;
  [26]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Teacher_forcing_explanation.png&amp;amp;userId=1352227&#xD;
  [27]: https://github.com/Apisov/Performance-RNN-WL/blob/master/PerformanceRNNModel.nb&#xD;
  [28]: http://community.wolfram.com//c/portal/getImageAttachment?filename=raw_midi.png&amp;amp;userId=1352227&#xD;
  [29]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Modelcomparison%28Generation%29.png&amp;amp;userId=1352227&#xD;
  [30]: https://drive.google.com/open?id=1GtlaOtTF_9rHiDVsrqmLnUaKCSAva1dP&#xD;
  [31]: https://drive.google.com/open?id=1sEihbFJw4XbVZveYl8efoM8Ivq8781ar&#xD;
  [32]: https://github.com/Apisov/Performance-RNN-WL&#xD;
  [33]: https://github.com/Apisov/Performance-RNN-WL/blob/master/PerformanceRNN.nb&#xD;
  [34]: https://magenta.tensorflow.org/music-vae&#xD;
  [35]: http://community.wolfram.com//c/portal/getImageAttachment?filename=d2eedc8a1ea8fc6a62e23b151c7fb3675c8153cc.png&amp;amp;userId=1352227</description>
    <dc:creator>Pavlo Apisov</dc:creator>
    <dc:date>2018-07-11T21:20:56Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/587562">
    <title>Unpredictable Solar Systems</title>
    <link>https://community.wolfram.com/groups/-/m/t/587562</link>
    <description>Are there solar systems with chaotic orbits?  When astronomers look for exoplanets they look for periodic signals in the brightness of the central star.  The analysis relies on predictable behaviors. But I have always wondered whether there are unpredictable solar systems out there.  &#xD;
&#xD;
The reason for posting this now is the [news][1] of a star whose signal appears to be unpredictable (KIC 8462852).  Some articles have suggested this is due to [aliens][2].  On the other hand, Stephen Wolfram has said many times (e.g. in his [New Kind of Science][3] book) that it is pretty easy for nature to produce unpredictable sequences, and regular signals would be a better sign of civilization.&#xD;
&#xD;
You can simulate hypothetical solar systems relatively easily in Wolfram language (search the demonstrations for [three body problem][4]).  At the [Wolfram Science Summer School][5] in 2013, [Nicholas Lucas][6] did a systematic survey.  He produced a nice phase-space type of diagram and in the process found a class of behaviors which were not regular in any sense except that all of the planets did not fly away.  The possibility of planets zooming off to infinity is a possible explanation for the prevalence of regularity and order (at least when stars are far apart).  This is an example of an irregular solution:&#xD;
&#xD;
![irregular paths of 3 bodies][7]&#xD;
&#xD;
This code is a simple two body version:&#xD;
&#xD;
    s = NDSolve[{x&amp;#039;&amp;#039;[t] == 8 (y[t] - x[t])/Norm[y[t] - x[t]]^3, y&amp;#039;&amp;#039;[t] == 8 (x[t] - y[t])/Norm[x[t] - y[t]]^3,&#xD;
         x[0] == {-2, 0, 0}, y[0] == {2, 0, 0}, x&amp;#039;[0] == {0, 1, 0}, y&amp;#039;[0] == {0, -1, 0}}, {x, y}, {t, 0, 4}][[1]];&#xD;
    ParametricPlot3D[{Evaluate[x[t] /. s], Evaluate[y[t] /. s]}, {t, 0, 4}]&#xD;
&#xD;
Theoretically, from the study of simple rules (see Wolfram&amp;#039;s [book][8]), one expects the possibility of [long transients][9], but also that most transients are short.  From Wolfram&amp;#039;s [principle of computational equivalence][10], one expects that solar system dynamics can be computationally universal even from simple initial conditions (for more see Wolfram&amp;#039;s [note][11]).&#xD;
&#xD;
Maybe someone on Community knows more about this star.  Is there data out there for KIC 8462852?  In principle one should be able to take the orbital paths from a simulation and derive the brightness signal that someone would see from Earth, and do it systematically.&#xD;
&#xD;
&#xD;
  [1]: http://www.skyandtelescope.com/astronomy-news/curious-case-of-kic-8462852-102020155/&#xD;
  [2]: http://www.nbcnews.com/tech/innovation/have-scientists-discovered-alien-civilization-not-so-fast-n445161&#xD;
  [3]: http://www.wolframscience.com/nksonline/page-822&#xD;
  [4]: http://demonstrations.wolfram.com/search.html?query=three%20body&#xD;
  [5]: https://www.wolframscience.com/summerschool/&#xD;
  [6]: https://www.wolframscience.com/summerschool/2013/alumni/lucas.html&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=alien-Kepler.png&amp;amp;userId=23275&#xD;
  [8]: http://www.wolframscience.com/nksonline/toc.html&#xD;
  [9]: http://www.wolframscience.com/nksonline/page-754&#xD;
  [10]: http://www.wolframscience.com/nksonline/page-715&#xD;
  [11]: http://www.wolframscience.com/nksonline/page-972d-text</description>
    <dc:creator>Todd Rowland</dc:creator>
    <dc:date>2015-10-21T18:00:43Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/328726">
    <title>Multiple solutions problem! HELP!!!</title>
    <link>https://community.wolfram.com/groups/-/m/t/328726</link>
    <description>&amp;lt;a target=&amp;#034;_blank&amp;#034; href=&amp;#034;http://imageshack.com/f/f0Ut7L49p&amp;#034;&amp;gt;&amp;lt;img src=&amp;#034;http://imagizer.imageshack.us/v2/280x200q90/540/Ut7L49.png&amp;#034; border=&amp;#034;0&amp;#034;&amp;gt;&amp;lt;/a&amp;gt;&#xD;
&#xD;
&#xD;
Can someone help me?&#xD;
I&amp;#039;ve solved a simple first order conditions system with different values of A.&#xD;
I get then a equilibrium couple of X and Y for each value of A i&amp;#039;m interested in.&#xD;
What i want to add in my last computation is the value of p for each equilibrium couple!&#xD;
Is it possible?&#xD;
Mathematica should understand to substitute, for each value of A, the equilibrium value of X and Y in the p formula, to get the result...&#xD;
&#xD;
How can i do that?&#xD;
&#xD;
Thanks</description>
    <dc:creator>Filippo Roda</dc:creator>
    <dc:date>2014-08-26T13:21:40Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3092013">
    <title>Measuring 4x4 Reversi: Canonicalization &amp;amp; Impartiality Functions on Multiway Graphs</title>
    <link>https://community.wolfram.com/groups/-/m/t/3092013</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/14c707de-aa89-4876-84dc-95263be13c7c</description>
    <dc:creator>Andrea Li</dc:creator>
    <dc:date>2023-12-27T21:54:55Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2413178">
    <title>Converting chess OBJ files to voxels</title>
    <link>https://community.wolfram.com/groups/-/m/t/2413178</link>
    <description>![enter image description here][1]&#xD;
&#xD;
In [another recent thread][2] we announced the existence of voxel chess pieces originally painted in [MagicaVoxel][3], but could not access them in Mathematica because of a fail case involving &amp;#034;.vox&amp;#034; file format. The purpose of this memo is to show how files exported to OBJ can be converted back to voxels, and to give away [a few more free assets][4]. &#xD;
&#xD;
Pull down the [OBJ files from github][5], then import and print:&#xD;
&#xD;
    PieceData = Import[&amp;#034;~/mathfun/&amp;#034; &amp;lt;&amp;gt; # &amp;lt;&amp;gt; &amp;#034;.obj&amp;#034;] &amp;amp; /@ {&amp;#034;pawn&amp;#034;, &amp;#034;rook&amp;#034;, &amp;#034;knight&amp;#034;, &#xD;
        &amp;#034;bishop&amp;#034;, &amp;#034;queen&amp;#034;, &amp;#034;king&amp;#034;}; &#xD;
    GraphicsGrid[ Partition[Show[Region@#, &#xD;
         Graphics3D[Arrow[{{0, 0, 0}, 6 #}] &amp;amp; /@ IdentityMatrix[3]],&#xD;
         ViewVertical -&amp;gt; {0, 1, 0}, ViewPoint -&amp;gt; {2, 0, 2},&#xD;
         PlotRange -&amp;gt; {{-6, 6}, {-1, 20}, {-6, 6}}] &amp;amp; /@ PieceData, 3]]&#xD;
&#xD;
![Chess Regions][6]&#xD;
&#xD;
Validation data&#xD;
&#xD;
    RegionMember[Region[PieceData[[6]]], {0, 0, 0}]&#xD;
    RegionMember[Region[PieceData[[6]]], {0, 1, 0}]&#xD;
    RegionDimension@Region[PieceData[[6]]]&#xD;
    SolidRegionQ@Region[PieceData[[6]]]&#xD;
&#xD;
    Out[]:= True&#xD;
    Out[]:= False&#xD;
    Out[]:= 2&#xD;
    Out[]:= False&#xD;
&#xD;
We would rather that this output read T,T,3,T, and are unaware whether or not region management is built out to this capability (?). That leaves us the task of identifying boundaries, surface normals, and putting voxel blocks in place, hopefully with color. Assuming the OBJ file is consistent with a VOX decomposition, we can use preexisting region functions to identify control points on the two-dimensional surface: &#xD;
&#xD;
    BoundaryPoints[GeoOBJ_] := With[{SlabPts = Flatten[&#xD;
         Table[{i/2, j/2, k/2}, {i, -6, 6}, {j, 0, 32}, {k, -6, 6}], 2]},&#xD;
      Select[SlabPts, Element[#, Region[GeoOBJ]] &amp;amp;]]  &#xD;
&#xD;
In this case, we know the size of the slab, the origin of coordinates, and the length of the line element, so we don&amp;#039;t need too much automation or corner finding. There are at least two good reasons for using halves in discretization of the slab, but you can think of those for yourself.&#xD;
&#xD;
To get out square facets, we look for nearest neighbors and next nearest neighbors in the sub lattice found by intersection with whichever GeoOBJ.&#xD;
&#xD;
    ListEdges[BoundaryPts_] :=  With[{EdgeSet = &#xD;
        Edge[#, Nearest[Complement[BoundaryPts, {#}], #]] &amp;amp; /@ &#xD;
         BoundaryPts},  {EdgeSet,  Edge[#[[1]], &#xD;
          Nearest[Complement[ BoundaryPts, # /. &#xD;
             Edge[x_, y_] :&amp;gt; Append[y, x]], #[[1]] ] ] &amp;amp; /@ EdgeSet}]&#xD;
    &#xD;
    Facet[pt_, nNeighbors_, nnNeighbors_] := MapIndexed[&#xD;
      ReplaceAll[ Flatten[Position[#1, 1/2, 1]], {{x_Integer, y_Integer} :&amp;gt; &#xD;
          Polygon[ {pt, nNeighbors[[x]], nnNeighbors[[#2[[1]] ]], &#xD;
            nNeighbors[[y]]  }], _ -&amp;gt; {}}] &amp;amp;,&#xD;
      Outer[EuclideanDistance, nnNeighbors, nNeighbors, 1]]&#xD;
    &#xD;
    BoundaryDiscretize[GeoOBJ_] :=  Union[Flatten[&#xD;
     MapThread[Facet[#1[[1]], #1[[2]], #2[[2]]] &amp;amp;,&#xD;
         ListEdges[BoundaryPoints[GeoOBJ ]]  ]]];&#xD;
&#xD;
    AbsoluteTiming[AllFacets = BoundaryDiscretize[#] &amp;amp; /@ PieceData;]&#xD;
    Out[]={48.1591, Null}&#xD;
&#xD;
It seems to take too long, but we are not yet at the finalization stage of needing to optimize. Actually, we have just started (as C.H. was saying yesterday, sort of). Printing Again:&#xD;
&#xD;
    GraphicsGrid[Partition[Show[Graphics3D[#], &#xD;
         Graphics3D[Arrow[{{0, 0, 0}, 6 #}] &amp;amp; /@ IdentityMatrix[3]],&#xD;
         ViewVertical -&amp;gt; {0, 1, 0}, ViewPoint -&amp;gt; {2, 0, 2}, Boxed -&amp;gt; False,&#xD;
         PlotRange -&amp;gt; {{-6, 6}, {-1, 20}, {-6, 6}}] &amp;amp; /@ AllFacets, 3], &#xD;
     ImageSize -&amp;gt; 500]&#xD;
&#xD;
![Faceted Chess Pieces][7]&#xD;
&#xD;
These should be relatively easy to color, facet by facet, except that we may still have duplicate facets in the extracted data. If we just print some random coloring, that doesn&amp;#039;t matter: &#xD;
&#xD;
    lens = Length /@ AllFacets;&#xD;
    cols = Table[Blend[{Hue[RandomReal[{0, 1}]], Pink}], {#}] &amp;amp; /@ lens;&#xD;
    &#xD;
    Show[Graphics3D[Transpose[{cols[[3]], AllFacets[[3]]}]], &#xD;
     Graphics3D[Arrow[{{0, 0, 0}, 6 #}] &amp;amp; /@ IdentityMatrix[3]],&#xD;
     ViewVertical -&amp;gt; {0, 1, 0}, ViewPoint -&amp;gt; {2, 0, 2}, Boxed -&amp;gt; False,&#xD;
     PlotRange -&amp;gt; {{-6, 6}, {-1, 12}, {-6, 6}}, ImageSize -&amp;gt; 700] &#xD;
&#xD;
![pink rainbow knight][8]&#xD;
&#xD;
Okay this looks too much like a discothèque, so for the sake of simplicity, we next need to refine until the facets of each voxel share the same color. More work to be done in the next few days or weeks, but we seem to be making progress. &#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Image20211130000517.png&amp;amp;userId=20103&#xD;
  [2]: https://community.wolfram.com/groups/-/m/t/2407317&#xD;
  [3]: https://ephtracy.github.io/&#xD;
  [4]: https://github.com/bradklee/OpenAssets&#xD;
  [5]: https://github.com/bradklee/OpenAssets/tree/main/WorldChess/OBJ&#xD;
  [6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ChessPieceRegions.png&amp;amp;userId=234448&#xD;
  [7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ChessPieceFacets.png&amp;amp;userId=234448&#xD;
  [8]: https://community.wolfram.com//c/portal/getImageAttachment?filename=PinkKnight.png&amp;amp;userId=234448</description>
    <dc:creator>Brad Klee</dc:creator>
    <dc:date>2021-11-24T15:37:34Z</dc:date>
  </item>
</rdf:RDF>

