

Show HN: March Madness for Hackers - nimz
https://www.codersbracket.com/code_bracket

======
dy
Hey - David from Fullstack Academy. Our students this semester decided to
build something awesome around learning to code and March Madness and
codersbracket.com is the result.

It's March Madness brackets but instead of picking teams, people can write
code that will automatically generate their bracket for them. Our students
have raised some money and are donating it all to code-learning organizations
(CodeNow, Code.org, GirlsWhoCode).

------
yeldarb
Could you add the last couple years' brackets and stats as an algorithm
tester?

Would be cool to run your algorithm against previous years to see how it would
have done so you can refine it before submitting.

I'm imagining coloring the final bracket green/red for correctly/incorrectly
predicted games in the simulation.

~~~
nimz
Hey yeldarb, Nimit here from Fullstack. Good idea! We did have the 2013 data
up last week before the 2014 bracket came out yesterday but will work on
adding more years and the comparison to how the previous brackets turned out!

~~~
hanley
Any idea if you'll have this functionality up before the bracket deadline
ends? I'd love to be able to build out some functions and test them on
previous years before the contest officially starts.

------
trg2
This is awesome! I went to UConn, so I'll obviously hard-code a UConn win
there. But I heard on NPR today that, historically, a 12 seed has a 50% chance
of upsetting a 5 seed in the first round. If I'm biasing towards the higher
seeds everywhere else, that means my code looks like this:

function (game, team1, team2) {

    
    
      var winner_team = "Connecticut";
      
      if (team1.name == winner_team) {
        team1.winsGame();
      } else if (team2.name == winner_team) {
        team2.winsGame();
      } else if (team1.seed > team2.seed) {
        team2.winsGame();
      } else if (team2.seed == "12") {
        team2.winsGame();
      } else {
        team1.winsGame();
      }
                
    }

~~~
selectout
WOuldn't this not take into account 12 seeds winning? Since you do team1.seed
> team2.seed before checking if team2.seed is 12.

Also, this would mean 12 seeds would go all the way anyway, you're not
limiting it to the first round only.

~~~
shazeline
Yeah, trg2 would need to put all the edge case rules towards the beginning.
That, or just put the basic rules at the beginning and have separate
conditionals at the end to handle the edge cases.

~~~
trg2
Good call - thanks for the CR! :)

------
mikeho1999
Awesome idea... one quick feature suggestion -- on the bracket, itself, it'd
might be nice to highlight any upsets (e.g. in bold and/or red or something
like that).

Typically, variance in brackets is based on the upsets picked... so by making
those more visible, it would make it easier for a human to more quickly digest
the content.

Just a thought. But regardless, _awesome_ idea. Well done!

------
atom-morgan
This is _really_ cool and it got even better when I found the documentation. I
was hoping there would be a way to access rounds and seeds to try and put some
more coding effort into a No.12 vs No.5 first round game.

------
mbesto
For the Data Scientists out there:
[http://fivethirtyeight.com/interactives/march-madness-
predic...](http://fivethirtyeight.com/interactives/march-madness-predictions/)

------
netcraft
> Coder's Bracket is the product of an internal open-source project at
> Fullstack Academy.

so, is there source available?

Regardless, very cool concept and execution.

~~~
dy
Hey netcraft - we built this really quickly so the source is a bit messy -
we'll work on open-sourcing it sometime in the near future though.

------
GBond
Really cool. A killer feature would be the ability to test against past years
tourney's actual results.

~~~
dy
We have the last few years of data but we don't have back-testing yet - great
idea though!

------
rrradical
This is a super neat idea. Thanks so much for making it!

Some small comments:

I found the tutorial video painfully slow, but maybe you're targeting
beginning programmers. All I was looking for was-- what's the language, what's
the api.

The determining function could easily be a pure function. I.e., it could
designate the winner by returning true, or false, or an enum/constant.

Actually, I think I would prefer this API:

function (team) { return team.off_reb * team.win_pct; }

And then play the teams by calculating the scores for each team and comparing
them. But then of course, you can't have different scores depending on the
opponent. I wouldn't use that information, but perhaps others would.

~~~
alxndr
re: your API comment: seems like putting extra functions into the outer
context breaks the parser, but putting them inside the main anonymous function
worked for me.

------
agentultra
Sorry if this sounds dumb... but what's a bracket?

~~~
cag_ii
[http://en.wikipedia.org/wiki/Bracket_(tournament)](http://en.wikipedia.org/wiki/Bracket_\(tournament\))

------
selectout
This is awesome. Where are the data sources coming from for this? For free
throw percentage, etc. I'm assuming this wasn't manually gathered as the teams
were just announced yesterday and it'd be a hassle to do it so quickly.

~~~
dy
We've scraped the data from various sources - when Selection Sunday was
announced we basically edited up a big JSON object to get it ready.

------
hoot80
I had this idea for multiple years and never finished the project. I started
it in Python, then 2 years later re-wrote it in Ruby. Since someone else
finally implemented it, you should name it after my project: March Nerdness :)

------
ncavig
Would also be cool to be able to include more detailed data. There's some
useful data points exposed at [http://madness.io](http://madness.io) including
Tempo-free stats and (not advertised) json endpoints,
[http://madness.io/teams/uaa.json](http://madness.io/teams/uaa.json)

Full disclosure: I released this site a few weeks ago, mostly as a side
project. I submitted to Show HN but it didn't get much traction. Might be of
use though.

~~~
mdotc
Nice site. I agree, I'd love to be able to use some of your data points in my
algorithm.

~~~
ncavig
There's a few exposed json endpoints for data, the matchup page, team page,
and player page.

eg team: [http://madness.io/teams/fak.json](http://madness.io/teams/fak.json)
eg player:
[http://madness.io/players/1772.json](http://madness.io/players/1772.json) eg
matchup:
[http://madness.io/matchup/dae/vs/oad/1395332100.json](http://madness.io/matchup/dae/vs/oad/1395332100.json)

~~~
mdotc
Is there any endpoint for teams.json or would I need to request each
individually? Even if it was just the season stats without the game stats it
would be useful.

~~~
ncavig
There is not one at this moment. It's quite an expensive request to serve
season stats for n teams.

~~~
mdotc
That's what I figured. Good stuff anyway.

~~~
ncavig
Send me an email through the site with your email, and I can give you a json
file of the stats. It just wouldn't be practical to keep it up as a reachable
endpoint - too costly

------
heynk
Hey Guys!

I just saw this today and got pretty interested. I was interested in
implementing a 'weighted' scoring function, but needed a way to save state
somehow. I ended up finding a pretty fun solution using the console. It's
really fun to play with the weights and see how the bracket changes!

[https://github.com/hstove/Coderbracket-Weighted-
Scorer](https://github.com/hstove/Coderbracket-Weighted-Scorer)

~~~
GBond
hold on.. there's a developer console somewhere in the webapp? I don't see it
and would love to use it. Am I missing something?

~~~
kylebrown
The browser console. (in chrome) View -> Developer -> Javascript Console. You
can enter commands there, run functions, access variables (in the page's
global scope), etc..

------
lukekarrys
This is really great!

I'd be very interested in the data and the code behind the generator function.
I'd love to integrate it with my bracket-generator module (which is very basic
and only does lower seed, higher seed, and random currently).

[https://github.com/tweetyourbracket/bracket-
generator](https://github.com/tweetyourbracket/bracket-generator)

------
wambotron
I'm not sure if the 'turnovers'/'turnovers_per_game' is a POSITIVE or a
NEGATIVE. Is it that they turn it over that many times? Or they take it away?

I'm assuming it's a negative and it really means that turnovers is how many
times they actually turn the ball over.

~~~
alxndr
In basketball a "turnover" is when your team gave up the ball when you didn't
have to, and thus is a negative.

------
wambotron
I think games against top 25 teams (and their win percentage of those games)
would be a good thing to add as well.

------
avelis
Just as naive but fun to look at:

function(game, team1, team2){

    
    
      if (team1.rpi > team2.rpi) {
        team2.winsGame();
      } else {
        team1.winsGame();
      }
    

}

I want to custom build from a known index via ESPN but don't if the team
objects hold all the stats necessary.

------
rschmitty
Using this for Buffet's Billion Dollar Bracket Challenge (because no one is
going to win that anyways!)

~~~
waterlesscloud
I went to enter my bracket on Yahoo, same as I've done for the last 15 years,
and it's demanding to "verify" a mobile number for me, and forcing me to agree
to accept marketing txts.

There's no way for me to "verify" a mobile number without agreeing to
marketing txts. There's no way for me to create a bracket without "verifying"
a mobile number.

Yeah, no.

And thus ends my 15 years of using the site for this, with an angry feeling on
my side. Well done, Yahoo.

~~~
surye
Use a throw-away GVoice account?

------
bergie3000
Very nice. I've run a marginally similar site for a few years that I had just
decided to sunset ([http://randombracket.com](http://randombracket.com)). Too
much work for about four days of usage :)

I'm glad I have your site to use now.

------
akerl_
Site seems dead for me. Anybody have a tl;dr or cached version?

~~~
dy
It's back - our servers got a bit overloaded due to the rush.

~~~
akerl_
Sweet! Thanks for the quick recovery

------
mmcclure
This is awesome! I took the time to create a pretty in-depth function only to
find out you apparently can't do that :(

~~~
nimz
Hey mmcclure - sorry about that. We don't have any check's against in-depth
functions ;) so maybe there's a bug on our side. Can you send me your function
at nimit@fullstackacademy.com and I'll get back to you about what may have
gone wrong!

------
lukencode
This is pretty awesome. Would be rad to have something similar for the world
cup for us non us sports loving coders.

------
debaserab2
This is awesome! Is there a way to go full screen on the editor? I couldn't
seem to find one.

~~~
dy
Hi debaserab2 - you can Expand Editor under Help right now, but we don't have
full-screen editor. Great idea though!

------
elwell
Video audio keep play when pressing Next during video play. Windows/Chrome.

------
yeison
Any functionality to create a pool? That would be great.

~~~
dy
Hey - we have Bracket Pools in the nav bar - that should let you invite
friends and have them put their brackets against yours.

------
dy
And we're back - sorry overloaded our servers!

------
kimhowardj
I'm liking the voice of that tutorial video.

------
apawloski
This is so cool! What are you using for data?

------
dangeruss
Very cool idea.

