Play
Multi-Player
Coins
Community
Settings
Help
Community   Maps   Forum   Mail   Ladders   Clans   Recent Games
Sign In | Sign Up
<< Back to General Forum   

Posts 1 - 10 of 10   
Hey Optimum (Or any interested programmer)!: 1/23/2016 01:40:04


[FCC] Aura Guardian
Level 59
Report
Is it possible for you guys to make a formal program of this?:

https://www.warlight.net/Forum/121024-warlight-stock-market

Its a really cool idea that was not in the most nurturing place, the forums. However, if there was a actually a program run this, I think it would be really cool, more people would participate (including myself), and it would fair much better.
Hey Optimum (Or any interested programmer)!: 1/23/2016 01:46:52


Fleecemaster 
Level 59
Report
It should be relatively trivial, and knyte probably already has something running that will cover it, if he's too busy I can throw something together for you maybe though?
Hey Optimum (Or any interested programmer)!: 1/23/2016 01:59:45


(((Tabby Juggernaut)))
Level 50
Report
Rules need to be changed otherwise it will be chaotic. You can not be allowed to invest in yourself/alts, etc.

For example if A can defeat B and has met B in a 1v1 ladder game, then A buys B stock, intentionally loses to B and sells B stock. Or A knows that B will lose and hence buys his own stock during the game and sell it afterwards and then by B stock for it is lower now.

Edited 1/23/2016 02:00:04
Hey Optimum (Or any interested programmer)!: 1/23/2016 02:30:35


[FCC] Aura Guardian
Level 59
Report
Good point. From my vague programming knowledge (I did a little c++), I know that is a fairly simple thing to do as well...
Hey Optimum (Or any interested programmer)!: 1/23/2016 03:07:57


knyte 
Level 58
Report
Yep! I might not have time to work on this anytime soon (between school, projects, and work, my hands are understandably tied), but all you need to do if you're cool with using Python and Google App Engine here:

- set up a Google Developer Account
- create an app on the Google Developer Console
- add the Drive API
- create a Google Service Account (make sure you get the credentials)
- pick up gspread (github.com/burnash/gspread); the gspread tutorial actually covers these first five steps in a bit more detail
- build a use-case-specific wrapper library on top of gspread to make your life easier here
- create a program/script using that library that lets you read some formatted data and adjust people's stock predictions
- on the Google Sheets end, you can actually pull ladder rating/ranking data using IMPORTXML (if you can't figure out how to get the data from tags, just set your XPath to root and use string processing to extract the data; the simplest solution actually would use both)
- so really you just need to set up some simple commands (like what IPL does) for people to handle their investments via a forum thread
- using BeautifulSoup + requests (both Python libraries), scan threads from a set point onward (updating the set point once you're done with the scan) and update the Sheet using the commands you find
- you probably want to track the thread + the last point from a Sheet in the spreadsheet document, but you could also use GAE's NDB Model to store this data (be wary, though, there's a quota and you might actually hit it if you do something wrong or just scale really hard)
- finally, host it on Google App Engine; you really just need some CRON stuff and the Python you ran locally since you aren't storing any data in the program itself

I can be a little bit helpful if you plan on attempting this, but- fair warning- I won't be of much use if you're the type of person who needs their code spoon-fed to them.

Good luck! (And yes, there are better approaches to this than what I described, but I think it's one of the more beginner-friendly/accessible ones since you can do most of the work through Google Sheets commands).

You can also do all of this on Google Sheets (since it's technically Turing complete and easily capable of interacting with stuff like what we have here) but odds are it's going to get a bit messy.

Main libraries you'll use w/ Python here:

- gspread
- requests
- BeautifulSoup
- oauth2client

Just try and familiarize yourself with Python first. Then requests (you really just need GET here) and BeautifulSoup (no need to bring in Scrapy). Then Google App Engine (or another cloud platform- if you already know how to work with AWS, DigitalOcean, linode, etc., + have the credit or money- there's probably no need to learn GAE). Then pick up gspread.

This project is basically pretty trivial, but like with anything else, you have to actually be motivated to pull it off.

Edited 1/23/2016 03:14:13
Hey Optimum (Or any interested programmer)!: 1/23/2016 04:10:13


[FCC] Aura Guardian
Level 59
Report
Problem is, I don't know crap about python.
Hey Optimum (Or any interested programmer)!: 1/23/2016 04:14:58


knyte 
Level 58
Report
What languages are you familiar with? If you're familiar with networking in C/C++, you should be able to do this as well (although I bet you're going to have more fun with bugs).

Python is also very easy to learn if you're coming from a C/C++ background. The only "new" concepts it forcibly introduces are fairly easy to figure out- ducktyping isn't that complicated, and you should be fairly familiar with the OOP paradigm if you've done C++ (if not, you don't even really have to use it- although I'd recommend it to make your life easier even though it's not that good of a paradigm).

You can get the basic materials for working with Python from MIT OCW (their intro CS course is in Python) or CMU's 15-112 (which posts nearly all of its materials online under the "Schedule" link on the site page). Basically, pick between one of the #1 CS programs to get content from. Python is one of the best documented languages out there since so many beginners pick it up and end up asking questions on StackOverflow.

This is also very doable through virtually any other major language- Java, Ruby, Go, you name it . It just needs to have some string processing capability and to be able to handle OAuth2 credentials + send HTTP requests (ofc basically any language can do this, but you can't do it painlessly in x86 assembly).

Edited 1/23/2016 04:20:18
Hey Optimum (Or any interested programmer)!: 1/23/2016 04:22:03

Mike
Level 57
Report
Very interesting.

Is that creating an app on Gplay at the end or not at all ?

And what are the costs involved in your process ?
Hey Optimum (Or any interested programmer)!: 1/23/2016 04:28:45


knyte 
Level 58
Report
Nope; you aren't publishing this to the Google Play Store (or any other Google Store, to my knowledge) although you could create a mobile app or Chrome extension that extends this.

Really, the user interfaces would be Google Sheets Permissions/Sharing (for anyone who wants to use your bot- they'd have to give edit access to the bot) and a Warlight forum thread, so you don't have to worry about any of it.

The costs should be $0- you can use Google App Engine on free mode (and, unlike AWS, it doesn't charge you but instead caps you if you exceed quota) and bypass the read/write/store quotas since you won't be storing any data on the application/server itself but instead using Google Sheets to do so (which is free + has a fairly high data cap that you're probably never going to have to worry about; in the worst-case scenario I can think of, it's a problem for the owner of the spreadsheet and not you, since the spreadsheet data is counted against their quota and not yours).

Like I said, all you really need here are some fingers, a relatively functional brain, and just a little bit of motivation. :)
Hey Optimum (Or any interested programmer)!: 1/23/2016 07:05:49


Fleecemaster 
Level 59
Report
Maybe Mike is suggesting paying you ;)
Posts 1 - 10 of 10   

Contact | About WarLight | Play Risk Online | Multiplayer Strategy Game | Challenge Friends, Win Money | Skill Game | Terms of Service