Open Side Menu Go to the Top

06-27-2015 , 09:45 PM
Quote:
Originally Posted by plexiq
For ordered enumerations you basically just need ~1 array lookup per evaluation using the 2p2 method by caching the intermediate indices. So there is no way you could be faster than this using your method.

And using a generic hash function doesn't work very well. As you said this would require 52c7 = 133784560 key/value pairs, which comes out to roughly 1GB. Due to the additional size this will result in considerably more cache misses than the 2p2 eval, and you have additional CPU cost for the hash function.

A better approach is to use a specialized "hash" function that attempts to map a high % of hands with identical ranks to the same index in a handranking lookup table, therefore reducing the overall size of the lookup. There is a trade-off between complexity of this function and size of the lookup table.

The hand evaluator I posted a while back is based on that approach, the last version is using a 512kb lookup table with an indexing function that is still fairly fast. (.jar incl source)

PS: Using 64bit int's to represent hands is fairly common for evaluations, e.g. HoldemShowdown
thanks for the info. a couple followup questions.

sounds like the answer is basically no, and there's not much room for improvement over the 2p2 method using any technique?

i want to use this for something on the web, so speed is key. keeping the 2p2 lookup table in memory is not a problem. i'm trying to get fast range v range calculations for arbitrary ranges. doing complete enumerations, worst case scenarios take about 8s. using monte carlo, i can get the same answer to within 0.1% in under 0.5s, which is probably good enough, but it would be nice to be even faster.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
06-27-2015 , 10:00 PM
If you only need that for 2 or 3 ranges, you can pre-calculate the preflop equity of all hand-vs-hand(-vs-hand) matchups. That would be considerably faster than calculating everything on-the-fly with any hand evaluator.

For >3 players doing full enumerations, the 2p2 evaluator is probably as good as it gets. For random/unordered evaluations (e.g. when using monte carlo) you should use a different evaluator.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-27-2015 , 10:09 PM
Quote:
Originally Posted by plexiq
If you only need that for 2 or 3 ranges, you can pre-calculate the preflop equity of all hand-vs-hand(-vs-hand) matchups. That would be considerably faster than calculating everything on-the-fly with any hand evaluator.

For >3 players doing full enumerations, the 2p2 evaluator is probably as good as it gets. For random/unordered evaluations (e.g. when using monte carlo) you should use a different evaluator.
yes, this is for 2 ranges.

i should have been clear, the flop, or flop + turn, can be specified too, so i don't think the pre-calculated PF equity would help there, correct?

also, keep in mind the simulating is being done over the hand ranges, so we fix a flop, fix a turn, fix a river, then simulate over hand ranges. so each "sim" is 4 lookups, 1 for each card held by each player. should i still be looking at a different evaluator? how much speed increase could i expect?

Last edited by gaming_mouse; 06-27-2015 at 10:15 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-27-2015 , 10:32 PM
Pre-calculating:
Yeah, if you want to specify flop/turn cards then pre-calculated equities won't work. But you could just handle these cases separately, when the board is specified that speeds things up a lot anyway.

(Dead cards are more tricky because these can occur preflop.)

Quote:
also, keep in mind the simulating is being done over the hand ranges, so we fix a flop, fix a turn, fix a river, then simulate over hand ranges. so each "sim" is 4 lookups, 1 for each card held by each player. should i still be looking at a different evaluator? how much speed increase could expect?
Probably best to benchmark a few evaluators for your specific use case. But I doubt the 2p2 eval will do too badly if you are caching the river indices (ie only 1-2 lookups per hand).

The rest of you implementation is probably much more important than the specific hand evaluator, fwiw.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-28-2015 , 05:21 PM
Quote:
Originally Posted by RogerKwok
anyone have advice or know of resources on flexible permission design?

say my app has models with some fields and arbitary user "tiers". based on the current user's tier, when he accesses an object in the frontend, only certain fields are exposed (so some users can see Project.name, others can see Project.name/version)

two naive ways we're discussing are:

1. restrict fields at the view/controller level, since we know the auth'ed user, we point to specific serializers based on the user tier; major downside is we might need a ton of serializers, and different api end points (say search/browse) may need to repeat code to limit fields

2. restrict at the model level, so the ORM query only gets specific fields, the downside is i think the fields need to be moved to an EAV system (so they become relationships rather than fields). and we'd to maintain a massive user-to-EAV permissions table for efficient querying

anyone have experience with something like this?
A bit late to the party, but apart from the good advice to preferably use an auth library, if I wanted/needed to mess with such a structure, I'd start by looking into using the decorator pattern on the controller level.
The set of decorators available then depends on the user tier.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-28-2015 , 07:39 PM
Boom!
Two and half hours to get a text-based, Java blackjack game working, complete with a small amount of gambling, but no support for Ace as 11. :-/

Yet.

At least one of those hours was spent trying to figure out little weird bugs related to the for each loops I was trying to use (but haven't used before). That'll learn me.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-28-2015 , 09:17 PM
ace fixed in about 5 minutes after I sat down to think about, bwamp
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-28-2015 , 09:39 PM
Good stuff, Low Key. Making gambling bots isn't the easiest project in the world.

irt where to place the "if admin" stuff, I don't know why you'd put it in the model instead of the controller. Is there is a good reason to do this?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-29-2015 , 01:17 AM
MySQL: wtf?

Code:
create table stuff (
 sid serial primary key,
 words text,
 sort_order serial
);
"serial must be a primary key and it must be the first column of the table."

I have no words. None whatsoever. Absolutely disgusting.

fwiw, varchar is illegal as well. Have to use varchar(n). I'm not sure how I feel about that.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-29-2015 , 09:21 AM
Coming from MSSQL, MySQL has always seemed like a horrible den of WTFs to me, but not sure how much of that is just how comfortable I am with T-SQL.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-29-2015 , 01:08 PM
Quote:
Originally Posted by gaming_mouse
sounds like an interesting problem. it's hard to answer without knowing more, though. could you give some specific examples? (eg, what are the tiers? what are examples of pages that need different views? what are the differences in the views? describe it without reference to anything technical)
sry for late response, i didn't mention our stack because i thought it'd be a general design problem, but in case it's relevant we use angularjs/django

a specific example would be as such:

User tiers: base_user, manager, superadmin

say Project page has name, comments, versions
  • All users can see always see any Project's name
  • Managers can see their own project's comments/versions
  • Superadmin can see everything

This is just some arbitrary spec, in reality each superadmin can define tiers and what each user tier can do. Additionally, each user can be given specific read/write permissions on any Project

The permissions must also apply to search/browse, so if user1 cannot see project1, if he does a search/browse, that project won't show up. we might have to roll our own search, the current lib (haystack) search index doesn't really work per user
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-29-2015 , 01:19 PM
Someone would basically have to offer me huge amounts of money to use anything but PostgreSQL for any relevant project.
Keep your NoSQL, let us ball (also keep your loltastic proprietary databases).

It's the #1 FLOSS project apart from the kernels/OS as far as I'm concerned.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-29-2015 , 11:35 PM
I really like postgres too and it seems superior to other dbs I've used. So why is it that Amazon RDS and Google's equivalent default to/only launched with mysql?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-29-2015 , 11:42 PM
mongodb is my fav but i've never used postgres
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-30-2015 , 07:37 AM
Quote:
Originally Posted by blackize5
I really like postgres too and it seems superior to other dbs I've used. So why is it that Amazon RDS and Google's equivalent default to/only launched with mysql?
Amazon RDS started with MySQL, then they introduced Oracle, then MS SQL, then PostgreSQL.It would only make sense that you'd start with the most popular and work your way down.

I suspect Google Cloud SQL using MySQL because it is the most popular database and because Google used MySQL for much of its storage. They would know how to squeeze every last drop from this database.

For whatever its worth, replication and sharding PostgreSQL is "beta" to say the least. They didn't start introducing these ideas until the past couple of years. The tools have a lot of restrictions and its generally difficult to work with at this point.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-30-2015 , 09:21 AM
Actually, there are a few other issues with PostgreSQL performance.

It sits directly on the OS instead of a VM like other systems.

It takes a lot of manual settings to get performance like you want it, and many of the settings are rather difficult to understand and test. They are also inter-dependent. Unfortunately, PgSQL comes with the worst possible defaults.

A major concern is SOAP tables, which can illicit rolled eyes in the presence of certain people. Getting the settings so that these don't spin out of control isn't hard, but it is something you can miss pretty easily. You can end up with a system that is 25% data, 75% SOAP tables. At this point, you have to dump, nuke, rebuild, restore.

I suspect that offering PgSQL as a service would be much more difficult than other systems. Given that it isn't that popular, goes through constant changes, and minor version upgrades don't "just work," it doesn't surprise me that companies aren't falling over themselves too offer it as a default implementation.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-30-2015 , 11:45 AM
Interesting article on why you should quit your job

http://www.vox.com/2015/6/30/8852017/quit-my-job
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-30-2015 , 12:45 PM
Quote:
Originally Posted by Low Key
Interesting article on why you should quit your job

http://www.vox.com/2015/6/30/8852017/quit-my-job
Sounds like that person made the right decision for him/her. The two jobs I quit to play poker were pretty similar. Where I'm out now is by far the best environment I've ever worked in. Everyone in the trenches legitimately likes each other and there are no slackers who try to angle getting out of work or anything. I never wake up dreading going in to work. That goes a long long way.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-30-2015 , 01:03 PM
I love my job but simultaneously acknowledge it is primarily serving as a means to acquire capital, and when the opportunity to acquire said capital arrives, I'll 100% be starting my own thing.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-30-2015 , 01:21 PM
^^ The article didn't really cover what he is going to do, to continue being self independent financially.
Seems more of a omg life has been so nice after quitting and hopefully this works out writeup.

If anyone is financially independent with enough saved up for a year or more. They definitely should try to make it on their own doing whatever they love if that is their dream. But I would recommend planning way more ahead than what it seems the guy in the article did.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-30-2015 , 01:37 PM
Working at a computer I find takes it toll on your body in various ways, as well as life in other more subtle ways. For example if you spend extended periods of time reasonably isolated your social confidence can suffer. It can also be pretty depressing at times if you're susceptible to that. Everyone's different of course but that's my experiences.

I find it sad, because I've experienced life on the other end of the spectrum in a small community in a beautiful part of the world doing manual work (cooking), absent of computers for all intents and purposes and daily meeting new people and having great experiences. Without a doubt, that is the life I wish to pursue and know I would be happiest in.

Unfortunately a careerist society makes it very difficult to break the pattern. And I do feel trapped sometimes for other reaons, but now have an end goal 3-5 years down the line which I'm working towards which is good to have.

Making it sound worse than it is, but working on a computer is something I feel quite good at, make good money from, is rewarding in lots of other various ways but is something that is increasingly becoming more stressful to the point it's infiltrating pretty much all aspects of my life.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-30-2015 , 01:39 PM
Article is terrible. 4 years with an awful company is ridiculous for our industry. Put in your year and get out. Maybe if xe didn't spend way too long at a job xe hated, xe wouldn't be "burned out".
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-30-2015 , 01:55 PM
I also noticed the suspicious pronoun / "my partner" usage

I think it's acceptable to be gay these days. "I wrote code and I'm a gay woman" probably not the instant identifier it once was.

Then again, with the reception women get online, probably best to stay genderless.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-30-2015 , 02:53 PM
Hmm i would bet money that the person is a mtf after looking at the tumblr and blog.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-30-2015 , 03:19 PM
Quote:
Originally Posted by Low Key
I also noticed the suspicious pronoun / "my partner" usage

I think it's acceptable to be gay these days. "I wrote code and I'm a gay woman" probably not the instant identifier it once was.

Then again, with the reception women get online, probably best to stay genderless.
This x1000.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m