This month we looked at building up complex parsers based on a set of simple building blocks.
As usual we divided up into pairs and followed a set of prepared exercises. The exercises took you from writing a parser to identify single characters to be able to compose them together in order to parse a custom DSL.
David Betteridge, 18th July 2016
This month we worked in pairs to implement
Conway's Game of Life. As usual there was a good set of solutions generated in a range of languages including Python, Rust, C# and C++
Some of the solutions are available from our
git hub repro
David Betteridge, 14th June 2016
This month we looked at the creation of mazes based on some of the algorithms in Jamis Buck's book "Mazes for Programmers - Code Your Own Twisty Little Passages".
We began with a binary maze. This is created by looking at every cell in the maze and removing either the top or right hand wall. This results in the generation of a "perfect" maze. This is a maze with no loops, and where there is exactly one route between any two cells.
By using a breadth-first algorthim we worked out the number of steps it took to reach a cell from a central starting point. This highlighted a problem with our binary mazes, in that there is a bias along it's diagonal.
This was solved by using a random walk algorithm. From the starting cell we randomly remove one of the four walls and then walk into that cell. (If we had previously visited that cell then the wall isn't removed)
Finally using the results of our breadth-first algorthim the shortest path across the maze was determined.
Some of generated mazes are on the
meetup site and/or on
yogile.
David Betteridge, 16th May 2016
For our first meeting we decided to start with a fun activity – a game of code golf!
For those new to the sport, the aim is to solve a given problem using as small a program as possible. The program size is measured by the number of bytes the source code file requires.
I had enjoyed solving “Ten Green Bottles” previously at the Leeds Code Dojo, but I wanted us to try something different. After some thought, I came up with the rhyme “Head Shoulders Knees and Toes”. The rhyme has 9 verses, where each verse is the same as a previous verse but with an additional word removed. (See
code_golf_solution.txt)
We had about 20 attendees, so we split up into teams of 2 or 3. The teams used a range of languages including C#, Python, Javascript, Rust and Elixir. The standard of the competition was high, with some very clever solutions being produced.
The winning team, imaginatively named “..., ..., ..., ..., ...” (Luke, Garry and Andrew), took an early lead with a python solution containing a base64 encoded compressed version of the text. Although clever, they thought perhaps it wasn’t quite in the spirit of things. They went on to code it correctly and still won!
The other python team “Anarcoders” (Dave and Mel) came a close second, but their 275 bytes didn’t quite catch the winners 230 bytes.
Credit must be given to team “Magic Potion” (Doug and Steve) who had to also learn to program in Elixir at the same time as completing the challenge.
An evil(!) solution was produced by team “Java The Script” (Paul and Alice). Their recursive javascript function didn’t have a base case, so the program only exited due to an error condition.
The latest version of C# includes an interactive window and team “YorkDevOffice” (Chris and Anton) used this to show that C# can now compete at Code Golf. Unfortunately they missed off the final verse of the rhythm and their quickly fixed version lost them a position.
Team “Rusty Skills” (James and Roy) improved their Rust coding abilities and were closely chased by team “Vesacorp” (Liam and Luke) with their various javascript approaches.
And finally, team “Blunt at C#” (Daniel and Simon) managed a solution which was larger than if they had just printed out the entire rhyme…
The scores at the end of the night were as follows :-
Position |
Team Name |
Members |
Language |
File Size (Bytes) |
1 |
..., ..., ..., ..., ... |
Luke, Garry and Andrew |
Python |
230 |
2 |
Anarcoders |
Dave and Mel |
Python |
275 |
3 |
YorkDevOffice |
Chris and Anton |
C# |
292 |
4 |
Java the Script |
Paul and Alice |
Javascript |
307 |
5 |
Rusty Skills |
James and Roy |
Rust |
315 |
6 |
Vesacorp |
Liam and Luke S |
Javascript |
405 |
7 |
Magic Potion |
Doug and Steve |
Elixir |
669 |
8 |
Blunt at C# |
Daniel and Simon |
C# |
2168 |
A lot of these solutions (plus some more recent improvements) have been added to our
github repro.
David Betteridge, 13th April 2016