<story><title>Advent of Code 2019</title><url>https://adventofcode.com/2019</url></story><parent_chain><item><author>melling</author><text>Learning new environments can be painful so it’s good it starts off easy.&lt;p&gt;I’m trying to solve them with Swift Playgrounds on the iPad, for example.  And I can’t figure out how to create a simple text file for the data.</text></item><item><author>aquova</author><text>Many of the comments are about the event as a whole, but I&amp;#x27;d like to commend the author for the day 1 puzzle, which I think is very cleverly written. Many people (including myself) use these as an opportunity to try out learning a new language, and the first puzzle does a good job of making sure you know enough basic operations for some of the puzzles coming up. The puzzle itself wasn&amp;#x27;t very difficult, you could do it by hand if you really wanted to, but it required you to know how to read and parse lines in a file, handle compound data structures, iterate through, and perform basic operations (floor, casting strings to ints, etc). I thought it was really well done, and creates the basic knowledge for the puzzles ahead.</text></item></parent_chain><comment><author>brantonb</author><text>I started last year using Swift Playgrounds. I was lazy and just pasted the input into a multi-line string. I had to switch away from Playgrounds after a couple of days because it would crash due to memory issues. It traces every line of execution and the intermediate values of all variables. I really enjoyed doing the challenges in Swift, but I did have to switch to using my Mac to do it.&lt;p&gt;This year, I’m learning Python by using a Raspberry Pi 4 directly connected to my iPad via USB. Should be another fun month!</text></comment>
<story><title>Advent of Code 2019</title><url>https://adventofcode.com/2019</url></story><parent_chain><item><author>melling</author><text>Learning new environments can be painful so it’s good it starts off easy.&lt;p&gt;I’m trying to solve them with Swift Playgrounds on the iPad, for example.  And I can’t figure out how to create a simple text file for the data.</text></item><item><author>aquova</author><text>Many of the comments are about the event as a whole, but I&amp;#x27;d like to commend the author for the day 1 puzzle, which I think is very cleverly written. Many people (including myself) use these as an opportunity to try out learning a new language, and the first puzzle does a good job of making sure you know enough basic operations for some of the puzzles coming up. The puzzle itself wasn&amp;#x27;t very difficult, you could do it by hand if you really wanted to, but it required you to know how to read and parse lines in a file, handle compound data structures, iterate through, and perform basic operations (floor, casting strings to ints, etc). I thought it was really well done, and creates the basic knowledge for the puzzles ahead.</text></item></parent_chain><comment><author>melling</author><text>I solved the first part using the examples.  Swift is nice.&lt;p&gt;&lt;pre&gt;&lt;code&gt;   func calcFuel(_ mass:Int) -&amp;gt; Int {mass &amp;#x2F; 3 - 2}

   let z0 = massList.map(calcFuel).reduce(0, +)
&lt;/code&gt;&lt;/pre&gt;
or simply ...&lt;p&gt;&lt;pre&gt;&lt;code&gt;   let z1 = massList.map({$0 &amp;#x2F; 3 - 2}).reduce(0, +)
&lt;/code&gt;&lt;/pre&gt;
Any idea how to read the data on the iPad?</text></comment>