• Breaking News

    Sunday, May 6, 2018

    I need help building a rudimentary Poker AI for a game I've just finished Ask Programming

    I need help building a rudimentary Poker AI for a game I've just finished Ask Programming


    I need help building a rudimentary Poker AI for a game I've just finished

    Posted: 06 May 2018 01:57 PM PDT

    So I just put the finishing touches on a poker game in JavaFX. Part of the functionality in this program is a single player mode, where you can play hands against the computer. To be transparent, this is a university project, so I'm not aiming for perfection. More, just an ai that behaves semi-intelligently for game variation and minor challenge for casuals.

    So to be clear, I am aware of general poker strategy, and have found numerous articles/research papers/links on more in-depth poker AI's designed to compete against competitive players. I guess as an analogy, there's the Easy mode bots in League of Legends, then there's the deep learning AI that beat a DOTA pro in laning.

    I'm definitely aiming for the former here. While I currently have a basic algorithm that works as:

    if(gamestate = flush, straight, 3-pair, full-house, face card pairs) { raise 1/4 pot; }

    else if(gamestate = pair, potential flush or straight, etc) { check/call; }

    else { fold; }

    So I already have functionality that can detect current board/hand states, but I do not have any functionality that can estimate chances at winning the hand, compare with opponent's possible hands, etc. Since the game only needs to be for casual play, the more advance algorithms seem like massively overkill.

    I guess my wishful thinking hope is that something exists similar to min-max in tic tac toe, although poker is obviously more complex. But something that can make some kind of rough approximation of hand value, that wouldn't require thousand's of if statements to cover every possible situation.

    So if anyone knows of any algorithms that would be used in, for example, a poker phone game or such, I'd really appreciate some help. To reiterate, if this question is too vague, I'm happy to provide any other information about my existing research, program design, or anything in this vein.

    submitted by /u/codingquestions4u
    [link] [comments]

    [Javascript/PHP] How to split up dynamic data in XML HTTP Request

    Posted: 06 May 2018 08:11 PM PDT

    Currently I am making a call to a secondary PHP file using an XMLHttpRequest as follows:

    var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (xhttp.readyState == 4 && xhttp.status == 200) { response = xhttp.responseText; } }; xhttp.open("GET", "loadDBClips.php?input="+input, false); xhttp.send(); 

    My original strategy was to use character separation within "input". For example:

    input = "Dave@Male@123 Main Street~Jane@Female@567 Front Street"; 

    loadDBClips.php would know to explode the input string by "~" to split each entry and then split each entry by "@" to get each individual piece of data. This works well when the text is simple like above but I am now running into the use cases where the text is not simple and may actually contain special characters (@,~,&,%, etc.). What is the best way to send this data to my php file? The number of entries is unknown so im not sure if I could send it using individual URL POSTS (like below) because I'm not sure how I would execute the $_GET's on the receiving end

    loadDBClips.php?name1=Dave&gender1=male&name2=Jane&gender2=female 
    submitted by /u/iFoosy
    [link] [comments]

    Need help developing a color algorithm

    Posted: 06 May 2018 07:35 PM PDT

    I'm working within the xna framework.

    I'm developing a roguelike, and my maps are partially procedurally generated. In other words, a base palette is chosen at random each original draw of the map, and this base palette is stored as an rgba integer value.

    I have to create fontsets from pixel art, each glyph being 8x16 pixels. That makes the art asset difficult to see on the map. Especially if the color used to print the glyph is very similar to the color used to print the underlying map tile.

    So while loading my objects during the draw sequence of the map, I want to grab the base palette in memory, and then use its values to produce a palette that is in strong contrast to the base palette.

    I don't know much about color theory, so my initial gut instinct is to increment the value of each rgba element by 100.

    Would this be sufficient?

    my goal is to maximise the visibility of these tiny objects.

    Also does anyone have any suggestions on how to generate a 'vibrating' color palette, intentionally, rgba value wise?

    submitted by /u/whatcomputerscantdo
    [link] [comments]

    Storing/persisting data with PHP?

    Posted: 06 May 2018 03:58 PM PDT

    I'm making a web application for Pokemon Go, the end goal is to have a webpage that displays google maps with an overlay of Pokestops that are local to our town where a user can click one and mark it with a quest, so that other players in the town can look at the map and see which stops have which quests. It's going pretty well so far, but I'm unsure what the best way is to go about saving the quest marked to each stop. Right now everything wipes when I reload the page. I thought about using a mysql database, but is their something that would be better to use to store/persist user submitted data?

    submitted by /u/Naraku893
    [link] [comments]

    I want to download about 100000 images, and then create one massive image, sort of like a puzzle. Can this be done with simple coding instead of one by one?

    Posted: 06 May 2018 09:55 PM PDT

    My situation is this: There are about 100000 images I want to download, and then compile them into one gigantic image. Each image is 256x256, and it's a 2d graphic with only a few colors (Which means tiny file size) and the final image I want to render would be like 256000x256000.

    I could just do it one by one, but that'd probably take months. There is one thing that could complicate this though, the images are stored online, and the url is different for each one. Not too different, but for example, image one would be like https://images.reddit.com/image1-map and image 98765 would be like https://images.reddit.com/image98765-map

    Is this possible?

    submitted by /u/wtfisAntifa
    [link] [comments]

    [Algorithms] Average/Worst Case Complexity of unordered_set::find?

    Posted: 06 May 2018 01:20 PM PDT

    Hello! I was wondering how the worst/average case complexity of unordered_set::find were derived from here? I assumed that in order to find a value in an unordered set, it would just take the key and search it's respective bucket for the value, however it seems as though it searches the entire container. If that is the case, how would unordered_set::find have an average case complexity of constant time? Thanks!

    submitted by /u/XGDoggieX
    [link] [comments]

    Services that help with assignments?

    Posted: 06 May 2018 12:20 PM PDT

    Hi, I am currently taking a discrete math class that has assignments that require programming, but I have never taken a programming class before. The math is pretty basic, but I am on a tight deadline an am completely lost, and was wondering if there are any services/tutors that can help with basic discrete math/programming assignments.

    Thank you very much

    submitted by /u/Allentownyeera
    [link] [comments]

    python timer of running time is ~4 seconds off.

    Posted: 06 May 2018 06:47 PM PDT

    hello, i have a simple program to calculate catalan numbers

    https://pastebin.com/jVsFXYL8

    it takes awhile to run(i7 5820), about 1 minute for the first 20 numbers., i have the pastebin code at 17 since its around 9 seconds.

    however, the program timer when i run it is always at around 13 seconds, even though if i use an actual stopwatch its always at around 9.

    what could be the 3-4 second difference? at most there is just a ~100ms difference in me pressing start with my mouse, and start with my other hand with my stop watch

    using time.time is also the same

    submitted by /u/applemilkz
    [link] [comments]

    What's the best way to simultaneously develop a simple app for android and iOS?

    Posted: 06 May 2018 08:23 AM PDT

    I want to build a simple app that would scrape a web page and display the content nicely in a mobile app. Currently, redesigning the page is not an option due to some internal friction. Yes, I do think that would be the best way also.

    Are there any good products that would simplify so I don't have to build it twice? I have some programming experience. I'm not an expert, but I can learn. I would like to keep this low/no cost as well, since it's out of my pocket at least until I have a working product, and maybe even after.

    submitted by /u/countingthedays
    [link] [comments]

    Sequential data access on top of high performance, persistent memory based key value storage

    Posted: 06 May 2018 05:40 PM PDT

    With SQL databases, sequential access (table scans) are straight forward. I am trying to implement this sequential scan for systems that allow random access read and write (key value stores, hash tables and so on). The worst case scenario is to "locate" sequential keys for all "rows" but I was wondering if there was a more efficient (and portable) algorithm (across kv stores) to only "locate" the first row/entry and then scan sequentially from there. This is similar to kafka in some regards but different in that the underlying storage could be persistent memory (like optane) and so I would like to take advantage of that.

    submitted by /u/30k_millionaire
    [link] [comments]

    Improving word filter

    Posted: 06 May 2018 05:39 PM PDT

    I'm coding a word filter that detects bad words. So far, I've tried a RegEx which works really well, but also causes false positives such as "cockpit". I've also tried making a simple function that splits up the words and matches them with the word list. This prevents false positives, but also fails when two or more bad words are put into one word. I'm using JavaScript if it matters.

    Is there a better way to do this? And is there a list of words with normal words that contain bad words (such as cockpit)?

    submitted by /u/jasonlevel1
    [link] [comments]

    Should I learn Java, Kotlin or C++ first?

    Posted: 06 May 2018 11:04 AM PDT

    I have very little experience with compiled languages (only Go).

    However, I have plenty of experience with languages, such as Bash, Python, Javascript, and a bit of Ruby.

    Based on this, should I focus on learning Java, Kotlin or C++?

    submitted by /u/3K-calories
    [link] [comments]

    Program-Hardware-Software Interfacing

    Posted: 06 May 2018 01:03 PM PDT

    Hey all! I'm a pretty noob programmer, I only took like two or three semesters of Javascript. Still though, I think programming is pretty cool, and in my pursuit of completely automating my daily breakfast, I'd like to start with learning some basics, namely how to interface between programs and my computer in general.

    So first off, I'll provide an example of the kind of thing I want to do for the moment. Lets say, that I have like 100 different Chrome windows open, just kind of scattered around my display. I would like to make a program that, once I type "execute!" and hit enter, has the mouse find each "X" and click it to close the windows, except for the last one, which I want the mouse to click in the search bar and then have my program type "cat videos" and hit enter and then click on the first result.

    So the first question is, what language is best to know to do this kind of stuff? As I mentioned before, I know mostly Java, a little itty bit of LUA, and the concepts of C++ (since it's pretty similar to java in syntax at least.) Are these some of the easier or better ones to use, or do I need a different language that runs on a different level of operating or something? I saw in my little experience in LUA a lot about shells and stuff which all sounded really scary and was all way over my head. Is that something I should know about too?

    Next, am I anywhere close to being able to do this? I haven't really done any programming in awhile, and it's been pretty limited in what I can do. I use Eclipse, (which is now Oxygen, I guess?), and I still do everything in the runtime environment in there. I've never made a program that has an executable and can be run just on any machine running java.

    Which leads me to my next question, what do I need to learn/what language should I use if I want to make executable files that can be run independently of a runtime environment? Is that a more advanced thing that I shouldn't worry about for now, or are there easy ways to implement an interface with buttons, fillable fields, and interaction?

    That's what I'll start with for now, learning some programming is my summer project, and I'll probably be back here later.

    Thanks for the help!

    ~Bard

    submitted by /u/Retroroid
    [link] [comments]

    Can CMake invoke the 'dx' tool from the android toolchain?

    Posted: 06 May 2018 11:27 AM PDT

    I've started to port a desktop software (originally C++) to android.

    I'd like to set up my build system with CMake, so first I've created a standalone tool-chain file that sets up the Native DevKit, and my C++ code successfully compiles to a library file.

    Next, I've created a java wrapper and made jar compilation with the java tool-chain. The next step would be to compile the jar into a 'dex' format (dalvik executable) known as the DX tool in the android tool-chain. I've searched, but found no support for invoking this with CMake.

    How could I get the rest of the build processes within CMake? (I still need DX, AAPT for resource description and packaging, Zipalign and APKSigner)

    submitted by /u/LPeter1997
    [link] [comments]

    Tutorial style books for more low level concepts?

    Posted: 06 May 2018 10:35 AM PDT

    Anybody have some suggestions for tutorial style books for lower level concepts?

    I've read a few iOS/Android/WebDev books that are just impeccably easy to learn from because they walk you through the entire process and explain every detail while giving an incredibly tangible demonstration and tutorial for acquiring new skills. It makes learning these platforms so easy that I just pick up a book while I'm bored and learn how to write React web pages with minimal effort.

    Meanwhile, there are still some skills that I haven't quite developed thoroughly as a systems engineer. IE I've never written a daemon with any sort of IPC beyond a simple hello world one. A heavily pedagogical tutorial based book on systems engineering skills would be amazing. Anybody have any recommendations?

    submitted by /u/lanzaio
    [link] [comments]

    How can i make my webscraper more efficient?

    Posted: 06 May 2018 10:32 AM PDT

    I'm attempting to scrape all the data from this site: http://insider.espn.com/nba/hollinger/statistics for seasons 07/08 till the current season (17/18). I've made a webscraper which does what I want, exactly how I want it, however I'm always looking to learn, so I would like to know if there is anything I can do to make it more efficient.

    Right now, it collects all the data from each season and puts it into their own seperate csv files.

    the code: https://pastebin.com/NScADMPq

    submitted by /u/Moajizz
    [link] [comments]

    Software Help For My Dissertation

    Posted: 06 May 2018 03:19 AM PDT

    TLDR: Is there software that allows me to visually see the memory reads and write of a linux OS PC.

    Hi,

    Next academic year I begin my dissertation on whether a graphical representation of the operation of a computer revels invarianies that could signify a security risk.

    To do this I intend to look at the memory reads and write of a Linux OS PC, however I am not sure of any software that would enable me to do such a thing, does anyone on here know of one?

    Thanks.

    submitted by /u/8bitsalt
    [link] [comments]

    Cool idea for old laptop

    Posted: 06 May 2018 02:52 AM PDT

    Hey all!

    I guess is not really a programming question but I wasn't sure what sub reddit to post it in and plus everyone on here is usually pretty helpful so why not!

    I got a new laptop and don't really use my old one which still functions perfectly fine and actually not to bad at all. I was wondering if anyone has any cool uses for it? Like cool project.

    Interested so hear about peoples side project that they have thought of or done!

    Happy coding! :D

    submitted by /u/pd145
    [link] [comments]

    OAuth2 and storing private data

    Posted: 06 May 2018 02:40 AM PDT

    Hi guys.

    I have an oauth2 flow for Google. I am trying to make a budgeting app.

    So I have the username, email, profile pic ect, so now I want to store financial records in such a way that I as the host cannot read a user's records or extrapolate data like user 1 made a deposit.

    I don't think encryption is the way as this would take a long time to decrypt, and I don't get a persistant encryption key, from the oauth providers.

    I guess I can ask the user for a password but that defeats the purpose of using oauth.

    Any ideas are welcome.

    submitted by /u/Dazza93
    [link] [comments]

    No comments:

    Post a Comment