Sunday, December 28, 2008

The Rules of Basketball as Explained by a Computer Scientist

Let player1, player2, player3, player4, player5 be contained in team1.
Let player6, player7, player8, player9, player10 be contained in team2.
Also let 1bench1, 1bench2, etc. be benched players on team1 and 2bench1, 2bench2, etc. be benched players on team2.
If possession > 0, team1 has possession.  If possession < 0, team2 has possession.

Jump ball:
Possession = 0.
If maxheight (player1, player2, player3, player4, player5) > maxheight (player6, player7, player8, player9, player10) then possession = 1.
Else, possession = -1.
Let degree of unfairness = |maxheight (team1) - maxheight (team2)|

Travelling:
Stepcount = 0.
If playerx takes a step, stepcount = stepcount + 1.
If playerx dribbles, stepcount = 0.
If stepcount >= 2.5, print "Travelling."
Possession = -possession.
Playerx = embarrassed.

Personal Foul - Playerx fouls playery:
Freethrowcount = 0.
If playery is dribbling, freethrowcount = 0, possession = possession.
Playerxfoulcount = playerxfoulcount + 1, teamfoulcount = teamfoulcount +1.
If teamfoulcount >= 7, freethrowcount = 1.  If teamfoulcount >= 10, freethrowcount = 2.
If playery is shooting and if (playery - hoop) > 22 feet, freethrowcount = 3.
Else if playery is shooting, freethrowcount = 2.
Possession = -possession.
If playerxfoulcount = 6, substitution(playerx) and playerx = embarrassed.

Technical foul:
If playerx, coach1, or coach2 is pissed, print "Technical foul."
Technicalfoulcount = technicalfoulcount + 1, teamfoulcount = teamfoulcount + 1.
If ran(1, 2) = 1, player or coach takes physical action, referee = injuredreferee.
If ran(1, 2) = 2, player or coach spits, court = gross.
Other team's freethrowcount = 2.
If technicalfoulcount = 2, playerx or coach1 or coach2 is ejected.
Playerx, coach1, or coach2 = super pissed and embarrassed.

Betting:
Better1 bets $ on team1.
If team1 > team2, better1 = better1 + (R * $) where R = odds.
If team2 > team1, better1 = better1 - $, better1 = screwed, better1's wife will get upset like she does every time I do anything remotely wrong, even if it's not that bad, just friendly betting with guys from the office.
Better1bed = livingroomcouch.

4 comments:

  1. You never defined the playerfoulcount and teamfoulcount.. this program is terrible ;)

    GO KANSAS, even though you're not that good this year.

    ReplyDelete
  2. Hey Sam, thanks for the correction. Are you ready to get beaten in March? The number 1 rule of our pool remains: everybody must beat eric.

    ReplyDelete
  3. administrator, please remove the above comment as spam.

    go, BC! i'll never pick you past the second round but i will root for you when it is convenient to do so!

    ReplyDelete