Thursday I entered in my first hackathon, Enova’s No Limit Code’em. I partnered with my friend Vaib, a fellow Starter League student.
Our objective was to build a bot capable of playing a game of poker. One that could make a decision on what to bet, determine what to play depending on the hand.
There were three parts to creating a poker bot. The first part was to make a GET request to see if it was our bots turn. If it was our turn the bot would decide what cards to replace, and what to bet for the given hand. The last step was to make an HTTP POST request to the server to post the bots action.
We had six hours to make our bot, SamVaib work. We decided to knock out the GET and POST requests first. That way, if we had no logic for the poker hand written, we could still win a few hands by getting a good draw.
I thought we could figure that part out in an hour or two, and have plenty of time to write the game logic. Five hours later we figured out how to POST to the server, and had less than an hour to teach SamVaib how to play poker.
We installed a poker gem that would tell us the ranking of our hand (Flush, Two-pair, etc…). SamVaib would draw a new card if it had less than three-of-a-kind, and would bet if it had a full-house or better.
Our samvaib poker bot wins the first dozen hands.
The No Limit Code’em Tournament started at midnight. SamVaib won the first hand, and then the second hand, and then a third hand. We didn’t enter any of the test tournaments. I was surprised the bot worked, and more so that we had moved into second place in the tournamnet.
After two rounds at the top of our tables, we made the mistake of trying to improve something that clearly wasn’t broken. We decided to tell SamVaib to double his bet if he had a full-house or better. Things went downhill quickly. The only hands we were winning were hands where everyone else folded.
We tried to ease the bleeding by manually telling the bot what to do. After about 15 hands we realized it was little use the other bots were too fast to keep up with. Our vast early lead helped us make it into the final round, but never won a hand from there. By simply playing not to loose chips, we were able to hold on to Fourth Place.
Other class notes
The past two weeks we have had the Models Views Controller, MVC, framework hammered into our heads. I’ve built Picmarks, an application that lets you store images, a dozen times. I can now build database-backed rails applications, which is a pretty impressive feat only one month on Rails.
The web is far more complicated than I expected. I assumed the web worked like files on your computer with pages of information within them. Views are the visible HTML part of the application. Rails uses a special type of HTML that generates dynamically. Using hash rockets we can create Ruby loops that creates HTML for each item in an array.
Thursday we spent most of the class learning how CRUD, the seven main Rails Methods, and HTTP verbs relate. CRUD Stands for Create, Read, Update and Destroy. They are the core actions in every Rails application. Leland Rowley made an awesome graphic showing how they all work together.
Other hackathon news
Starter League students are on a serious tear at Chicago hackathons this week.
- Team forever-fold that we smoked in the first round was actually Mike Chau and Joe Ngo. They came back to beat us, and grab second place in the Tournament.
- A group of Starter League Students came in Second place at the Nokia MonkeyBars Hackathon. Their concept CitySnap used the Nokia Maps API and pulled local images from twitter so you can see pictures that people are taking around you.
- Another Starter League Team took second at the Chicago Job Hack, sponsored by Career Builder. They build a platform for non-traditional job applicants, thepitch, using Video and the Career Builder API.
The real test will be the Facebook Hackathon at University of Illinois-Champaign this weekend.
This article is from the samuelrsolomon.com archives.