<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Joby Ingram-Dodd on Medium]]></title>
        <description><![CDATA[Stories by Joby Ingram-Dodd on Medium]]></description>
        <link>https://medium.com/@jobyid?source=rss-b8eb30bc5135------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*qnLcUAMrD2D7XjEH.</url>
            <title>Stories by Joby Ingram-Dodd on Medium</title>
            <link>https://medium.com/@jobyid?source=rss-b8eb30bc5135------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 03:47:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jobyid/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Is the rise in NFT’s a product of the pandemic?]]></title>
            <link>https://jobyid.medium.com/is-the-rise-in-nfts-a-product-of-the-pandemic-9577530cb16e?source=rss-b8eb30bc5135------2</link>
            <guid isPermaLink="false">https://medium.com/p/9577530cb16e</guid>
            <category><![CDATA[nft]]></category>
            <category><![CDATA[nft-collectibles]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[community]]></category>
            <dc:creator><![CDATA[Joby Ingram-Dodd]]></dc:creator>
            <pubDate>Wed, 06 Jul 2022 11:22:21 GMT</pubDate>
            <atom:updated>2022-07-06T11:22:21.781Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v-EzvOhvFJAyf7aTvUmGOg.jpeg" /></figure><p>Unless you have been living under a rock, you can’t have missed the massive rise in the world of NFT’s and the crazy prices some of the collections have been achieveing. As I am working as a CTO in a metaverse project with a strong NFT play, I have been pondering on why NFT’s exploded and ways we can launch a successful project.</p><p>One of the NFT buzz words, which every web3 project has in their pitches and every VC is obsessed with is, community. We all wax lyrical about how important it is and point to examples of how xyz project has such a strong community and that is why they sold out in 3 seconds. What is is about this community aspect that is so crucial? I certainly believe having a community of dedicated fans is a massive advantage to any project, it is free advertising at the end of the day. We are after all pack animals, and history is littered with ways we have organised ourselves into different communities, from religion to sports, to gangs and secret societies we crave that sense of belonging to the group.</p><p>My question is, how real these NFT communities are, would they have formed in ‘normal’ times, will they last as we get closer to normal again?</p><p>When the pandemic hit and most of the ways we got our subconscious hit of belonging to a community were removed, well we all felt a bit lonely and isolated. Fun as remote working can be, we missed the little reminders of belonging to something we used to get from idle chats in the office while making a cup of tea, or the shared experience of concerts and sport. There was a gap, our brain was trying to fill and like a knight in shinny armour in rode NFT’s and crypto in general, offering a world of discord and twitter where we got a hit of idle chatter, and if you had the right JPEG you could join the gang. The timing was perfect, and the effect immediate. Obsessively prices were checked as we hunted for the next big thing, we debated fiercely on social with anyone who dared to question the validity of the space, but perhaps most importantly, we had a space where we belonged.</p><p>Now we are emerging into the sunlight as COVID subsides, and we can go back to the pub, or sporting events, and see our friends in person again. It makes me wonder if many of these NFT communities, we loved so much, can withstand the comparison with real life. When you have no choice, hours spent on discord can be justified, but maybe we are all going to rediscover real life face to face interactions again and time spent scrolling inane chat will feel like wasted time?</p><p>My view is that NFT projects are going to need much more then an overpriced JPEG and a discord channel to cut it. Not to mention the fact that prices are tumbling down. Metaverses may be a solution, but only if they can offer something brilliant that captivates us, and really gives us that sense of belonging, which is really what most of us are trying to do. It is time for the promises of genuine community and the blending of the real world and physical world to become a reality. Projects with substances will thrive but many others will not.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9577530cb16e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Idea: The Property DAO]]></title>
            <link>https://jobyid.medium.com/an-idea-the-property-dao-72c5a53b123?source=rss-b8eb30bc5135------2</link>
            <guid isPermaLink="false">https://medium.com/p/72c5a53b123</guid>
            <category><![CDATA[dao]]></category>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[aragon]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[property]]></category>
            <dc:creator><![CDATA[Joby Ingram-Dodd]]></dc:creator>
            <pubDate>Thu, 25 Nov 2021 10:48:21 GMT</pubDate>
            <atom:updated>2021-11-25T10:48:21.050Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kAnzExCL41lEiWfp9qcjbA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@ralphkayden?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Ralph (Ravi) Kayden</a> on <a href="https://unsplash.com/s/photos/home?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>I have a new idea, inspired in part by the exploits of constitution DAO and the various DAO’s trying to buy sports teams around the world. I wondered if we could run with the concept and make property/land ownership a DAO?</p><p>Before you protest to much, I know there are some hurdles to get over around legal entity and ownership in the DAO world. However I believe the following could work, and longer term evolve into the norm.</p><p>Imagine if we use the Aragon platform to create a fund-raising DAO which acts as the main hub for this experiment. After raising some capital we form a traditional limited company, probably based here in Guernsey, where I live, because of it’s favourable regulation and tax regime. The limited company has a set of rules added to it’s articles of association which ensure the will of the DAO is reflected in the running of the company. We then start buying properties here in Guernsey and across the globe. The properties are legally owned buy the company but are controlled by the main DAO initially.</p><p>For each property we buy the ownership is encoded as an NFT, a membership DAO is created which owns the NFT and issues tokens. These tokens are then sold to people who wish to live in the property, while they own the tokens they effectively own the property and can act in the same way as they would if they owned a property in the traditional way.</p><p>By using tokens we can fractionalise the property ownership, so if a group of people wish to group together and own a shared house they can. The tokens can be sold on an open market, like any other token. Property ownership becomes liquid and democratised, we remove the need to many of the complex steps required in conveyancing.</p><p>Along side the property DAO we also create a lending DAO which acts like a mortgage company, they can buy a proportion of the tokens for a house on your behalf and then over time you buy back the tokens from the lending company. Gradually increasing your ownership. If you fail to keep up the agreed schedule of buying back tokens from the lending company they can have you evicted. In the same way a traditional mortgage company might. A smart contract representing the agreement is held by the DAO.</p><p>We also need to consider what happens if work is carried out on the property, or inspection sare completed, or any other issues which can effect the property and it’s viability. I suggest that all the paper work, such as planning permission, building regulations etc is stored as NFT’s within the DAO along with the main ‘Title Deed’ so that anyone considering purchasing the property tokens can query the DAO data and see all they need, rather then requiring a lawyer to performs these checks.</p><p>So what about rental properties? Well those who own the property, via DAO tokens, can choose to rent a property in the same way anybody else would. The rental agreement is stored within the DAO as a smart contract.</p><p>The concept as a describe is not without risk, however I think they can be minimised with careful structuring.</p><ol><li>The original Limited company will always be the legal owner of the property (at least until we can change the law) in theory the directors could pull the plug. However I think this can be protected against with robust covenants inside the memorandum and articles of association for the company that mandate they must follow the Main DAO’s votes. Then each property DAO will own a token in the main DAO. Therefore giving each property voting power over the holding company.</li><li>The legal rights are a grey area. I believe this is mitigated as above, due to the legal rights of a limited company being well defined.</li><li>Revenue will be needed for the holding company to stay afloat. We will introduce a mechanism for the company to earn a minimal revenue from each sub DAO to meet their minimum regulatory filling and admin requirements. Some of this can also come from the lending DAO.</li><li>Tax is unclear right now but it seems that as the Holding Company never sells the properties there will be no tax due when buying or selling the properties through the DAO. A considerable advantage.</li></ol><p>This is very top level exploration of the concept, but I truly believe this is an experiment worth pursuing. I hope to start the process shortly in you fancy joining me then drop me a line.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72c5a53b123" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advent of code day 4]]></title>
            <link>https://jobyid.medium.com/advent-of-code-day-4-f94a508432be?source=rss-b8eb30bc5135------2</link>
            <guid isPermaLink="false">https://medium.com/p/f94a508432be</guid>
            <category><![CDATA[advent-of-code]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[strive-school]]></category>
            <dc:creator><![CDATA[Joby Ingram-Dodd]]></dc:creator>
            <pubDate>Sun, 06 Dec 2020 07:55:36 GMT</pubDate>
            <atom:updated>2020-12-06T07:55:36.699Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://jobyid.medium.com/advent-of-code-day-1-ebc8400d05f3">DAY 1</a>, <a href="https://jobyid.medium.com/advent-of-code-day-2-c9409f638f8a">DAY 2</a>, <a href="https://jobyid.medium.com/advent-of-code-day-3-bd10f563b884">DAY 3</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*D4K1HxWAGsY3AaWX" /><figcaption>Photo by <a href="https://unsplash.com/@codestorm?utm_source=medium&amp;utm_medium=referral">Safar Safarov</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Welcome to my write up of Day 4 of the <a href="https://adventofcode.com/">Advent of Code</a> the previous days write ups can be at at the links above. Today were were hacking the passport control to make the line go quicker. In the end it was easy enough but it was a timely reminder for me that overlocking some small thing can be hugely time consuming and frustrating.</p><h3>Part 1</h3><p>As always we were given a text file as input data, the file had block of text separated by blank lines.</p><pre>eyr:2028 iyr:2016 byr:1995 ecl:oth<br>pid:543685203 hcl:#c0946f<br>hgt:152cm<br>cid:252<br><br>hcl:#733820 hgt:155cm<br>iyr:2013 byr:1989 pid:728471979<br>ecl:grn eyr:2022<br><br>hgt:171cm<br>iyr:2013 pid:214368857 hcl:#cfa07d byr:1986 eyr:2028 ecl:grn</pre><p>Each block represented a passport and included various variables identified by 3 letter codes such as byr (Birth Year) as you can see above. Our task was to work through each ‘passport’ and check if they included all the required variables, counting all the valid passports. Here is the code i used:</p><pre>fp = open(&quot;d4input.txt&quot;, &quot;r&quot;)<br># read through each line untill we get to a blank line which is a new passport <br>#go through each line and check for required fields <br>#update counter. <br>#cid = False #optional so we don&#39;&#39;t need to check it</pre><pre>def checkbyr(l):<br>    if &quot;byr&quot; in l: <br>        return True<br>    return False</pre><pre>def checkiyr(l):<br>    if &quot;iyr&quot; in l: <br>        return True<br>    return False</pre><pre>def checkeyr(l):<br>    if &quot;eyr&quot; in l: <br>        return True<br>    return False</pre><pre>def checkhgt(l):<br>    if &quot;hgt&quot; in l: <br>        return True<br>    return False</pre><pre>def checkhcl(l):<br>    if &quot;hcl&quot; in l: <br>        return True<br>    return False</pre><pre>def checkecl(l):<br>    if &quot;ecl&quot; in l: <br>        return True<br>    return False</pre><pre>def checkpid(l):<br>    if &quot;pid&quot; in l: <br>        return True<br>    return False</pre><pre>valid = 0<br>passport = [] </pre><pre>#read through each line add it to the passport lis untill we get to blank line then check then pause to check the passport</pre><pre>def checkPassport(): <br>    global valid<br>    global passport<br>    byr = False <br>    iyr = False<br>    eyr = False<br>    hgt = False<br>    hcl = False<br>    ecl = False<br>    pid = False<br>    for l in passport:<br>        if byr == False:<br>            byr = checkbyr(l)<br>        if iyr == False:<br>            iyr = checkiyr(l)<br>        if eyr == False:<br>            eyr = checkeyr(l)<br>        if hgt == False:<br>            hgt = checkhgt(l)<br>        if hcl == False:<br>            hcl = checkhcl(l)<br>        if ecl == False:<br>            ecl = checkecl(l)<br>        if pid == False:<br>            pid = checkpid(l)<br>    #print(byr,iyr,eyr, hgt, hcl, ecl, pid)  <br>    if byr and iyr and eyr and hgt and hcl and ecl and pid : <br>        valid += 1<br>    passport = []<br>    <br>def readLines(text):<br>    while True:<br>        buffer = text.readline()<br>        if buffer != &quot;\n&quot;:<br>            passport.append(buffer)<br>        if buffer == &quot;\n&quot;:<br>            checkPassport()<br>        if buffer == &quot;&quot;:<br>            checkPassport()<br>            break</pre><pre>#checkPassport()<br>readLines(fp)<br>print(valid)<br>print(passport)</pre><p>Let&#39;s break it down. Firstly I should say I was trying to be clever here and future proof my code by anticipating that part 2 would be harder and require more checks. So I created a function to check each variable idependtenly. They were all the same and simply used ‘in’.</p><pre>def checkpid(l):<br>    if &quot;pid&quot; in l: <br>        return True<br>    return False</pre><p>But i’m jumping ahead, the first task was to split out each block as a passport, so to do this I used.</p><pre>def readLines(text):<br>    while True:<br>        buffer = text.readline()<br>        if buffer != &quot;\n&quot;:<br>            passport.append(buffer)<br>        if buffer == &quot;\n&quot;:<br>            checkPassport()<br>        if buffer == &quot;&quot;:<br>            checkPassport()<br>            break</pre><p>This function read through each line in the file and while the line is not blank it adds that line to a list ‘passport’ which represent all the lines of a passport. When we get to a blank line we check the list (‘passport’) to see if it is valid, the list is wiped clean and we repeat the process.</p><pre>def checkPassport(): <br>    global valid<br>    global passport<br>    byr = False <br>    iyr = False<br>    eyr = False<br>    hgt = False<br>    hcl = False<br>    ecl = False<br>    pid = False<br>    for l in passport:<br>        if byr == False:<br>            byr = checkbyr(l)<br>        if iyr == False:<br>            iyr = checkiyr(l)<br>        if eyr == False:<br>            eyr = checkeyr(l)<br>        if hgt == False:<br>            hgt = checkhgt(l)<br>        if hcl == False:<br>            hcl = checkhcl(l)<br>        if ecl == False:<br>            ecl = checkecl(l)<br>        if pid == False:<br>            pid = checkpid(l)<br>    #print(byr,iyr,eyr, hgt, hcl, ecl, pid)  <br>    if byr and iyr and eyr and hgt and hcl and ecl and pid : <br>        valid += 1<br>    passport = []</pre><p>The check password function just works through all the smaller functions checking each variable and updates the valid counter as required. It worked really well and seemed pretty efficient code but I’ll admit quite long winded.</p><p>A fellow <a href="https://strive.school/">Strive School</a> Luca shared his version of part 1 which is a much tighter method as you can see. You can see his <a href="https://github.com/lpianta">GitHub here</a>.</p><pre>f = open(&quot;day4input.txt&quot;, &quot;r&quot;)<br>passports = f.read()<br><br><br>single_passports = passports.split(&quot;<strong>\n\n</strong>&quot;)<br>valid_passport = 0<br><strong>for</strong> i <strong>in</strong> single_passports:<br>    <strong>if</strong> &quot;byr&quot; <strong>in</strong> i <strong>and</strong> &quot;iyr&quot; <strong>in</strong> i <strong>and</strong> &quot;eyr&quot; <strong>in</strong> i <strong>and</strong> &quot;hgt&quot; <strong>in</strong> i <strong>and</strong> &quot;hcl&quot; <strong>in</strong> i <strong>and</strong> &quot;ecl&quot; <strong>in</strong> i <strong>and</strong> &quot;pid&quot; <strong>in</strong> i:<br>        valid_passport += 1<br>f.close()<br>print(valid_passport)</pre><h3>Part 2</h3><p>As anticipated part 2 added in a bunch more complexity, by requiring checks for each parameter to make sure they are withing specific parameters. For example.</p><ul><li>byr (Birth Year) - four digits; at least 1920 and at most 2002.</li></ul><p>Luckly I already had functions for each parameter, so I could keep most of my code the same and simply change each of parameter functions to check the specific requirements and maintain the readability of the code. Here it is.</p><pre><em>import </em>re<br><br>fp = open(&quot;d4input.txt&quot;, &quot;r&quot;)<br><br><br><em>def </em>checkbyr(<em>l</em>):<br>    # byr (Birth Year) - four digits; at least 1920 and at most 2002.<br>    <em>if </em>&quot;byr&quot; <em>in l</em>:<br>        x = <em>l</em>.split(&quot;byr:&quot;)<br>        y = x[1].split(&quot; &quot;)<br>        z = y[0].strip()<br>        <em>if </em>len(z) == 4 <em>and </em>1920 &lt;= int(z) &lt;= 2002:<br>            <em>return True<br>    return False<br><br>def </em>checkiyr(<em>l</em>):<br>    # iyr (Issue Year) - four digits; at least 2010 and at most 2020.<br>    <em>if </em>&quot;iyr&quot; <em>in l</em>:<br>        x = <em>l</em>.split(&quot;iyr:&quot;)<br>        y = x[1].split(&quot; &quot;)<br>        z = y[0].strip()<br>        <em>if </em>len(z) == 4 <em>and </em>2010 &lt;= int(z) &lt;= 2020:<br>            <em>return True<br>    return False<br><br>def </em>checkeyr(<em>l</em>):<br>    # eyr (Expiration Year) - four digits; at least 2020 and at most 2030.<br>    <em>if </em>&quot;eyr&quot; <em>in l</em>:<br>        x = <em>l</em>.split(&quot;eyr:&quot;)<br>        y = x[1].split(&quot; &quot;)<br>        z = y[0].strip() <br>        <em>if </em>len(z) == 4 <em>and </em>2020 &lt;= int(z) &lt;= 2030:<br>            <em>return True<br>    return False<br><br>def </em>checkhgt(<em>l</em>):<br>    # hgt (Height) - a number followed by either cm or in:<br>    <em>if </em>&quot;hgt&quot; <em>in l</em>:<br>        x = <em>l</em>.split(&quot;hgt:&quot;)<br>        y = x[1].split(&quot; &quot;)<br>        zz = y[0].strip() <br>        <em>if </em>&quot;cm&quot; <em>in </em>y[0]:<br>           # If cm, the number must be at least 150 and at most 193.<br>            z = zz.split(&quot;cm&quot;)<br>            <em>if </em>150 &lt;= int(z[0]) &lt;= 193:<br>                <em>return True<br>        if </em>&quot;in&quot; <em>in </em>y[0]:<br>            # If in, the number must be at least 59 and at most 76.<br>            z = zz.split(&quot;in&quot;)<br>            <em>if </em>59 &lt;= int(z[0]) &lt;= 76:<br>                <em>return True<br>    return False<br><br>def </em>checkhcl(<em>l</em>):  <br>    # hcl (Hair Color) - a # followed by exactly six characters 0-9 or a-f.<br>    <em>if </em>&quot;hcl&quot; <em>in l</em>:<br>        x = <em>l</em>.split(&quot;hcl:&quot;)<br>        y = x[1].split(&quot; &quot;)<br>        yy = y[0].strip()<br>        z = re.sub(&#39;[^a<strong>-</strong>f0<strong>-</strong>9#]&#39;, &#39;&#39;, yy)<br>        <em>if </em>len(z) == 7 <em>and </em>z[0] == &quot;#&quot;:<br>            <em>return True<br>    return False<br><br>def </em>checkecl(<em>l</em>):<br>    # ecl (Eye Color) - exactly one of: amb blu brn gry grn hzl oth<br>    el = [&quot;amb&quot;, &quot;blu&quot;, &quot;brn&quot;, &quot;gry&quot;, &quot;grn&quot;, &quot;hzl&quot;, &quot;oth&quot;]<br>    <em>if </em>&quot;ecl&quot; <em>in l</em>:<br>        x = <em>l</em>.split(&quot;ecl:&quot;)<br>        y = x[1].split(&quot; &quot;)<br>        z = y[0].strip()<br>        <em>if </em>z <em>in </em>el:<br>            <em>return True<br>    return False<br><br>def </em>checkpid(<em>l</em>):<br>    # pid (Passport ID) - a nine-digit number, including leading zeroes.<br>    <em>if </em>&quot;pid&quot; <em>in l</em>:<br>        x = <em>l</em>.split(&quot;pid:&quot;)<br>        y = x[1].split(&quot; &quot;)<br>        z = y[0].strip()<br>        <em>if </em>len(z) == 9:<br>            <em>return True<br>    return False<br><br></em>valid = 0<br>passport = []</pre><pre># read through each line add it to the passport list until we get to blank line then check then pause to check the passport</pre><pre><em>def </em>checkPassport():<br>    <em>global </em>valid<br>    <em>global </em>passport<br>    byr = <em>False<br>    </em>iyr = <em>False<br>    </em>eyr = <em>False<br>    </em>hgt = <em>False<br>    </em>hcl = <em>False<br>    </em>ecl = <em>False<br>    </em>pid = <em>False<br>    for </em>l <em>in </em>passport:<br>        <em>if not </em>byr:<br>            byr = checkbyr(l)<br>        <em>if not </em>iyr:<br>            iyr = checkiyr(l)<br>        <em>if not </em>eyr:<br>            eyr = checkeyr(l)<br>        <em>if not </em>hgt:<br>            hgt = checkhgt(l)<br>        <em>if not </em>hcl:<br>            hcl = checkhcl(l)<br>        <em>if not </em>ecl:<br>            ecl = checkecl(l)<br>        <em>if not </em>pid:<br>            pid = checkpid(l)<br>    # print(byr,iyr,eyr, hgt, hcl, ecl, pid)<br>    <em>if </em>byr <em>and </em>iyr <em>and </em>eyr <em>and </em>hgt <em>and </em>hcl <em>and </em>ecl <em>and </em>pid:<br>        valid += 1<br>    passport = []<br><br><em>def </em>readLines(<em>text</em>):<br>    <em>global </em>passport<br>    <em>while True</em>:<br>        buffer = <em>text</em>.readline()<br>        <em>if </em>buffer != &quot;\n&quot;:<br>            passport.append(buffer)<br>        <em>if </em>buffer == &quot;\n&quot;:<br>            checkPassport()<br>        <em>if </em>buffer == &quot;&quot;:<br>            checkPassport()<br>            <em>break<br><br><br></em><br>readLines(fp)<br>print(valid)<br>print(passport)</pre><p>For each function I added a comment with the rules and then created them. I was done pretty qucikly, but for some reason it was not working the result I got was wrong. I went back and forwards through the code trying to find the fault, eventually after stepping away for a while, I found the fault.</p><pre><em>def </em>checkbyr(<em>l</em>):<br>    # byr - four digits; at least 1920 and at most 2002.<br>    <em>if </em>&quot;byr&quot; <em>in l</em>:<br>        x = <em>l</em>.split(&quot;byr:&quot;)<br>        y = x[1].split(&quot; &quot;)<br>        <em>if </em>len(z) == 4 <em>and </em>1920 &lt;= int(z) &lt;= 2002:<br>            <em>return True<br>    return False</em></pre><pre><em>def </em>checkbyr(<em>l</em>):<br>    # byr - four digits; at least 1920 and at most 2002.<br>    <em>if </em>&quot;byr&quot; <em>in l</em>:<br>        x = <em>l</em>.split(&quot;byr:&quot;)<br>        y = x[1].split(&quot; &quot;)<br>        z = y[0].strip() # just in case there are some extra spaces in there<br>        <em>if </em>len(z) == 4 <em>and </em>1920 &lt;= int(z) &lt;= 2002:<br>            <em>return True<br>    return False</em></pre><p>Looking at this one as an example the 2 versions I show only differ by 1 line but it is a crucial line. As I finally figured out, sometimes after I split the line we have some extra spaces at the end, by adding the strip() method I get rid of this spaces and the code works correctly. The reason that the fault was not immediately obvious is because each passport has a different arangements of line and the parameters move around sometimes in the middle of lines sometimes at the ends of lines, meaning we get various combinations of spaces and new lines after the data we actually want. I had to add strip to all the functions.</p><p>A fun one today, tomorrow Day 5. Feel free to add comments below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f94a508432be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advent of Code — Day 3]]></title>
            <link>https://jobyid.medium.com/advent-of-code-day-3-bd10f563b884?source=rss-b8eb30bc5135------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd10f563b884</guid>
            <category><![CDATA[advent-of-code]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[strive-school]]></category>
            <dc:creator><![CDATA[Joby Ingram-Dodd]]></dc:creator>
            <pubDate>Sat, 05 Dec 2020 07:44:27 GMT</pubDate>
            <atom:updated>2020-12-05T07:44:27.572Z</atom:updated>
            <content:encoded><![CDATA[<h3>Advent of Code — Day 3</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-SW3-_YpKy_PxLnE" /><figcaption>Photo by <a href="https://unsplash.com/@synkevych?utm_source=medium&amp;utm_medium=referral">Roman Synkevych</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><a href="https://jobyid.medium.com/advent-of-code-day-1-ebc8400d05f3">DAY 1</a>, <a href="https://jobyid.medium.com/advent-of-code-day-2-c9409f638f8a">DAY 2</a></p><p>Welcome back to day 3 of my Advent of Code walkthroughs, I found this one to be quite a bit tougher then the 2 days before and was beginning to worry I would never make day 25. However I got there in the end and a little help from my fellow students at <a href="https://strive.school/">Strive School</a> made all the difference.</p><h3><strong>Part 1</strong></h3><p>The challenge today was to navigate a toboggan down a slope and count the number of trees we hit on the way. To do this I was given a ‘map’ and a step pattern of how to travel across the map. Each line of the map was a string with a repeating pattern, something like this;-</p><pre>.........#.#.#.........#.#.....<br>...#......#...#.....#.....#....<br>#.....#.....#.....#.#........#.<br>......#..#......#.......#......<br>.#..........#.............#...#<br>............#..##.......##...##<br>....#.....#..#....#............</pre><p>The ‘.’ represented empty snow and the ‘#’ represented the trees. The step pattern I had was to move 1 down and 3 right (everyone gets different data), starting at the top left I had to navigate down the map all the way to the bottom some 320 lines later, counting trees hit. In the instructions each line is described repeating, which is important as you will see.</p><p>My first approach was to keep moving right until I got out of range then start at index 0 again however this was not working. Reaching out for help I was lucky to get help from a Strive Student who suggested multiplying the lines to repeat the pattern and avoid out of index errors. This worked a treat. So it was then just a case of stepping through each line and shifting across 3, then check if it was a tree and update the tree counter. Here is the code.</p><pre>map_lines = mapData.split(&quot;\n&quot;)<br>cp = 0<br>tree_count = 0 <br>right = 3</pre><pre>def multiLine(l):<br>    line = l*100<br>    return MakeMove(line)<br>    <br>        <br>def MakeMove(l):<br>    global cp<br>    #look at the line and move accross 3 <br>    cp += right<br>    pos = cp<br>    if l[pos] == &quot;#&quot;:<br>        return True<br>    else:<br>        return False</pre><pre>for l in map_lines:<br>    global tree_count<br>    index = map_lines.index(l)<br>    if index != 0:<br>        if multiLine(l):<br>            tree_count += 1</pre><p>Lets break this down a little at the top I have 3 global variables and the orginal data (map) split into lines. These are <strong>cp</strong> which is the current position from left to right then we have <strong>tree_count</strong> which is our counter to count the trees and we have <strong>right</strong> which is the number of steps to move right each time.</p><pre>map_lines = mapData.split(&quot;\n&quot;)<br>cp = 0<br>tree_count = 0 <br>right = 3</pre><p>Then we get into the functions I have defined, the first one to look at is <strong>MakeMove </strong>(I know the convention for python is to name functions with underscore rather then camel case but old swift habits die hard), the function actually makes the move on the map and checks to see if it is a tree.</p><pre>def MakeMove(l):<br>    global cp<br>    #look at the line and move accross <br>    cp += right<br>    pos = cp<br>    if l[pos] == &quot;#&quot;:<br>        return True<br>    else:<br>        return False</pre><p>The function takes the line on the map as an input, which is a string, we then take the current position (cp) and add the number of steps (right) to it. This gives us the new position (pos), and using this position as an index we can use an if statement to check if the character at that position is a tree (#). If it is return true if not return false.</p><p>The next function is multiLine (camel case again) which as the name suggests multiplies the line solving our out of index issues.</p><pre>def multiLine(l):<br>    line = l*100<br>    return MakeMove(line)<br>    </pre><p>We then pass the extra long line into the MakeMove function and check for trees. The return passes back up the chain.</p><p>Lastly we have a for loop to go through all the lines on the map, passing each line into the multiLine function</p><pre>for l in map_lines:<br>    global tree_count<br>    index = map_lines.index(l)<br>    if index != 0:<br>        if multiLine(l):<br>            tree_count += 1</pre><p>I brought <strong>tree_count</strong> in as a global variable so I can update the counter, I also used index to check we were not on the first line, as we only want to check lines after the first. I could have done this in the for loop using in range but I thought this made more sense.</p><p>Finally print the result.</p><pre>print(tree_count)</pre><h3>Part 2</h3><p>Part 2 added some complexity as always, we now had to test 4 different runs down the map and multiply the results together. For me I had these to check</p><blockquote>Right 1, down 1.</blockquote><blockquote>Right 3, down 1. (This is the slope you already checked.)</blockquote><blockquote>Right 5, down 1.</blockquote><blockquote>Right 7, down 1.</blockquote><blockquote>Right 1, down 2</blockquote><p>For the ones which were down 1 it was just a case of changing the <strong>right</strong> variable in the code for part 1 and noting the result, pretty simple. However the last sequence in the list was 2 down which required some tweaks to the code, here is the new code.</p><pre>map_lines = mapData.split(&quot;\n&quot;)<br>cp = 1<br>tree_count = 0 <br>right = 1</pre><pre>def multiLine(l):<br>    line = l*100<br>    if x ==1:<br>        return MakeMove(line)<br>        <br>def MakeMove(l):<br>    global cp<br>    #look at the line and move accross 3 <br>    cp += right<br>    pos = cp<br>    if l[pos] == &quot;#&quot;:<br>        return True<br>    else:<br>        return False</pre><pre>for l in map_lines:<br>    global tree_count<br>    index = map_lines.index(l)<br>    if index != 0 and index % 2 == 0:<br>        if multiLine(l):<br>            tree_count += 1</pre><p>The changes are made are in 2 places, firstly I added ‘ <strong>and index % 2 == 0</strong>&#39; to my if statement in the for loop. By checking if the index was divisible by 2 meant I only checked every other line for trees. I expected this to be the only change I needed but it produced the wrong result. After lots of head scratching and checking everything twice, I changed <strong>cp</strong> to 1 as its initial value which fixed the issue.</p><p>Then just multiply the 4 results and we are all done.</p><p>Day 3 took me much longer then it should have, as in the end it’s pretty simple, hopefully day 4 clicks quicker.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd10f563b884" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advent of Code — Day 2]]></title>
            <link>https://jobyid.medium.com/advent-of-code-day-2-c9409f638f8a?source=rss-b8eb30bc5135------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9409f638f8a</guid>
            <category><![CDATA[strive-school]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[advent-of-code]]></category>
            <dc:creator><![CDATA[Joby Ingram-Dodd]]></dc:creator>
            <pubDate>Fri, 04 Dec 2020 17:47:26 GMT</pubDate>
            <atom:updated>2020-12-04T17:47:26.237Z</atom:updated>
            <content:encoded><![CDATA[<h3>Advent of Code — Day 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g4vJO3u2lZABYKEm" /><figcaption>Photo by <a href="https://unsplash.com/@joshuaryanphoto?utm_source=medium&amp;utm_medium=referral">Joshua Reddekopp</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><a href="https://jobyid.medium.com/advent-of-code-day-1-ebc8400d05f3">DAY 1</a></p><p>Welcome to day 2 of the <a href="https://adventofcode.com/">Advent of Code</a> challenge, the level stepped up a little today but still pretty doable. I am still continuing on my python mission and even know some of the syntax now. As it happened my daughter woke me at 5:30 am which was not ideal but did give me some time to work through this issue.</p><h3>Part 1</h3><p>So the challange was to decipher some passwords and see if they meet the password rules set by North Pole Toboggan Rental Shop. As was the case in <a href="https://jobyid.medium.com/advent-of-code-day-1-ebc8400d05f3">day 1</a> we were given a txt file with lines of text as below.</p><pre>7-14 r: zrqmcfrvsrfrrvmr</pre><p>The 2 numbers at the front show the lowest and highest number of times, the letter before the :, can appear in the password, our task was to work through the list and count the valid passwords. So here is the code I used to do it.</p><pre>split = data.split(&quot;\n&quot;)<br>valid = 0<br>notValid = 0 <br>#rules, the password must contain at least the letter at least the minimum number times and no more then the max</pre><pre>#step 1 is to make some functions that work for a single line in the input <br>def splitLine(x):<br>    #takes a line and splits by space, then removes the : so we end up with the 2 numbers the letter and password as 3 variables<br>    xs = x.split(&quot; &quot;)<br>    y = xs[0]<br>    l = xs[1].replace(&quot;:&quot;, &quot;&quot;)<br>    p = xs[2]<br>    #pass these 3 variables to the next function<br>    return getRule(y,l, p)<br>    <br>def getRule(y,l, p):<br>    #this function breaks out the minium and mximum times the letter should appear <br>    z = y.split(&quot;-&quot;)<br>    minC = z[0]<br>    maxC = z[1]<br>    letter = l<br>    #pass the min max , letter and password to the next function<br>    return checkPwd(l, minC, maxC, p)<br>   <br>    <br>def checkPwd(l, mc, ma, p): <br>    #this checks to see if the passwrod meets the rules <br>    count = p.count(l)<br>    #is the letter in the. password more then or equal to the min and less then or equal to the max  <br>    if count &gt;= int(mc) and count &lt;= int(ma):<br>        return True <br>    else:<br>        return False<br>#returns all back through functions</pre><pre>#now run a for loop passing each line through the functions and updating the valid or invalid totals  <br>for x in split:<br>    if splitLine(x):<br>        valid += 1<br>    else: <br>        notValid += 1<br>        <br>print(valid)</pre><p>I like to split problems into their parts and use a function for each part, as it helps me make it clear in my mind. This is exactly what I did here.</p><ol><li>Function 1 splits the line up and passes the parts to the next function</li><li>Function 2 splits out the rules the password should meet</li><li>Function 3 checks the password against the rules</li></ol><p>Finally I use a for loop to run through the list and update a counter for the valid passwords.</p><h3>Part 2</h3><p>As is the trend each day the second part adds complexity to the first task. Day 2 was no different, we now had to check the position of the letter inside the password. Using the example from above</p><pre>7-14 r: zrqmcfrvsrfrrvmr</pre><p>the letter ‘r’ can only be in possition 7 or 14 but not both, the twist being we must conpensate for 0 indexing and shift the index of the first letter to be 1. My approach was essentially the same as above but with the added checks included</p><pre>#second part</pre><pre>valid2 = 0<br>notValid2 = 0</pre><pre>def splitLinetwo(x):<br>    xs = x.split(&quot; &quot;)<br>    y = xs[0]<br>    l = xs[1].replace(&quot;:&quot;, &quot;&quot;)<br>    p = xs[2]<br>    return getRule2(y,l, p)<br>    <br>def getRule2(y,l, p):<br>    z = y.split(&quot;-&quot;)<br>    minC = z[0]<br>    maxC = z[1]<br>    letter = l<br>    return chkpwd(l,int(minC),int(maxC),p)</pre><pre>def chkpwd(l, mi, ma, p):<br>    #print(p[mi])<br>    if p[mi-1] == l and p[ma-1] != l:<br>        return True<br>    elif p[ma-1] == l and p[mi-1] != l:<br>        return True<br>    else: <br>        return False<br>    <br>for x in split:<br>    if splitLinetwo(x):<br>        valid2 += 1<br>    else: <br>        notValid2 += 1<br>        <br>        <br>print(valid2)</pre><p>Day 3 coming tomorow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9409f638f8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advent Of Code-Day 1]]></title>
            <link>https://jobyid.medium.com/advent-of-code-day-1-ebc8400d05f3?source=rss-b8eb30bc5135------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebc8400d05f3</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[advent-of-code]]></category>
            <category><![CDATA[strive-school]]></category>
            <dc:creator><![CDATA[Joby Ingram-Dodd]]></dc:creator>
            <pubDate>Thu, 03 Dec 2020 21:18:15 GMT</pubDate>
            <atom:updated>2020-12-03T21:36:58.517Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Mx2xWxYQ0XQspDN0" /><figcaption>Photo by <a href="https://unsplash.com/@goshua13?utm_source=medium&amp;utm_medium=referral">Joshua Aragon</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I recently joined <a href="https://strive.school/">Strive School</a> on their AI engineer course and as part of our exercises I was introduced to the <a href="https://adventofcode.com/2020">advent of code</a>. Turns out it’s been running for a few years, although I’ve never heard of it before. Still it’s a nce way to improve your coding and what better way to procrastinate when you have course work to do.</p><p>Each day you need to solve 2 problems to collect your stars, if you are in the first 100 poeple to solve it you get points to move up the leaderboard. Day 1 started ok, nothing to crazy, but here is my take on the code.</p><h3>Part 1</h3><p>The part 1 task was to work through a list of numbers to find the 2 numbers which add up to 2020. Apparently the elves need them for their accounts, apparently they don’t have quickbooks.</p><p>The list of numbers supplied comes as a txt file so i started by bringing it in as multi-line string. Oh incidentally as we are learning AI on the course it’s pretty much all python coding so I’m doing all the challenges in python rather then my preferred swift.</p><p>So here is the simple code for part 1, I start by splitting up the string into lines, and loop through the lines. I decided the best approach was to loop through the numbers deducting each from 2020 then seeing if the result appeared in the list. Then print the 2 numbers, to submit the result we just multiply them together.</p><pre>a = input.split(“\n”)<br>for x in a:<br>    y = 2020 — int(x)<br> <br>    if str(y) in a:<br>          print (x)<br>          print (y)</pre><h3>Part 2</h3><p>Part 2 simply adds in some complexity by asking you to find the 3 numbers that up to 2020. I stuck with the same process as before just adding another loop to the process. I added a check with the i variable to make sure I didn’t use the same number twice in my calculations. Then it was just a case of looping through the numbers twice and checking if they add up to 2020, finally printing the result of multiplying them.</p><pre>for x in a: <br>   i = a.index(x)<br>   for y in a:<br>        iy = a.index(y)<br>        if i != iy:<br>            z = 2020 - int(x) - int(y)<br>            if str(z) in a:                <br>                print( int(x) * int(y) * z)</pre><p>Day 2 coming tomorrow, they get harder each day so lets hope I make it to day 25.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebc8400d05f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>