Advent of Code 2016 – Day 4 (Perl)

Previous:

Advent of Code 216 – Day 3

Advent of Code – Day 2

Advent Of Code 2016 – Day 1

Day 4

Start: 12/5/2016

Finish 12/6/2016

Language: Perl

SPOILER ALERT: If you have any inkling, any whatsoever, to work on the Advent of Code…. DO NOT READ THIS BLOG POST.  DO NOT LOOK AT MY GITHUB PROJECT.  It is no fun if you’re not solving it yourself, and you’ll feel so much better about yourself if you can figure it out without looking up an answer.  This blog post is not to give away the answer, but instead, is there for people to learn from.

As always, the following code is in my GitHub: https://github.com/pviafore/AdventOfCode2016

The Challenge

This day, the goal was to try and figure out which rooms out of a list were valid by matching up a checksum with their most frequent characters.  I really liked this idea.  What I didn’t like was the fact that I chose Perl for this.  I had never written Perl before in my life.  And I never want to ever again either.
Continue reading

Advent of Code 2016 – Day 3

Previous:

Advent of Code – Day 2

Advent Of Code 2016 – Day 1

Day 3

Start: 12/5/2016

Finish 12/5/2016

Language: Clojure

SPOILER ALERT: If you have any inkling, any whatsoever, to work on the Advent of Code…. DO NOT READ THIS BLOG POST.  DO NOT LOOK AT MY GITHUB PROJECT.  It is no fun if you’re not solving it yourself, and you’ll feel so much better about yourself if you can figure it out without looking up an answer.  This blog post is not to give away the answer, but instead, is there for people to learn from.

As always, the following code is in my GitHub: https://github.com/pviafore/AdventOfCode2016

The Challenge

So this one wasn’t too bad.  Reminded me of a Project Euler problem.  Find the number of triplets that could be a valid triangle (the sum of two sides are always greater than the other)

Continue reading

Advent of Code – Day 2

Previous:

Advent Of Code 2016 – Day 1

Day 2

Start: 12/4/2016

Finish 12/4/2016

Language: Python3

SPOILER ALERT: If you have any inkling, any whatsoever, to work on the Advent of Code…. DO NOT READ THIS BLOG POST.  DO NOT LOOK AT MY GITHUB PROJECT.  It is no fun if you’re not solving it yourself, and you’ll feel so much better about yourself if you can figure it out without looking up an answer.  This blog post is not to give away the answer, but instead, is there for people to learn from.

As always, the following code is in my GitHub:

 

Problem Statement

The problem started off simple enough.  There is a 9 digit keypad listed:

123
456
789

 

If you start at the 5 key, and are given directions to move up, down, right or left, multiple times, what are the keys that you end at after each iteration of directions?

Not too bad, and I was picking a language in my wheelhouse, Python.  I chose Python 3, since I don’t get much experience with it, but unfortunately, this program did not stretch my knowledge of Python 3.  There wasn’t enough meat to the problem to really dive in.

So let’s look at the code:
Continue reading

Advent Of Code 2016 – Day 1

So on Hacker News, I came across something awesome.  Advent of Code (http://adventofcode.com/)

A programming challenge that takes 25 2-part challenges, one  a day until Christmas.  I’ve been looking for a side project to hone my code, and this was perfect.  Especially after dragging my feet on board game bots, Alexa skills, general programs, and so on and so forth.  I’ve been having a bit of trouble lately because I haven’t felt like I was advancing my technical skills in a bit, and this will help.

I’ve done plenty of coding challenge sites before, with the most notable being Project Euler, so i wanted a nice challenge this time.  I knew I wasn’t going to be the fastest on the site, so speed wasn’t going to be an option.  Instead, I want to work on being a polyglot.  Let’s work in a few different programming languages.  The goal then, 25 languages in 25 days.  Am I going to be successful?  Probably not.  I have a hackathon week at work.  I have Christmas shopping to do.  I make dinner every night and have a wife and son to tend to.  But, once everyone goes to bed and the house is quiet, it’s my time to shine.

Let’s look at how the first day went……

Continue reading

DevspaceConf16 Day 2

Talk: The Joy of Desktop Apps with Electron (by David Neal – @ReverentGeek)

So this was the talk I was waiting for, but I just didn’t know it yet.  I knew about Electron (a cross-platform desktop application builder using web technologies) through the use of Atom, but I didn’t understand the intricacies.  But as David spoke (and he was a great speaker, with hand-drawn images peppering his slides, adding charm), I found myself not listening at times, and instead wondering what I could do with Electron.  To me, this is a successful talk, where it gets my brain spinning for new ideas and I want to go work with it.  In December, we have a week long hackathon at work, so I’m definitely interested in doing more.

Continue reading

Devspace16 Conf (Day 1)

Welp, I made it to DevSpace, securing my goal of going to a conference this year.

DevSpace is a conference in its second year in my hometown of Huntsville Alabama.  To be honest, the talks didn’t draw me in as strong as PyTennessee or StrangeLoop did last year, but I wanted to give it a chance and learn new things.

I went to a meetup earlier this week, and the conference organizer, Chris Gardner (@freestylecoder) talked about the conference.  He said something that stuck with me, in that this conference is all about learning new things.  They specifically organized it so that if you had a specific interest, it’d be present at the conference, but wouldn’t overwhelm us.  For instance, you can like web programming, but with 11 talk slots, you won’t be able to go to 11 web talks.  I liked that.  I liked the encouragement of stepping out of your comfort zone, and that renewed my interest and enthusiasm for the conference.

So between today and tomorrow, I’m going to try to step out of my comfort zone, and push my boundaries.  I’ll go to talks that I normally wouldn’t go to, or even if I don’t have interest in, because I’m here to learn something new.

I also want to keep a record of what I’ve seen, so I’m going to do a short write up on each of the talks.

Continue reading

First Conference Proposal

So a few days ago, I officially submitted my first conference talk!  Bdd to the Bone: Test-Driving Web Applications with Behave and Selenium.  It’s no secret that testing is close to my heart as far as software enginnering goes, so I wanted to give a talk representing some of my interests.  I want to talk about some of the things that went through my head on this.
Continue reading

B-B-B-Battleline

Its no secret that I like board games.  It’s one of my go to timekillers.  Settlers of Catan, Dominion, Agricola; I’m a sucker for Eurogames.  I play with a few friends from work from time to time, and over time, we started trying to learn things together.  We set up a software book club, and that eventually morphed into an AI learning club.  We joined The AI Games, and had a blast with it, but then decided to see if we could take a crack at something similar for our private group.

We decided to start trying out some board games we knew.  We wanted to build an engine that allowed bots to play the game against each other.  The engine would run all the rules and coordinate communication, and each bot would supply the moves.   One of us mentioned a two player game called Battle Line,  designed by Reiner Knizia and we decided to go for it.

I had written an Elixir bot for the AI Games, and wanted to try again with Battle Line.  I had used metaprogramming to set up a simple engine, and it definitely made it so that I could spin up a strategy quickly.

Continue reading

In With the New

Well, it’s been a long time since I last wrote a post.  I knew this would happen, where I would take forever to write, and then life would get in the way (Not that that’s a bad thing).  But I’m back, and I have some news.

Since I last wrote, I was able to make a successful Warlight bot in Elixir.  I really liked Elixir (it might be my favorite language, but I use Python so much more that it will be tough).

Then at work, we decided to write some AI for boardgames we played, and I had a chance to do more in Elixir.  I got to play around with metaprogramming (templated out a game engine), which was one of my goals.  Growing up with C++ macros and hating them, I was hesitant, but once I understood that they were AST macros, and not  preprocessor text search and replace, something clicked, and I appreciated them.

I have no idea if how I wrote the code was good or not, but I got to learn something, and that’s what matters to me.  It matters a lot.

Continue reading

A few successes later

In what has been a very good week, I’m happy to say that I have some successes.

First, I got to play around with the programming language Julia.  This is part of the ongoing work I’m doing with 7 More languages in 7 weeks.  Julia is a nifty little language that excels in technical computing.  It was real simple to pick up the basics, and I could see where math-heavy programs can utilize it.  The examples head you playing with multi-dimensional arrays and transforming them.  Had I remembered any linear algebra, I could see why this would be so attractive.    I’m interested in seeing what’s next in this language.

Second, I made some good success on Project Euler.  I was working on problem # 100 (hooray a round number), which involved probabilities (blech).  I don’t want to give away too many secrets, but I went about it all wrong to begin with.  My Clojure Program took at least 4 days to run, but I was happy to get a right answer after that.  I’ve done some problems that ran for days, only to be wrong.  I knew that the code I was running was fast, but the problem was I was just checking too many numbers.  My problem domain was too large.  More often than not, its an algorithmic optimization that buys you the most, not the small stuff (which is a very tough thing to convince when working with embedded engineers used to optimizing assembly).  I was able to see a much faster solution after I solved the problem, and I can tell you that it only had to make 8 or 9 iterations of a computation, rather than a couple hundred billion.

Lastly, I’m happy to say that I got my elixir starter bot for Warlight2 interfacing with the server : https://github.com/pviafore/warlight2-starter-bot-elixir.  I sent if off to the ai games to try and get elixir installed as a supported language on their systems, so time will tell if that works or not.  I liked this project so far in Elixir, because the whole actor model makes it very, very easy to keep things isolated, which makes testability a snap.   I want to get better at Elixir macros, so that I can better understand metaprogramming, and I’m hoping my next few iterations will do just that.