Page 3 of 4 FirstFirst 1234 LastLast
Results 41 to 60 of 66

Thread: MafiaBot Github

  1. #41
    Holy Shit
    Join Date
    Dec 2011
    Location
    Maryland
    Posts
    5,659
    Steam ID
    roragok
    If this is being used I wouldn't mind extending it to push to save results on the site I made a year or two ago drunk.
    Quote Originally Posted by bdiz View Post
    Roragok owns end of story also grant is soft

  2. #42
    Beyond Grantlike ironstove.'s Avatar
    Join Date
    Feb 2012
    Location
    Los Angeles
    Posts
    8,556
    Steam ID
    ironstove_
    Few thoughts regarding that:

    1. Crazy thought: If it's running on a webserver which you have backend access to, the bot 'MIGHT' be able to run independently on your webserver and modify the local files.

    Ofc, you can set permissions for the bot itself so it's sandboxed and can't modify other things on the WS. I'm not sure how well selenium plays without a UI, or if it's even capable of having this functionality.

    One of the big problems with selenium is that it is a test platform, so it's mimics actual browser actions like mouse scroll, clicks, and keypresses. I don't know if this is something that can be sent virtually without the actual browser/UI.

    This is where it would have been better do this bot in scrapy, but scrapy takes way more work to setup and I figured a project this small didn't warrant that much work. I originally envisioned and still view this bot as a standalone script that people can come in and download/run on their own machine by opening a single file.

    2. Yes, the bot 'can' push the data by running through a user/pass you setup for it and it can drop the results into a format you like, it should be pretty straightforward to add in that method, OR you can create a form for the bot to submit to which dynamically updates the website without manual work being necessary. I can work w/ you on building the form submissions in javascript if you're not familiar with how to do it already.

    3. Bot would only be adding in stats for games it was a part of. It's not designed to handle games which it wasn't counting in because they were not hosted by me, and those hosts did not follow the bot commands/conventions so it has no clue how to interpret the information. What I'm getting at is even if #1 or #2 are done, there is still going to be a lot of missing information which would need to be parsed through manually.
    YOU SO
    FUCKIN'
    PRECIOUS
    WHEN YOU

  3. #43
    Holy Shit
    Join Date
    Dec 2011
    Location
    Maryland
    Posts
    5,659
    Steam ID
    roragok
    My initial thought was 2 the second half. Expose a wsdl push results to like a roragok.com/results.wsdl at the end or something.

    I could also run it from the server its got plenty of space/memory if it wants to be a constant thing
    Quote Originally Posted by bdiz View Post
    Roragok owns end of story also grant is soft

  4. #44
    Beyond Grantlike ironstove.'s Avatar
    Join Date
    Feb 2012
    Location
    Los Angeles
    Posts
    8,556
    Steam ID
    ironstove_
    Yea, that sounds fine. I'm willing to do that. LMK what you need from me to get it going.

    @divine, I finished reading up about FSM, I took classes like this in the past for college when I was programming PLCs for my electronics classes, but I'm not sure about how to implement FSM on this.

    I mean that in the sense that I feel there are a lot of different states so I figure a lot of different transitions would have to be written.
    YOU SO
    FUCKIN'
    PRECIOUS
    WHEN YOU

  5. #45
    Holy Shit
    Join Date
    Dec 2011
    Location
    Maryland
    Posts
    5,659
    Steam ID
    roragok
    We could run it from the same server and expose a url like /gamestart

    Someone enters the url of the thread and it validates the url and its done that way so people don't have to do things.

    For datawise the games are basically in this format right now.

    Title - Thread title
    Game URL - link to thread
    Moderator - name of host - optional
    Type - Format of game Open/Closed/Semi-Open
    Theme - (Medical Mafia, Nightless, Draft, Donner Party, etc) optional
    Size - #of players small, medium, large - small <10. medium 10-13. large 14+. I can calculate this based on signed players but don't currently.
    Roles - list of roles in game(goon,doctor,roleblocker,etc.) - optional
    Town - array of town players names
    Mafia A - array of mafia players names
    Mafia B - array of mafia players names - optional
    Third - array of third party players names- optional

    Day Actions - name of plaayer lynched day1 -optional
    Night Actions - array of players killed night 1 - optional

    Result - town/mafia/third
    Winning Team - town/Mafia A/Mafia B/Third
    Quote Originally Posted by bdiz View Post
    Roragok owns end of story also grant is soft

  6. #46
    Holy Shit
    Join Date
    Dec 2011
    Location
    Maryland
    Posts
    5,659
    Steam ID
    roragok
    Something i did real rough a year or so ago, probably could use to be updated. The biggest problem I need to probably work on is my player object doesn't really store aka's or alias' so since players frequently change names it would be a new player. I probably need to add a player alias field to the players in the future if this comes to fruition.
    Quote Originally Posted by bdiz View Post
    Roragok owns end of story also grant is soft

  7. #47
    Beyond Grantlike ironstove.'s Avatar
    Join Date
    Feb 2012
    Location
    Los Angeles
    Posts
    8,556
    Steam ID
    ironstove_
    So restructuring the bot is taking quite longer than I expected, I knew it was going to take work, but lol taking spaghetti code and making it organized is a very slow process... basically untangling a really convoluted knot. But this is a good learning experience. I will probably try to write my code in a more organized fashion in the future after I have completed this.
    YOU SO
    FUCKIN'
    PRECIOUS
    WHEN YOU

  8. #48
    Holy Shit yns's Avatar
    Join Date
    Jun 2017
    Posts
    6,030
    Refactoring code is fucking awful

  9. #49
    Holy Shit yns's Avatar
    Join Date
    Jun 2017
    Posts
    6,030
    Just finished refactoring 30k lines of JavaScript that was split between a single public and a single server file. I was ready to die the entire time

  10. #50
    Beyond Grantlike ironstove.'s Avatar
    Join Date
    Feb 2012
    Location
    Los Angeles
    Posts
    8,556
    Steam ID
    ironstove_
    This whole bot is about 500 lines and it's pretty tedious repackaging everything, I'm not sure how it's humanly possible to do 30k unless there is a lot of repetition, even so that's still a lot to have to parse through.
    YOU SO
    FUCKIN'
    PRECIOUS
    WHEN YOU

  11. #51
    Beyond Grantlike ironstove.'s Avatar
    Join Date
    Feb 2012
    Location
    Los Angeles
    Posts
    8,556
    Steam ID
    ironstove_
    Well, it's about 500 right now without the ISO or record stats functionality added in, a few more bells and whistles I plan to finish before I release the changes.
    YOU SO
    FUCKIN'
    PRECIOUS
    WHEN YOU

  12. #52
    Beyond Grantlike ironstove.'s Avatar
    Join Date
    Feb 2012
    Location
    Los Angeles
    Posts
    8,556
    Steam ID
    ironstove_
    Tries to create multiple constructors for my class, and got errors, which led me to reading:
    https://stackoverflow.com/questions/...google_rich_qa

    Then I had to read up on the '@' because I've never seen that used before.

    https://stackoverflow.com/questions/...google_rich_qa

    TIL, this shit is a clusterfuck.
    YOU SO
    FUCKIN'
    PRECIOUS
    WHEN YOU

  13. #53
    Wicked Sick Nmagane's Avatar
    Join Date
    Feb 2018
    Posts
    1,313
    Python has constructors? You should've used C++.
    “A man of genius makes no mistakes. His errors are volitional and are the portals of discovery.”

    “Her antiquity in preceding and surviving succeeding tellurian generations: her nocturnal predominance: her satellitic dependence: her luminary reflection: her constancy under all her phases, rising and setting by her appointed times, waxing and waning: the forced invariability of her aspect"

  14. #54
    Beyond Grantlike ironstove.'s Avatar
    Join Date
    Feb 2012
    Location
    Los Angeles
    Posts
    8,556
    Steam ID
    ironstove_
    Quote Originally Posted by Nmagane View Post
    Python has constructors? You should've used C++.
    ... What?
    YOU SO
    FUCKIN'
    PRECIOUS
    WHEN YOU

  15. #55
    Holy Shit yns's Avatar
    Join Date
    Jun 2017
    Posts
    6,030
    Quote Originally Posted by ironstove. View Post
    This whole bot is about 500 lines and it's pretty tedious repackaging everything, I'm not sure how it's humanly possible to do 30k unless there is a lot of repetition, even so that's still a lot to have to parse through.
    Yeah, it took about a month. Once I decided what would go into each directive, it wasn't too bad

  16. #56
    Beyond Grantlike ironstove.'s Avatar
    Join Date
    Feb 2012
    Location
    Los Angeles
    Posts
    8,556
    Steam ID
    ironstove_
    So ISO feature is still in the works once I have finished the restructure, so far my idea for implementing it is something like:

    Store all posts in a local file with each player defined as a section, each section holding the posts of said player.

    Normally, I would have created the player objects and stored the posts within those objects and iterated through, but the bot doesn't have memory storage outside of the local file it writes to and using player objects would mean the bot needs to traverse the entire thread everytime it is booted up. Seems kind of inefficient so I'm going the local storage route.

    When a player calls for an ISO, each record is placed into a quotebox and the quotes are contained within a spoiler tag and then posted. This step is going to be tricky for me, because selenium has a character limit for the send-keys command to post. I'm going to do a little bit of research to see if there is a workaround, but doing stuff like posting the vote counts and lynch at the moment requires me to break up the post into 5+ different calls to the send-keys command, which is pretty large for such a small amount of text.
    YOU SO
    FUCKIN'
    PRECIOUS
    WHEN YOU

  17. #57
    Check out data persistence packages and just get to the point where your scraper saves everything I think.

  18. #58
    Beyond Grantlike ironstove.'s Avatar
    Join Date
    Feb 2012
    Location
    Los Angeles
    Posts
    8,556
    Steam ID
    ironstove_
    Quote Originally Posted by xjohnxjacobxjingleheimerx View Post
    Check out data persistence packages and just get to the point where your scraper saves everything I think.
    Yea, I just read up on the pickle mod and looked through examples. I don't think pickle really gives any sort of advantage to what I was planning to do using the config module in python, but I'll prob give it a try anyway just to see how I like it.

    Pickle mod will still write the byte translation of the object into a file to be brought back online later, so more or less what the config method was doing, only that the config method is a little less efficient because it's still storing the data in utf-8 rather than bytes so reading/writing is slower but because the data size is so small i.e. 1 mafia thread rather than like a data set of millions of threads, you're really not going to notice any type of performance difference between the two.
    YOU SO
    FUCKIN'
    PRECIOUS
    WHEN YOU

  19. #59
    Beyond Grantlike ironstove.'s Avatar
    Join Date
    Feb 2012
    Location
    Los Angeles
    Posts
    8,556
    Steam ID
    ironstove_
    Yes, sendKeys is slow, because it types the text key-by-key. If you want to paste a
    long sting you can do the following trick:

    setClipboardContents(longString);
    driver.get("http://jsonviewer.stack.hu/");
    WebElement element = driver.findElement(By.name("edit"));
    element.click();
    element.sendKeys(Keys.CONTROL + "v");

    How to set clipboard contents depends on the language you use to write your tests.
    For example, Java code is:

    public static void setClipboardContents(String text) {
    StringSelection stringSelection = new StringSelection( text );
    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    clipboard.setContents(stringSelection, null);
    }

    If you write in C# you can use this class:
    http://msdn.microsoft.com/en-us/libr...clipboard.aspx
    http://msdn.microsoft.com/en-us/library/637ys738.aspx

    Please let us know if it helps.
    Placing this here for my own reference for later.
    YOU SO
    FUCKIN'
    PRECIOUS
    WHEN YOU

  20. #60
    Unstoppable notjones's Avatar
    Join Date
    Feb 2018
    Posts
    947
    Steam ID
    notjones
    DAE put their code's

    TODO:
    XXX:

    and helpful comments in random nadota threads

    If you think about it, the internet archive is version control.

Page 3 of 4 FirstFirst 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •