Saturday, November 11, 2017

Oh Baby

I haven't posted anything for a while.  It has been quite a year.  I now live in Amsterdam, work for Booking.com, and my wife is 8+ months pregnant.  After being monumentally disappointed in my native country in 2016, we decided to see what other countries might be interested in two leftist young professionals in the prime of their careers.  We really didn't have many qualifications on the country besides that it should be less soul crushing than America.  After traveling back and forth to Europe twice in 10 days for different interviews with a skype call to Australia for another in between, I accepted a position with Booking.com in late February.  I would have never pictured myself living in Amsterdam, but I couldn't say no to the opportunity to work for one of the largest companies in tourism combined with their amazing relocation support.  Five weeks later, we learned we were also pregnant.

Saying goodbye to America and Chicago over the next 4 months was a whirlwind of stress and emotion, compounded by seeing the start of our son or daughter on ultrasounds a few times.  It was an emotional rollercoaster telling mom and dad that they were going to be grandparents, and, by the way, we're moving to another country.  We ate at all of our favorite restaurants, played as many boardgames with best friends as we could, and packed up and sold all of our stuff.  We sold our house (a long an stressful process that I don't recommend to anyone that included too many questions and an emergency roof repair), I ran my car on fumes after running around so much the gas tank hit zero, and I finally got to take the Skokie Swift.  We even squeezed in trips to Nantucket for Daffodils and Florida for polo.

A few days later, we got on a one way flight with a couple suitcases and one cat each.  Two temporarily unemployed, homeless immigrants with a baby on the way.

The first months in Amsterdam were another whirlwind.  New jobs, new foods, new language.  Even simple things like connection utilities or finding groceries suddenly took all of our cognitive abilities.  We practiced our Dutch, but in your mid 30's, a second language comes slowly.  Housing in Amsterdam was a challenge too.  There's such a shortage of supply that landlords don't bother with things like flooring or appliances and noisy tourists are everywhere.

Moving to a foreign country has been one of the hardest, most scary things we've ever done.  I think everyone should have to experience it.  Even with the mountain of support from Booking and our network back state side, it's still been hard.  I can't imagine how much more difficult it must be for people fleeing poverty or violence or looking for a better life with nothing but what they can carry.  Heck, everyone here speaks English, and it's still hard.  I have so much respect, not just our ancestors who immigrated from place to place to give us the lives we have today, but also the immigrants and refugees that politicians are so apt to scapegoat lately.  It's a challenge, but it makes us and our international community stronger.

Obviously, being in one of the world's most international cities hasn't been all that bad.  The new foods, which are mostly comfort foods and sugary things to put on toast, are a delight.  Once we got bikes, the city opened up dramatically.  We've also done a lot of exploring outside of Amsterdam, taking trips to The Hague, Rotterdam, Bordeaux, Malaga, London, Oslo, and Copenhagen.  At Booking.com, it's been rewarding to work for a company in an industry I love and whose mission and vision I deeply believe in.  Despite what people say, the weather has been fine, with summer mainly comfortable, sunny, long days, and fall and winter fairly mild.  There is rain, but with a good raincoat and rain pants, it's been tolerable.  Our Dutch is slowly getting better.

Oh, and there's the whole side of having a baby here.  Unlike many selfish, short-sighted conservatives in America, the Dutch see the benefits of supporting mom's, families, and babies.  The representative from the health insurer made the simple point that, "we want happy, healthy babies and children, so we commit resources to it as a country."  Healthcare is free for children and good and affordable for adults.  Women get 4 months of paid leave.  Pregnancy is considered a normal part of life, instead of a medical condition, so fewer doctors and hospitals and more pragmatic care.  It's normal and expected for both men and women to adjust their schedules to part time in order to spend more time with their families.  Plus, we get a kramzorg - literally a person comes to our house for a week after the baby is born to help us figure out what we're doing and even help with housework. 

Looking a few years down the road, the schools are reliably in the top 10 globally and family life is exceptional.  There is still a lot of exploring to do and we've yet to host our first visitor.  We've given ourselves a minimum of at least 2 years here, so we'll see how it goes, but I worry it's going to be equally as difficult to leave as it is to stay.

Sunday, December 4, 2016

Fantastic Bot for Fantastic Bits

The winter 2016 CodinGame contest, Fantastic Bits, just wrapped up and I am incredibly excited by how well I was able to do.  This was my fifth contest since joining the site in spring this year, but it was the first time that the contest has fallen on a week where I've been relatively free to focus without distractions since my initial participation in the Smash the Code contest.  The results definitely reflect this, as I finished 4th in the country and 42nd overall out of 2400 entries from top programmers around the world.  In fact, in the final few minutes I climbed as high as 1st in the country and 18th overall, before some last minute changes and optimizations by other players caught me off guard.



Needless to say, I am extremely proud of how well my bot programming turned out.  I used C# for my language this time (and finished as the 6th best C# entry), which meant that I had no problems with performance and was able to do simulations and calculations plenty fast.  The contest this time was a video game version of Quidditch, where you control 2 wizards trying to score goals against your opponent while avoiding bludgers and using flying, throwing, and magic.

The big challenge in this contest was the number of different choices to be made each round.  With 2 wizards, up to 7 balls, 2 bludgers, 2 enemies, and 4 potential spells to use, the options quickly compound.  Early on, I struggled with how to best handle this, until I came up with a generic command and ranking architecture.  This allowed me to iterate through the breadth of options, generate ranked values for each possibility, and then execute whichever ones gave me the best possible score.

Other factors that strongly contributed to performance were how to calculate which wizard pursued which balls, optimizing the trajectory and thrust trigonometry for best intercept, and finally simulating trajectory of shots on goal to avoid getting blocked and maximize scoring potential.  By having a generic system that assigned value ranks to each action, I was also able to adjust weighting and scoring ratios to optimize my wizards' AI behaviors.  This made a big difference once I broke into the top 100, because I needed a way to genetically adjust to wins and losses in order to slowly climb up the ranks.

This was another great, engaging contest and I'm sad that it's over.  I can't say enough good things about CodinGame.  I look forward to seeing reading the breakdown of the contest once all the data is analyzed, and I hope I can learn enough to improve on my performance even more for next time and maybe threaten for a top spot.

Tuesday, May 10, 2016

Smashing Code

In a recent post, I talked about CodinGame, a website full of programming challenges, games, and AI puzzles.  Well, this past week, they also ran a week long, competitive programming challenge called Smash the Code.  Apparently they hold these periodically and some companies use them as recruiting opportunities, sort of like a more fun version of a technical coding interview problem.

Since I've been enjoying myself so much wiriting code to solve the games and puzzles, I figured I'd give the contest a shot to see how I do.  The contest was essentially a week long hackathon to write AI code to control one side of a 2 player Tetris style game.  The rules got more complex as you progressed through different tiers, but the basics were that you tried to clear rows on your side and pile up rows on your opponents and whoever scored more points or stayed alive the longest won.

Once you were happy with your code, you could choose to submit it against the other players in your current tier, at which point they ran 100's of simulations to determine your respective Elo rating.  If you ranked higher than that tier's baseline "boss" you leveled up to the next tier, and if not, it was back to the drawing board.

I'm happy to say that, even though I don't have any formal game training, my programming skills were enough for me to earn my way to a finish in the top 20% overall and 22nd in the country.  This was despite choosing to program in JavaScript, when the main program involved a lot of breadth and depth simulations and had a 100 ms time limit per round.  Not surprisingly, many of the top finishers used the more efficient choices of C++, C#, Java, etc. while the top JavaScript finisher was 61st.



Even though my program was only able to simulate about 4 rounds ahead, I was pretty happy with the solution I came up with for my first contest.  It ended up being flexible and able to be tuned with different weighting parameters that allowed me to tweak the behavior and helped me make a last minute push up the rankings.  Not bad for the first time, but I'm already thinking of ways to improve for next time...

Friday, April 15, 2016

Games and AI

A few weeks ago on Facebook, I saw an ad for CodinGame advertising games for programmers.  Despite the fact that I work full time as a software developer and love writing good, pretty code, I've never really managed to get any good projects started in my spare time like working on open source team.  Of course I do a lot of dabbling, creating tools to optimize my international travel plans, programming hobby robotics, building up my home automation network, and of course, volunteering at the museum.

Still, I hadn't found much to fill random bits of free time when I want to flex my programming muscles without starting a long term project, but so far, CodinGame has been the perfect fit for just that.  It's a treasure trove of programming challenges divided into different categories and difficulties, each with a fairly well made backstory and graphics.  The stories so far have included the Matrix, Terminator, space travel and are a fun way to give a contrived programming task some flavor.

I'm quickly learning fundamentals of game development and AI that I haven't been exposed to working on more business-y software like backtracking, pathfinding, and depth and breadth first searches.  I'm also seeing how concepts I'm already familiar with like binary searches, recursion, and simulation apply in different ways, and, of course, I'm brushing up on a lot of geometry and trigonometry.  In addition, since they have IDE's for lots of languages, it's a great tool to stay fresh in different languages, like writing some JavaScript when you've been doing tons of backend C# or some C++ when everything you've been working on has been managed code.

I haven't been signed up long, but I've already flown through a bunch of the easy ones, created solutions that I'm pretty proud of on some mediums, and started to unlock the hard levels.  I know it's not productive in the same way as open source projects, but it's definitely helping me learn, grow, and stay sharp as a developer.  I don't totally know how they make money, because there don't seem to be many ads given the quality of the platform, but while it lasts, I'm happy to have it as an outlet for some of my programming energy.

Friday, January 15, 2016

My First Maker Project

We're going through a bit of early year cleaning, and I came across the remains of what I consider to be my very first "maker" project.


What is it you might ask?  Well, believe it or not it's a projector made from a bunch of chipboard, a dissected LCD screen, a Fresnel refracting sheet to focus the image, a map loupe as a projecting lens, and a work light to power the whole thing.  I forget when exactly I built this, but I think it was summer 2003, when the cheapest projectors were close to a grand and the discount, pocket sized ones we have today were still a long way off.

I made the whole thing with hand tools in my parents' basement over a college break.  It's safe to say it wasn't HD quality (the edges of the screen had the hazy border like TV sitcom dream sequences), but given time it was built and the materials it required, I thought it was pretty impressive.

The front piece slid on 4 carriage bolts as a focusing mechanism and the lid had a couple small fans built into it to prevent overheating.

Here's an example of my design-on-the-fly approach.  I was able to keep the monitors control board attached and just bend the ribbon cable 90 degrees to expose the controls and VGA port on the outside of the projector.

I took inspiration from other projects on the internet, but like many of my projects, pretty much designed things as I went.  Besides learning about optics and of course, having a passably working projector, the coolest thing about building this was taking apart an LCD screen and realizing that the image on the screen is displayed on a transparent layer, which is simply lit from behind by a light with a diffuser.  Here's a pretty nice video showing what I mean:

Sunday, January 25, 2015

Another Nao Video

It's been a while since I've had a little project with one of the Nao robots at the museum, but here's a quick one that I was asked to create on short notice.  Over the past 4 or 5 years I've put together performances for big crowds, trade show booths, and private greetings, so I've gotten pretty good at programming some quick motions, adding some voice and sound effects, and then refining until its reasonably smooth.

Honestly, one of the biggest challenges with this platform is getting the voice just right, since I'm working with a text to speech engine.  Sometimes this means tweaking the speed or using homonyms with nicer pronunciations ("humans" always sounds better as "hugh, mens".)  Occasionally though it even means getting into adjustments to the pitch, emphasis, and pauses.

One of the most valuable tools I've found to help with refining both the vocals and the movements is to record video so I can really dissect things (in fact, most of the videos on this blog are saved from testing.)  It can be incredibly useful to rewatch little snippets over and over to get a feel for what's good or bad as opposed to watching it in real time and trying to remember the details after the fact.  It also helps to compare versions as you make small adjustments so that you can decide which option is better.

Sunday, November 9, 2014

Robotic Penguin

As my family's resident robot aficionado, I get all the cool robot links sent my way.  This week, my future brother-in-law came across this interesting combination of robotics and adorable baby emperor penguins.

Obviously the immediate question was why I haven't build a robotic baby penguin of my own, so I set to work to provide a quick response.  Spoiler alert: antarctic researchers have a much more substantial budget than I do.