Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

09-27-2013 , 09:43 AM
Yeah, I tried that one as well.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-27-2013 , 12:01 PM
Quote:
Originally Posted by Larry Legend
What about tablets yo
They get the full site nav for now.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-28-2013 , 09:13 AM
do you guys think its a "code smell" for a poker program to represent cards as an array like ['Js', 11, 's'] instead of just a string like 'Js' and parsing out the suit or number when needed in various hand evaluation functions?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-28-2013 , 11:32 AM
i can't imagine ever using an array for that purpose.

dictionary > object = named tuple >> string >>>>>>>>>>> array
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-28-2013 , 11:49 AM
what would this dictionary look like? I was going to use an array of strings like ['Js', 'As'...]

What makes an array so obviously the wrong choice?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-28-2013 , 12:00 PM
-1,

you really need to give more info about what your trying to accomplish and how it will be used. depending on the answer, and array of strings could be horrible or it could be ok. also, what language are using?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-28-2013 , 12:12 PM
Quote:
Originally Posted by e i pi
what would this dictionary look like?
Code:
{ 'displayName': 'Js',
   'value': 11,
   'suit': SPADES
}
Quote:
What makes an array so obviously the wrong choice?
myCard[2]

what does this mean?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-28-2013 , 12:21 PM
Quote:
Originally Posted by tyler_cracker
Code:
{ 'displayName': 'Js',
   'value': 11,
   'suit': SPADES
}


myCard[2]

what does this mean?
oh right of course. So you think an array of dictionaries like the above is better than an array of strings, to represent a deck?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-28-2013 , 12:29 PM
Quote:
Originally Posted by gaming_mouse
-1,

you really need to give more info about what your trying to accomplish and how it will be used. depending on the answer, and array of strings could be horrible or it could be ok. also, what language are using?
well I originally wanted to write a program that was a hand evaluator but also could evaluate for various draws on board textures... basically a poker simulator.

I started writing one like a year ago but lost interest when I remember I can't play decent online poker in the US.

Last night I was looking over the code though and decided I want to rewrite it.

Here it is if you want to have a laugh. I kind of half committed to TDD before just putting print statements everywhere and I'm not sure to what extent parts of it work... hence the desire to start over from scratch.

http://pastebin.com/dzAij59P
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-28-2013 , 12:56 PM
Quote:
Originally Posted by e i pi
In my mind the program works like this, you input your hand, a range for the villain and the flop. You then assign actions for different hand strengths for each street. So for example, you could set your action as something like bet all turns where you have 2nd pair+ given the 3 flush didn't get there, and fold facing a raise unless you have 2pair+ (i'll either invent a syntax for this or make a gui for selecting hand strengths and actions). The conditions are key, because the developing flop textures dictate our actions. I don't think it should be too difficult to have the program notice when a backdoor flush or 4 straight or whatever ran out. You can also choose actions for turns and rivers based on the cards that come, so you can set it to 2 barrel all over cards, triple barrel all backdoor 4 straights, flushes... You also set have to set the calling/folding/raising ranges based on board texture & relative hand strength for the villain obv.

The program then runs through a couple million simulations, randomizing both the hand the villain is holding as well as the turn and river cards.

It will be interesting to see how quickly the EV converges. Especially if its simulating something super standard like 2 barreling good over cards with air with wide range vs wide range like in a HU match.
I found an explanation of what I was trying to build that I wrote in this thread in july 2011. interesting.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-28-2013 , 02:40 PM
The way I did it was with lists, so I have:

ranks = ["" "2" "3" "4"...."Q" "K" "A"]
suits = ["S" "H" "C" "D"]

then permuted the above to create the deck:

deck = [["2" "S"] ["2" "H"]....]

and represented the hands like:

player = [["2" "S"] ["2" "H"]]
bot = [["3" "S"] ["3" "H"]]

then board:

board = [["4" "S"] ["4" "H"] ["4" "D"] ["4" "C"] ["5" "S"] ["6" "S"]]

then evaluated the hands from:

playerFinalHand = [player board]
### = [[["2" "S"] ["2" "H"]] [["4" "S"] ["4" "H"] ["4" "D"] ["4" "C"] ["5" "S"] ["6" "S"]]]

The reasoning was for evaluation, so if I want to compare hand-strengths (pair > pair ?), or check if said hand is a straight, I just compared the indices on the ranks list (since the computer things that "Q" > "K").

I took some minor inspiration from here: https://www.udacity.com/course/cs212. I think he uses a list of strings as well, but not the same representations that I used.

Norvig doesn't really make an argument either way, but it all breaks down to how you want to evaluate the hands. If you are going to use the 2+2 evaluator, then you may have to try other ways, but I don't know how those work.

I think representing the deck as a list is better since it is easier to mutate and Python -- if that is what you are using -- has cleaner list operations than any other data structure, IMO.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-28-2013 , 02:49 PM
Quote:
Originally Posted by daveT
Does anyone have any ideas why this might not be working?

Code:
server{
     listen          80;
     server_name     www.mySite.com;
     return          301 $scheme://mySite.com$request_uri;
}

server {
     listen       80;
     server_name  mySite.com;

      location / {
           proxy_pass http://localhost:3000 ;
      }

      .....
I'm trying to redirect www to not www.

I set up the CNAME on DO. When I go to www(dot)mySite(dot)com, I simply get a 404.

I tried a bunch of variations on the theme, but none of them seem to work:

http://nginx.org/en/docs/http/conver...ite_rules.html

http://stackoverflow.com/questions/7...-www-to-no-www

http://rtcamp.com/wordpress-nginx/tu...w-redirection/
Figured this one out:

Code:
server {
     listen       80;
     server_name  mySite.com www.mySite.com;
     rewrite rule here: 

      location / {
           proxy_pass http://localhost:3000 ;
      }
And that is it! Using two servers didn't work and apparently wasn't needed.

For the rewrite, I decided to go from www.mySite.com/pageOne/ to www.mySite.com/pageOne

Not sure which way the is the more "correct" answer here, but I guess its a personal preference, though I imagine in some circles, this gets more contentious than tabs -vs- [heated argument on N] spaces.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-28-2013 , 08:33 PM
Quote:
Originally Posted by daveT
For the rewrite, I decided to go from www.mySite.com/pageOne/ to www.mySite.com/pageOne

Not sure which way the is the more "correct" answer here, but I guess its a personal preference, though I imagine in some circles, this gets more contentious than tabs -vs- [heated argument on N] spaces.
I am a complete beginner on this topic, but I've heard that leaving out the final slash forces the server to perform a redirect. i.e. from about.com (the most reputable site out there):

Quote:
Traditionally, URLs that pointed to files did not include the trailing slash, while URLs that pointed to directories do include the trailing slash. This means that:

Code:
http://webdesign.about.com/example/
is a directory, while
Code:
http://webdesign.about.com/example
is a file.

This helps speed up page loading because the trailing slash immediately tells the web server to go to that example/ directory and look for the index.html or other default file.

When you go to a URL without the trailing slash, the web server looks for a file with that name. If it doesn’t find a file with that name, then it looks for a directory and looks for the default file in that directory.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-28-2013 , 10:18 PM
I found this :

http://stackoverflow.com/questions/5...e-is-preferred

Which didn't cause nerd rage. FWIW, SO is sans trailing slash.

Also just learned that heroku requires you to do the redirection in your source code.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-28-2013 , 10:27 PM
Are any of you guys using elastic search?

I decided to start messing with full text search platforms yesterday and it seems pretty sweet. I'm torn between using it or solr. I kind of got the impression that ES has more good things going for it based on limited research.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-28-2013 , 10:32 PM
the search folk at my work are basically moving everything from lucene to ES. they're a pretty smart bunch.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-28-2013 , 11:56 PM
Quote:
Originally Posted by Shoe Lace
Are any of you guys using elastic search?
Quote:
Originally Posted by tyler_cracker
the search folk at my work are basically moving everything from lucene to ES. they're a pretty smart bunch.
I just checked out their home page.
Is this a replacement for your normal database with better search capabilities?
Or is this something you'd use in addition to a normal database?
For example, what are you guys using it for?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-29-2013 , 01:43 AM
it's basically a layer on top of the db for performance (indexing, load balancing) and features (ability to customize responses based on other factors).
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-29-2013 , 01:46 AM
Quote:
Originally Posted by tyler_cracker
it's basically a layer on top of the db for performance (indexing, load balancing) and features (ability to customize responses based on other factors).
so you have to have some other db in place already?
does it only work with nosql dbs?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-29-2013 , 02:01 AM
well there's always a first in this job: since I'm making a site for the brooklyn nets, I have yet to define a background color or (text) color. yeah.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-29-2013 , 03:06 AM
Quote:
Originally Posted by gaming_mouse
so you have to have some other db in place already?
does it only work with nosql dbs?
i don't know if you have to -- i suppose you could inject data into the index via some other mechanism -- but our data is in databases.

we use mysql almost everywhere.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-29-2013 , 05:07 AM
Quote:
Originally Posted by tyler_cracker
i don't know if you have to -- i suppose you could inject data into the index via some other mechanism -- but our data is in databases.

we use mysql almost everywhere.
so how does it get turned in the JSON format and made available to ES?

(btw this is a perfect example of that thing i was talking about the other day how lots of cool open source projects are totally baffling as to how you'd actually, specifically use them even after glancing over their homepage)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-29-2013 , 06:02 AM
In Prolog, I use something like...
Board = [flop-[card(s-2), card(d-9), card(h-k)], turn-[card(h-a)], river[card(s-j)]]

I'd probably just use a dictionary (possibly a custom object) in other languages, seems the most natural.

Last edited by clowntable; 09-29-2013 at 06:07 AM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-29-2013 , 08:10 AM
Quote:
the search folk at my work are basically moving everything from lucene to ES. they're a pretty smart bunch.
Both ES and solr use lucene under the hood. I think ES handles distributed searches more easily though, are you guys dealing with a big cluster?

Quote:
so you have to have some other db in place already?
does it only work with nosql dbs?
Yes, I'm using postgres. Your primary db doesn't matter, both things are entirely separate. A common use case for a full text search engine is to perform intelligent searches on some data.

Trying to do any type of real search using LIKE in a database is a horrible experience. ES adds in token matching, stop words, quoted searches, word highlighting in returned results, related records based on tunable params, and stuff like that. It's also insanely fast at performing those actions.

It's all exposed really nicely too. I was able to get all of that going in seriously minutes with the rails Tire gem. For example here's a typical ES query in rails:

https://github.com/railscasts/307-el...article.rb#L18

Right above that he defined the indices. Notice the "boost" argument too which allows you to boost a field by an amount so it's more relevant in the results.

The value returned by that query is just something you can iterate over like a normal rails AR collection. It uses callbacks under the hood so when you save/destroy a record normally it updates the ES indices, that is basically what tire handles for you since its API is very close to ES'.

Quote:
so how does it get turned in the JSON format and made available to ES?
This is the easy part, you just make an http request to your ES servers. In Rails' case it's super easy to serialize a result set to json. The tire gem takes care of all of this for you.

ES also advertises that once you push something to its server it's available in the index within 1 second.

Quote:
use case?
Going full on rails style with tutorials, imagine having a blog. You might want to store the titles and body of the articles in ES. Now users can have a really powerful search which could let you get highly relevant results, related posts and highlight the search terms on the page without using dirty regexes in javascript. You could put together a query like that in maybe 5 lines of code and installing ES required downloading a file and starting the server, easy mode.

Last edited by Shoe Lace; 09-29-2013 at 08:25 AM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
09-29-2013 , 09:15 AM
Shoe,

Thanks very much! Great explanation.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m