Last week, I gave an overview of PGA Tour’s ShotTrack and how they used it to measure the Strokes Gained metric. Now, we’re going to use course and individual player data to try to estimate a player’s chance of winning a tournament given their skill and position.

Example

Artists use real life happenings to inspire their works. I can’t think of a higher art form than a Medium article about simulating golf tournaments in JavaScript, so I’ll do the same: I’ll take the tournament currently underway, The American Express (wonder who’s sponsoring?) and calculate each player’s chance of winning. …


Image for post
Image for post
The Stats homepage for PGATour.com

Write about what you love. Writing can be a painful, laborious exercise, so if I were to attempt to prattle on for 1000 or so words about, say, fashion, or Hallmark Christmas Specials (I refuse to call them ‘films’), or the finer points of wall painting… I’d probably fall asleep midway through the first paragraph and thus not have any articles to publish. Thus, for my weekly Medium articles, I’ve tried to write about my hobbies and interest, as peculiar as some of them may be: Tetris, Scrabble, NFL… and now, golf! Is golf a sport, or a game? The philosophical debate rages on, but I definitely put it in the “sport” camp. The main acts of the game involve rapid physical movements, where strength and flexibility are assets. Plus, you move around a lot! 18 holes equals about 8 miles of walking, assuming you don’t use a cart. By sheer distance traveled on foot, golfers make other athletes look like indolent sloths. Soccer players and long-distance runners excepted, of course. I love golf, even though I seem to play it less and less, and coincidentally, I get worse and worse… which makes me less and less apt to play it… what a lovely cycle! …


Image for post
Image for post
Shoutout to Wikipedia for all the detailed accounts of the early days of computing

So far, almost all the code featured in my weekly Medium articles has been written in JavaScript. There are several reasons for this- JavaScript was the main language used for functional programming in my bootcamp, so I became well-acquainted with it on a daily basis. Another reason, just as important, is that Google’s DevTools make it very easy to run JavaScript code in the browser. I frequently create functions and variables and test out my code before pasting the snippets in my articles.

Yet another reason is that, frankly, JavaScript is a pretty darn simple language to use. It’s probably the simplest OOP language out there. The commands are self-descriptive. It’s very easy to handle data, as you don’t have to declare the data types of variables (unlike C, C++ and others), and you can easily manipulate arrays and objects without having to invoke dreaded (for non-CS major schlubs like me, at least) pointers. That makes it an ideal language for coding bootcamps; someone with no knowledge of coding can, after a few hours of tutorials, write functions with loops, conditional statements, maps… that actually do things! …


Image for post
Image for post
A screenshot of FiveThirtyEight’s NFL game predictions page

I am, almost against my will, a big NFL fan. I vow to myself at the start of each year that my Sunday ritual of watching football from noon to 10:30 pm will be a thing of the past, that I’ll spend that time reading, or writing, or composing an epic poem in iambic pentameter, or developing the next revolutionary app… alas, I’m in the middle of my 17th straight NFL-saturated Sunday. Only 2 more hours to go this season… and then four more weeks of playoffs! Oy vey. Hey, what can I say? American football players are the best athletes in the world, and it’s a stimulating, strategical, exhilarating game. …


The other day, I wrote a few functions to handle the word search functions of a Scrabble rack: given seven letters and a dictionary of valid words, said functions collect all combinations of letters (2–7 letters) that form valid words. However, there is a lot more to Scrabble than just this: you need 100 tiles, a board, two players… the ability to lay tiles on the board, check whether the word/s formed is/are valid and then calculate the total score of your play… and all this has to look good enough for people to want to play it! Ahh, the joys of game design… gamers are tremendously loyal to games they love, but it’s the job of the programmer to gain their love in the first place. That is no easy task! …


Image for post
Image for post

Scrabble is, without a doubt, my all-time favorite board game. For me, it goes beyond mere fun and games; I’m actually, believe it or not, a competitive player! Yes, I’ve played in tournaments… and I’ve even won a few of them! Technically, that makes me a professional Scrabble player. Damn right I’m proud! It’s a great little factoid to bring up during interviews, parties and especially dates. Trust me, the ladies love a man who knows his way around a Scrabble board… (jk-lol-rofl-lmao). Jokes aside, it’s not just a dopey family board game to be pulled out on Thanksgiving and Christmas- though it’s certainly a great way to spend a few hours on a holiday. …


Image for post
Image for post
Definitely a real game… I’m sure all those flushes & runs are just an amazing coincidence!

Cribbage is the most popular card game among my family members- it’s pretty much the only game we play with any regularity these days, and we’ve spent countless hours facing off on planes, trains, automobiles and the kitchen table. “We” refers primarily to my parents and I; my sister plays a handful of times a year and thus needs to be refreshed of the rules nearly every time- she’s a quick learner, so after 2 or 3 hands she picks it back up again, and after a game or two vows to play more frequently in the future so as to etch the rules permanently in her brain… alas, like Drew Barrymore in 50 First Dates, the cycle repeats itself each time. I can see it in my mind: “50 First Games of Cribbage: The Madeline Overby Chronicles”. …


Last week, I did a very simple implementation of Tetris that caused Xs and Os to appear on the screen, with basic logic to handle rotations, checking the validity of moves (e.g. whether a piece can go down or be moved left or right) completion of rows, updating score and determining when a game is over. Now, we’re going to give this program a makeover. The underlying logic will be the same, but the presentation will be in… React!

Creating a React App

There are several ways to launch a React App, but the easiest path is to run the following lines of code:

npx create-react-app my-app
cd my-app
npm…

I grew up in a video-game-deprived household. I received my first console until I was nearly 16 years old: a joint Christmas gift to my sister and me of… a Nintendo Wii. *sobs* Hey, what can I say? You can keep your fancy graphics and story lines; Wii Golf is as good as it gets! As a result of my minimal exposure to video games, I’ve never spent much time on them, and the few games that have caught my attention are simple, lo-fi affairs: Wii Golf, Wii Tennis, Pokemon (Generations 1–3), 2048… and lately, Tetris! This Soviet classic, developed by Alexey Pajitnov in 1984, has been surpassed in plot, graphics over the past 36 years but still lives on. I have frittered away shameful amounts of free time at FreeTetris.org over the past month or so. My recent forays into football and baseball simulations made me think: how would I go about implementing this simple little game? What sort of unexpected complexities and edge cases does it contain? …


Two weeks ago, I did a little bit of web scraping, getting data from a simple table. Last week, I created a baseball simulator in JavaScript. This week, I’m combining the two: scraping data from a baseball stats site, then building a simulator… but this time, both in Python!

Scraping The Data

Whereas in JavaScript we used the request().then().then() …

Jack Overby

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store