<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>python on Computing Club</title>
    <link>https://computing-club.notes.dmaitre.phyip3.dur.ac.uk/tags/python/</link>
    <description>Recent content in python on Computing Club</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-gb</language>
    <lastBuildDate>Tue, 29 Oct 2019 19:26:34 +0000</lastBuildDate><atom:link href="https://computing-club.notes.dmaitre.phyip3.dur.ac.uk/tags/python/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Outreach Raspberry Pis</title>
      <link>https://computing-club.notes.dmaitre.phyip3.dur.ac.uk/posts/outreach-raspberry-pis/</link>
      <pubDate>Tue, 29 Oct 2019 19:26:34 +0000</pubDate>
      
      <guid>https://computing-club.notes.dmaitre.phyip3.dur.ac.uk/posts/outreach-raspberry-pis/</guid>
      <description>Today was the first day of Celebrate Science 2019. Whilst taking a break from running our exhibit, I had a look at our Pis.
Meet the Pis There are nine in total.
Four have stands in the horizontal/landscape configuration. Yesterday, Henry and I found that three of these run the NuOdyssey game locally. Apparently it was written by somebody called Sunil, anybody know that story? You just start the browser which automatically brings up the game as its starting page.</description>
      <content>&lt;p&gt;Today was the first day of Celebrate Science 2019.
Whilst taking a break from running our exhibit, I had a look at our Pis.&lt;/p&gt;
&lt;h3 id=&#34;meet-the-pis&#34;&gt;Meet the Pis&lt;/h3&gt;
&lt;p&gt;There are nine in total.&lt;/p&gt;
&lt;p&gt;Four have stands in the horizontal/landscape configuration.
Yesterday, &lt;a href=&#34;../../author/henry-truong/&#34;&gt;Henry&lt;/a&gt; and I found that three of these run the &lt;a href=&#34;https://ghostsintheuniverse.org/nuodyssey/&#34;&gt;NuOdyssey game&lt;/a&gt; locally.
Apparently it was written by somebody called &lt;a href=&#34;https://xikka.com/about&#34;&gt;Sunil&lt;/a&gt;, anybody know that story?
You just start the browser which automatically brings up the game as its starting page.&lt;/p&gt;
&lt;p&gt;The fourth horizontal one, which is visually distinguishable from the others, runs the Galton server: you interface the Pi with the Galton board via USB and it records balls passing through the light gates.
I found that this all worked: it recorded the physical Galton board and graphed the results in realtime.
The Galton server Pi has also been set up to remotely control the other Pis.
It has scripts to remotely shutdown, reboot, and start and stop simulations.
I found that this was not working, though.&lt;/p&gt;
&lt;p&gt;The other five are in the vertical/portrait configuration and run the Galton simulation.
I had noticed that one of these has nothing installed on it, so I installed the Galton simulation software on it.
I decided to record the process here since it would have been &lt;em&gt;very&lt;/em&gt; useful for such a resource to exist for me to use!
And also because I&amp;rsquo;m waiting for a Pi to finish updating itself&amp;hellip;&lt;/p&gt;
&lt;h3 id=&#34;getting-online&#34;&gt;Getting online&lt;/h3&gt;
&lt;p&gt;Firstly, the Pis don&amp;rsquo;t seem to be able to connect the university wifi, probably because they don&amp;rsquo;t support the security protocol &amp;mdash; maybe something we could fix by installing a new package?
You can, however, log into the wifi network &lt;code&gt;TheCloud@Durham&lt;/code&gt; - although you may have to manually navigate to &lt;a href=&#34;//service.thecloud.net&#34;&gt;//service.thecloud.net&lt;/a&gt; to complete login - or plug in an ethernet cable.
Once online, I ran a &lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt -y full-upgrade&lt;/code&gt; (then &lt;code&gt;reboot&lt;/code&gt;) for good measure.
This took a long time.
Then I ran &lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt install emacs vim&lt;/code&gt; to keep everyone happy.&lt;/p&gt;
&lt;h3 id=&#34;portrait-mode&#34;&gt;Portrait mode&lt;/h3&gt;
&lt;p&gt;Next, I had to configure the Pi to operate in portrait mode.
The screen can be rotated by&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;echo rotate_display=3 &amp;gt;&amp;gt; /boot/config.txt&amp;#34;&lt;/span&gt; | sudo sh
sudo reboot
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;which just appends a screen rotation command to the Pi&amp;rsquo;s boot configuration file under sudo privileges and restarts the Pi.
The touchscreen, however, remains configured for a landscape configuration.
To fix this behaviour, I had to persistently adjust the coordinate transformation matrix for the FT5406 touch controller with&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;xinput set-prop &amp;#39;FT5406 memory based driver&amp;#39; &amp;#39;Coordinate Transformation Matrix&amp;#39; 0 -1 1 1 0 0 0 0 1&amp;#34;&lt;/span&gt; &amp;gt;&amp;gt; ~/.xsessionrc
sudo reboot
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It took me forever to figure that one out!&lt;/p&gt;
&lt;h3 id=&#34;getting-the-galton-code-on-the-pi&#34;&gt;Getting the Galton code on the Pi&lt;/h3&gt;
&lt;p&gt;With all that out of the way, I could move onto installing the Galton software.
I made a folder for git repos&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;mkdir ~/git
cd git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;then cloned the GaltonBoard repo&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;git clone https://github.com/eidoom/GaltonBoard.git
cd GaltonBoard
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;and installed dependancies (recall that &lt;a href=&#34;../../author/james-whitehead/&#34;&gt;James&lt;/a&gt; has updated the software for Python 3)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;sudo apt install python3 python3-numpy python3-matplotlib python3-scipy
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;before trying the simulation, &lt;code&gt;./galtonsim&lt;/code&gt;, and it worked!&lt;/p&gt;
&lt;p&gt;I also automated the installation of the application shortcut to the desktop and application menu (with an icon), which can be run with &lt;code&gt;./install-sim.sh&lt;/code&gt;.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Python game dev 3</title>
      <link>https://computing-club.notes.dmaitre.phyip3.dur.ac.uk/updates/python-game-dev-3/</link>
      <pubDate>Fri, 25 Oct 2019 18:00:50 +0100</pubDate>
      
      <guid>https://computing-club.notes.dmaitre.phyip3.dur.ac.uk/updates/python-game-dev-3/</guid>
      <description>Next week&amp;rsquo;s game dev session is inspired by Raspberry Pi&amp;rsquo;s Wireframe, a magazine about game development. You can download the issue we&amp;rsquo;ll be using for free as a pdf from their site. The Donkey Kong article is on page 40. They&amp;rsquo;ve published their code on GitHub, too.</description>
      <content>&lt;p&gt;Next week&amp;rsquo;s game dev session is inspired by Raspberry Pi&amp;rsquo;s &lt;a href=&#34;https://wireframe.raspberrypi.org/&#34;&gt;Wireframe&lt;/a&gt;, a magazine about game development.
You can download the issue we&amp;rsquo;ll be using for free as a pdf from their &lt;a href=&#34;https://wireframe.raspberrypi.org/issues/24&#34;&gt;site&lt;/a&gt;.
The Donkey Kong article is on page 40.
They&amp;rsquo;ve published their code on &lt;a href=&#34;https://github.com/Wireframe-Magazine/Wireframe-24&#34;&gt;GitHub&lt;/a&gt;, too.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Python game dev 2</title>
      <link>https://computing-club.notes.dmaitre.phyip3.dur.ac.uk/updates/python-game-dev-2/</link>
      <pubDate>Tue, 22 Oct 2019 15:15:06 +0100</pubDate>
      
      <guid>https://computing-club.notes.dmaitre.phyip3.dur.ac.uk/updates/python-game-dev-2/</guid>
      <description>On Thursday 31st October (room and time TBC) Andrew will show us how to make a Donkey Kong clone in under 100 lines using pygame, the most popular game library for Python.</description>
      <content>&lt;p&gt;On Thursday 31st October (room and time TBC) &lt;a href=&#34;../../author/andrew-blance&#34;&gt;Andrew&lt;/a&gt; will show us how to make a Donkey Kong clone in under 100 lines using &lt;a href=&#34;https://www.pygame.org/wiki/about&#34;&gt;pygame&lt;/a&gt;, the most popular game library for Python.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Python game dev</title>
      <link>https://computing-club.notes.dmaitre.phyip3.dur.ac.uk/updates/python-game-dev/</link>
      <pubDate>Mon, 21 Oct 2019 14:43:54 +0100</pubDate>
      
      <guid>https://computing-club.notes.dmaitre.phyip3.dur.ac.uk/updates/python-game-dev/</guid>
      <description>In our next meeting, Andrew is going to take us through a great example of game development in Python.</description>
      <content>&lt;p&gt;In our next meeting, &lt;a href=&#34;https://computing-club.notes.dmaitre.phyip3.dur.ac.uk/authors/andrew-blance/&#34;&gt;Andrew&lt;/a&gt; is going to take us through a great example of game development in Python.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Galton board code</title>
      <link>https://computing-club.notes.dmaitre.phyip3.dur.ac.uk/sessions/galton-board-code/</link>
      <pubDate>Mon, 21 Oct 2019 13:25:33 +0100</pubDate>
      
      <guid>https://computing-club.notes.dmaitre.phyip3.dur.ac.uk/sessions/galton-board-code/</guid>
      <description>Ideas for improving the Galton board software  Mass of balls Size of balls Size of pins Width of barriers Fix lag  Due to N=300?   Deploy on Pis from GitHub repo, automate updates Get light gates working Somehow show effect of large N  If performance is an issue, pre-calculate   Add option to drip feed balls into simulation Check dependencies Add sliders to change physical parameters Change gravity on the fly?</description>
      <content>&lt;h5 id=&#34;ideas-for-improving-the-galton-board-software&#34;&gt;Ideas for improving the Galton board software&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;Mass of balls&lt;/li&gt;
&lt;li&gt;Size of balls&lt;/li&gt;
&lt;li&gt;Size of pins&lt;/li&gt;
&lt;li&gt;Width of barriers&lt;/li&gt;
&lt;li&gt;Fix lag
&lt;ul&gt;
&lt;li&gt;Due to N=300?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Deploy on Pis from GitHub repo, automate updates&lt;/li&gt;
&lt;li&gt;Get light gates working&lt;/li&gt;
&lt;li&gt;Somehow show effect of large N
&lt;ul&gt;
&lt;li&gt;If performance is an issue, pre-calculate&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Add option to drip feed balls into simulation&lt;/li&gt;
&lt;li&gt;Check dependencies&lt;/li&gt;
&lt;li&gt;Add sliders to change physical parameters&lt;/li&gt;
&lt;li&gt;Change gravity on the fly? As a vector? Accelerometers in Pis?&lt;/li&gt;
&lt;li&gt;Maybe: allow barriers to be drawn in by hand&lt;/li&gt;
&lt;li&gt;Consider using some more up-to-date libraries? Touch screen interactivity, GUI, physics?&lt;/li&gt;
&lt;li&gt;Make it into a webapp? (not to replace Pi software, to provide in addition)&lt;/li&gt;
&lt;/ul&gt;
&lt;h5 id=&#34;plan-of-action&#34;&gt;Plan of action&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;I&amp;rsquo;ve added the more pedestrian suggestions as &lt;a href=&#34;https://github.com/eidoom/GaltonBoard/issues&#34;&gt;issues on the repo&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;We can assign people interested in working on these there.&lt;/li&gt;
&lt;/ul&gt;
</content>
    </item>
    
  </channel>
</rss>
