levitate
I love you, you know.
Why is CAD software so damn expensive?
These SolidWorks prices are insane.
These SolidWorks prices are insane.
Why is CAD software so damn expensive?
These SolidWorks prices are insane.
So I have always been really into sports betting and have followed this guys model for a while.
I decided to write a program that would grab his data, grab the vegas line, compare the two and point out the largest discrepancies between the two.
I originally had it as just a command line tool where you would enter a url and it would output your info but I decided to build it out into a full web app.
Here is the command line version
Here is the webapp version
I am about to upload it to heroku
Here is the main code that parses the ratings and returns the results
class Games::Import < Less::Interaction
expects :url
expects :sport
# Massey Ratings
# Games::Import.run(url: 'Massey Ratings', sport: 'ncaa_football' )
def run
html = get_massey_html
fetch_and_save_team_data(html)
end
private
def save_game(game_hash)
unless Game.where(home_team_name: game_hash[:home_team_name], away_team_name: game_hash["away_team_name"]).present?
Game.create!(game_hash)
end
end
def get_massey_html
browser = Watir::Browser.new :phantomjs
browser.goto url
browser.button(id: 'showVegas').click
doc = Nokogiri::HTML(browser.html)
browser.close
doc.css('.bodyrow')
end
def fetch_and_save_team_data(html)
html.each do |row|
unless invalid_data(row)
game_hash = set_game_hash(row)
save_game(game_hash)
end
end
end
def invalid_data(row)
if row.css('.fscore')[1].children.first.text == "---"
true
elsif row.css('.fscore')[1].children.last.text == "---"
true
elsif row.css('.fscore').last.children.first.text == "---"
true
else
false
end
end
def set_game_hash(row)
{
home_team_massey_line: get_home_team_massey_line(row),
away_team_massey_line: -get_home_team_massey_line(row),
away_team_name: row.css('.fteam').first.css('a').first.children.text,
home_team_name: row.css('.fteam').first.css('a').last.children.text,
home_team_vegas_line: get_home_team_vegas_line(row),
away_team_vegas_line: -get_home_team_vegas_line(row),
vegas_over_under: row.css('.fscore').last.children.first.text.to_f,
massey_over_under: row.css('.fscore').last.children.last.text.to_f,
date: format_date(row),
sport: sport,
line_diff: (get_home_team_massey_line(row) - get_home_team_vegas_line(row)).abs,
over_under_diff: (row.css('.fscore').last.children.first.text.to_f - row.css('.fscore').last.children.last.text.to_f).abs,
team_to_bet: find_team_to_bet(row),
over_under_pick: pick_over_under(row)
}
end
def pick_over_under(row)
if row.css('.fscore').last.children.last.text.to_f - row.css('.fscore').last.children.first.text.to_f > 0
"Over"
else
"Under"
end
end
def find_team_to_bet(row)
if get_home_team_massey_line(row) - get_home_team_vegas_line(row) > 0
row.css('.fteam').first.css('a').first.children.text
else
row.css('.fteam').first.css('a').last.children.text
end
end
def format_date(row)
Date.parse(row.css('.fdate').first.children.first.children.first.text)
end
def get_home_team_massey_line(row)
game_array = row.css('.fscore')[1].children.to_a
return -1 * game_array.first.text.to_f if game_array.first.attributes["class"].value == 'ltgreen'
return game_array.last.text.to_f if game_array.last.attributes["class"].value == ' ltgreen'
end
def get_home_team_vegas_line(row)
game_array = row.css('.fscore')[1].children.to_a
return -1 * game_array.first.text.to_f if game_array.first.attributes["class"].value == 'ltred'
return game_array.last.text.to_f if game_array.last.attributes["class"].value == 'ltred'
end
def game_params(game_data)
{
sport: sport,
home_team_name: game_data[:home_team_ame],
away_team_name: game_data[:away_team_name],
home_team_massey_line: game_data[:homw_team_massey_line],
away_team_massey_line: game_data[:away_team_massey_line],
home_team_vegas_line: game_data[:home_team_vegas_line],
away_team_vegas_line: game_data[:away_team_vegas_line],
vegas_over_under: game_data[:vegas_over_under],
massey_over_under: game_data[:massey_over_under],
line_diff: (game_data[:home_team_massey_line] - game_data[:home_team_vegas_line]).abs,
date: game_data[:date]
}
end
end
As the season goes on I am going to track the results and see how it performs.
It is always good to combine coding with something you are interested in. It's good practice and you get to learn new shyt.
So I see nobody's stepped up to the plate to organize that open source video game venture we said we were going to do - should I start PMing ppl and setting things up?
I'm still up for it. I actually have more free time now since I dropped my art class( straight boring ).
I think the problem is, people want to use different languages( which is understandable ).
If we are using Unity we are pretty muched locked in to C# (and Python I think) though. It's not really going to work out if everyone is out doing their own thing in whatever language they like.
Cool. I was thinking about doing a First person shooter now. I feel it's better to start from scratch than use one of Unity Assets.
If everybody is cool with that, I have a good tutorial from Unity website( very basic ) I can post later.
yea a lot of ppl underestimate how long good games can take to create, especially if it's just a side thing and you are not dedicating a huge amount of time to it. another good example is the dude who created Axiom Verge (Axiom Verge on Steam). took him 5 years. but the most impressive thing to me is he created the sprites, music, programmed everything, did it all. i can code but on the artistic side i'm not so skilled so it's always been an issue anytime i've started on a project.
Yeah my fault. I want to setup the base code for 3 projects (beginner, intermediate, advanced) before I make the thread and....I just made a free github account.....like seconds ago. There might be limitations on what I can do with it but I'll stick with it I guess.
Also my initiative isn't just about 'video games'. It could be about anything. A video game is a bit more complex and would involve music composers, concept artists, 3d artists, writers, etc. Though I somehow got the feeling that the coli has all of these people here. Would be cool if we can draw in non-programmers into this.
Yeah......am I the only c++ guy here? I get the impression that c++ is a relic and a thing of the past. I see lots of people fukking with c# and python mainly.
I think what will happen is that everyone will post their own project. The most interesting projects will probably have the most contribution (people don't want to work on boring things). I'd imagine a 2D side scrolling beat 'em up in c# would get more people interested than say a word processor or an mp3 player.
A FPS would be cool. Personally I plan on starting with a simpler game project like a pong, a breakout clone, a space shooter, or maybe a puzzle game.
I used to be somewhat competent with 3ds max and photoshop years ago until I lost motivation. I follow lynda.com tutorials. Very good site.
absolutely. Might as well throw MongoDB in there as well and get rolling with the whole MEAN stack.Something I've found as a programmer is that you just have to pick a few core technologies and roll with it. I've been spreading myself around by trying to learn too many different technologies and it becomes hard to grasp what's going on at a deeper level with any one technology because of it. For example, in the Javascript front-end world, there are 10,000 different libraries or frameworks you could dabble with. It's simply impossible to know them all. You simply have to pick one and roll with it. For me, that's angular 2. In terms of back-end, I'll probably start focusing on Node.js. Ruby on rails is nice, but it's easier to integrate Angular 2 and other JS libraries/frameworks with node.
A FPS would be cool. Personally I plan on starting with a simpler game project like a pong, a breakout clone, a space shooter, or maybe a puzzle game.
Yeah......am I the only c++ guy here? I get the impression that c++ is a relic and a thing of the past. I see lots of people fukking with c# and python mainly.
absolutely. Might as well throw MongoDB in there as well and get rolling with the whole MEAN stack.
Great post. Spoken like a true architect or VP of engineering.Before comitting to MongoDB I'd suggest to everyone that they research the relative advantages NoSQL databases have over RDBMs. Thing with MongoDB is that it's good when relationships between entities are not so clear cut (let's say you are just starting out and still not sure how your data will be structured). However, it doesn't scale as well when everything is clear cut AND you need the relations to be robust. For large sites with lots of traffic, MongoDB could end up fukking you over big time. If you are just whipping up a quick web app MEAN stack is alright, but if you want to scale you will probably be forced to use a relational database and a classical object oriented statically typed language in the backend like Java or C#. There's a reason why these two languages are popular at banks and really large corporations rather than Python and Javascript.
Basically my point is before committing to a whole technology stack it would be wise to evaluate its merits (compared to what other technologies are doing) and make your decision accordingly. Don't just learn what's being hyped just because .... you will end up wasting a lot of your time. The software / web world is in turmoil where a lot of the new devs are basically repeating the mistakes of the past and every couple of years people are re-writing entire web apps just cause a new thing has come on the scene.