« first day (1585 days earlier)      last day (3362 days later) » 

6:00 PM
I will figure something practical out
 
so you'd make the rules flexible (code them in defs)
then you can subclass ;)
 
When you do, ping me and I'd love to code review.
 
also remember that no casino would have 1 deck :D
 
what's the keyboard shortcut to submit the answer?
 
@AdamSmith will do, will finish this tomorrow If I am not too bust
 
6:01 PM
almost
 
@AnttiHaapala what do you mean?
There is more than one deck in a round of black jack?
 
@AnttiHaapala that's not actually true -- most casinos offer a single- or double-deck game.
@Vader most blackjack tables play with a "Shoe" of 6-8 decks
 
depends. The edge on 1 deck is so small :D
cant play small money, will never pay the wages of dealer
 
Well creating bigger decks will not be a problem but for now, 1 will do
 
@AnttiHaapala single- and double- deck games are shuffled between hands.
 
6:02 PM
ah :d
no that is cheating :D
 
Finally I can combine my programming with the 5 years I spent as a dealer! :D
 
What did you deal?
The good stuff?
cabbages?
 
they just shuffle earlier with 1 and 2 deck ... not necessarilly after every hand
 
single deck absolutely much shuffle every hand or else the casino is really wanting to lose money
 
but its supposedly easier to count cards with smaller shoes .... (its not really true you just divide your count by number of decks) .... sure it increases the odds that it wont come out how the count predicts
 
6:04 PM
but you're right, sometimes they'll have a penetration point on double
 
Well I would create a new deck after each play, that seems quite fair
 
that is essentially a shoe with infinite decks
no its not ... disregard that
 
@Vader Blackjack, Hold'Em and Omaha, Craps, Roulette
 
@AdamSmith in vegas?
 
@Vader Smalltime casino in Oregon. I got offered a job at the Mirage in Vegas, but we'd just had our daughter and neither wanted to uproot our family to move there nor really to raise our girl in Las Vegas lol.
 
6:06 PM
Yeah, good call on not moving
 
I used to play alot of black jack ... my buddy was really good at counting ... I was pretty mediocre ... we won more than we lost but it was never big money .... and we still lost plenty ... then it got old
 
Isn't counting cheating?
 
sort of ... define cheating
 
@Vader only if you're asking the casinos. It's not illegal.
But they'll kick you out for it
 
and theyre good at spotting it ... but they dont watch the 5.00 tables too close
 
6:08 PM
Counting cards is a SLOWWWWW way to make money, and it's about as boring a job as you'll ever have.
 
How do you spot it?
 
+1
then -1 ... forever
you watch peoples bets
the biggest thing counting does is tell you how much to bet and when
 
Everyone who's been in a pit knows how to count blackjack
the count influences the size of your bet, so if the player is betting the way you'd bet if you were counting, they're counting.
 
it makes you make some edge calls not the way you would expect
as well
 
6:09 PM
@Vader next time you're in a casino, split your tens and see what the dealer does.
 
If he doesn't call it to the pit boss and look at you funny, he should be fired.
 
I've never been to a casino
 
thats only a flag under certain circumstances
(ie very high count)
 
What is splitting?
 
6:10 PM
oh man
 
uh oh -- you need to implement new rules to your Blackjack game!
 
your blackjack ame is gonna be interestinng
 
oh, man
 
dont forget to treat 21 as 11 and double down as well :P
 
?
 
6:11 PM
that should really get a pit boss attention :P
 
I've actually NEVER seen that
@Vader if you're dealt a pair (10-10, 7-7, etc) you can double your betsize and play each card as the first card of a separate hand
 
or splitting tens would mean that the player is an idiot
 
if your count is through the roof its an interesting bet to make
 
so if you're betting $5, get dealt 8-8, you can place another $5 bet and have two hands each with one 8 in them
 
except when spliting aces there are various rules
 
6:12 PM
splitting 8's is almost always a good call
 
So I need to allow the player to split as well.
 
right
Aces you normally only get one card on, as if you'd doubled down
 
if you want to make it really like black jack ... there is splits and double downs
 
and then whether or not the ace + ten is a blackjack
 
But I see a lot of variations on that by casino
 
6:12 PM
and maybe insurance
 
and even money and ...
withdraw and...
and resplits ad infinitum
 
I don't think I will do double down for now
 
and ...
 
Ive seen places that grant you a win with a run of 5 cards without bust
 
If you don't implement insurance you don't need to do even money
 
6:13 PM
double down is the easiest rule to do
it is just asking if the player wants to double the bet
 
can you split after splitting ... I forget ... Im not sure i ever played that hand
 
usually only if the hand is 8-11 or so
depends on rules
I've never had such rules
 
withdraw is a stupid rule[citation needed]
 
its only allowed on the first hit and it only allows one hit
(double down)
 
I am not even doing betting
 
6:14 PM
oh
 
back to work
 
OH lol
 
lol
why would you play black jack without betting?
 
Lots of people play POKER without betting. I don't understand that either
 
For fun
 
6:15 PM
hmmmm
 
poker is different
 
different strokes i suppose
 
but blackjack its just a guessing game
 
@Vader Blackjack is a solved game
 
6:16 PM
afaik playing standard rules without counting the house has like a 0.3% edge
(smart rules)
 
Well if there is a tie, the dealer always wins
 
by counting you can get an edge of liek 0.5% over the house
 
re-cbg
 
but its still all just luck
 
hem why does the cut card benefit the dealer?
 
6:17 PM
cause the dealer makes whoever makes the cut feel special increasing tip likelyhood?
 
haha :D
 
tbh ill tip a dealer if im up more than 200% :P
 
It also gives the player the opportunity to feel up the cards while making the split to make sure the edges are clean
 
@JonClements you can't touch the cards.
 
well, depends how formally you're playing...
 
6:20 PM
@JoranBeasley I'm a poor barometer for tipping dealers. I tend to tip away all my winnings lol
 
in finnish bars there is a really crappy blackjack
has the rule that player loses on ties 17-20
-> house edge > 8 %
people being drunk, extra 5 %
 
yeah but they use the drunk trick in vegas too
 
what's that?
steal from the drunk?
 
always awesome when dealer shows a 5 ... and drunk idiot b hits and takes the ten
and dealer gets a 6 for 21 or some crap
 
@Vader drunk people gamble more and play worse. Vegas gives you free drinks for playing.
 
6:24 PM
then Joran gets up and goes to a different table
 
Oh, sneaky
 
So yeah -- steal from the drunk :)
 
free drinks are great if your playing penny slots or something
 
drunk idiot b hits on 17 against 5
 
Well now I want to go make a blackjack game. I've been meaning to learn PyQT...
 
6:28 PM
If the user has 2 aces, what should he do?
 
split them
 
okay
 
AI is hard
 
if the dealer has 2 aces he should hit
 
6:29 PM
dealers cant split though
dealers can only hit or stant
stand
 
I can only create so many nested if loops before I go mad
 
thats a sure sign your doing it wrong :P
 
- _ -
I can show you my current code if you like
 
user559633
@JonClements what do you mean by time-keeping?
 
Anyone know where I can find a good spriteset for cards? offtopic because it's asking for a book, tool, software library, tutorial, or other off-site resource
:)
 
user559633
6:30 PM
i had to go into a stupid meeting in which dangerous, idiotic things were said
 
I doubt i could help much with your code... i would just rewrite it all
but you should be using classes
 
user559633
anyone know where vaultah has been lately?
 
@Vader post a gist or etc. I don't mind taking a look
 
@AdamSmith ascii cards
 
start with a class Card
@AdamSmith I hear googles great for that sort of thing ;P
 
6:31 PM
@tristan that's my experience with all meetings that take place at the office. If the boss is taking us out to a restaurant, it's gonna be a good meeting. Otherwise....
 
@JoranBeasley got at least one thing right :D
 
@Vader let me introduce you to gist.github.com it's a marvelous thing Let me take a look at it
 
I know git/hub
but how is a gist different from pastebin
 
first comment: a card should know what kind of suit it can have. It should be throwing ValueErrors if you try to initialize Card("shovels", "13").
gists are mini gits. They have revision histories
and can be forked and etc
 
@AdamSmith The user will never actually create cards
the Deck's __init__ is the one who creates cards
 
6:38 PM
fair enough. By the way (and this isn't so much code critique as general knowledge): a card has a suit and a rank. rank is the value of the card, what you've called face. The More You Know and all that.
 
I was looking for that
rank it is, thanks
'king' == 10 points though right?
 
I would start with something approcimating this gist.github.com/joranbeasley/8f975af9445dfaecd0e5
deck is really unessesary
deck = [Card(i,j) for i in range(13) for j in range(4)]
there done
 
@JoranBeasley thanks, but I would like to learn the hard way. Also there is some stuff I really never used before, e.g lamdas and maps
 
I usually make a Card and a Deck class, solely because of separation of concerns
 
meh its not sneaky
deck is just a list of cards ... it doesnt really have any "DECK" specific actions
 
6:42 PM
I am sure there is a better way, but I would like to get it to work first and foremost
 
a hand however does
(such as scoring)
 
Should probably not spam the main channel with this. chat.stackoverflow.com/rooms/71104/…
 
0
A: Python 3: object() takes no parameter

Batfink02I am very stupid. Very very stupid. I accidentally left another class underneath with the same name and thought I deleted it. I'm very sorry for wasting your time. -_-

Can be closed as 'requires minimal code to reproduce the issue'.
 
user559633
i did a deck like this ~2 years ago gist.github.com/tristanfisher/e9d1d06abcde985783be
 
user559633
and why not talk about the deck and programming in this room?
 
6:46 PM
@tristan I didn't want to be the topic of discussion the next GM
 
user559633
what? no, we're talking about programming
 
I know, but HV
 
user559633
it's only an issue of spamming when it's a time vampire demanding "give me the codes"
 
user559633
@Vader you're fine.
 
:D
 
user559633
6:47 PM
"i don't understand, but i looked" is different than "okay but i want the code to do this"
 
Does the dealer have any randomness when playing?
 
or does he always follow the same rules
 
its very concrete rules for dealer
 
user559633
Shouldn't the dealer have the same random hand as the player?
 
6:49 PM
hit < 17 else stay
 
user559633
Or are you talking about rules for playing?
 
user559633
If so, dealers follow an algorithm designed for long term win
 
@tristan how is that possible?
 
you can choose if you want dealer to hit "soft 17"
 
Only one person can have the king of spades
 
6:50 PM
he is talking about rules randomness (ie can the dealer "choose to stay on 16"
I think ... at least
 
user559633
there's only one ace of spades
 
Oh, I guess he coul
 
@Vader thats only true until you have 2 aces of spades
 
user559633
I misunderstood -- the dealer should be playing with a very safe and reliable approach.
 
dealer has no "choice"
he must follow the rules
 
6:51 PM
Really?
 
yes
at least in real life
 
when I play it just the same as player, except you when at a tie
 
user559633
That's how the house wins long term -- playing into the safe bet.
 
user559633
Predictable, uniform application of the dealer algorithm.
 
a dealer cannot choose to stay on 16 ... in vegas they would get fired immediatly for that
 
6:52 PM
so why not replace them with robots?
where is the fun in that
 
they have run the numbers 1600000000 way and they figured out the best ods
robots dont talk to you
 
user559633
@Vader because robots don't play people into staying at the table.
 
at least it's easier to compute best hands in black jack then say hold'em poker...
especially if you introduce wild cards or something :)
 
but as far as a dealers actions they could easily replace with a computer
although holdem is also "solved"
 
user559633
yeah, that's like saying "why aren't bartenders vending machines?"
 
6:53 PM
Well there is both
 
that is why there are also 1500000 blackjack sites online :P
 
@Joran well, the idea behind having a good dealer rather a computer, is intuition and keeping the punters going
 
so there are robot dealers
 
user559633
@JonClements what did you mean earlier by "time keeping?"
 
Indeed, online gambling
 
6:53 PM
yeah i know :P thats why I said a robot doesnt really talk to you
in fact you are creating a robot dealer now
 
@tristan it was a joke regarding you turning up late :p
 
user559633
and online gambling is proof that playing reliable algorithms (and or cheating) is a winning long-term strategy
 
user559633
@JonClements oh, heh :) got it.
 
if you really wanted to turn it up you could have your robot dealer pass the turing test
 
@tristan I ignored you first time as I thought you were making another ironic comment :)
 
6:54 PM
If you play online can't you just count cards via the computer?
 
(which is apparently overrated)
 
user559633
@JonClements oh, i wasn't. i lost context because i dealt with aforementioned dumb meeting and then went to lunch.
 
sure ... sort of ... theres no guarantee though where the shuffle is or how many decks
 
user559633
or distribution of valuable cards
 
so you dont know if it was just shuffled or if its 3 decks in
or anything like that
 
6:55 PM
@Vader you could - but it'd be like playing chess/bridge online on any established site, they monitor games with chess/bridge engines to detect "more than reasonable accuracy" based on your play/experience etc...
 
for all you know its 6 decks that are reshuffled every hand
you cant really count cards online because you cant seee the shuffle
(typically)
 
user559633
@Vader sure, but if it's shuffled after each round, how do you know that it doesn't have a hook in there to not give you an ace when you're at 10 and to transpose the next card up?
 
user559633
joran and i are converging on the same point
 
I see
You don't see what actually going on
 
that is the only reason you cannot count cards online
it just doesnt work
 
user559633
6:57 PM
you're at 10, next card in queue is an Ace, i put in logic to not give you that and to swap the Ace with a 5. the card count is the same, but the outcome is different
 
in real life you can see where in the deck you are (ideally you have seen since the first card was dealt)
 
Couldn't those sites just cheat either? They could get away with it
 
user559633
exactly vader.
 
presumably there is some oversight to them (ie 48% winnings or something)
 
@Vader although, some are subject to laws and do get audited etc.... but as long as it looks "reasonable enough" - it's unlikely anyone will check
 
6:58 PM
and gaming commisioners that look into that stuff
 
Yeah, but how hard is it too lie
 
as long as they are paying out an appropriate percentage in winnings to an appropriate distribution of people
then they can get away with it sure
...but as soon as someone looks and sees discrepencies you are talking pretty major criminal penalties ... so its not really worht it to them to cheat
 
As long as the average distribution is roughly equal to the probability of the distribution... that's probably good enough
 
they make plenty without cheating
so why would they risk civil and criminal penalties to marginally increase theyre huge piles of money
it just doenst make sense
ofc they do make it harder to withdraw your money ... making it more likely you will re-invest your winnings in more play
(which is sort of cheating)
in my book
if you write your own blackjack program though you could certainly know where the cut is for that and then you could apply counting strategies very easily
 
@Joran mind you - I find that happens all the time in other places... If I buy something on card for £20 - the money's gone straight-away, I take it and want a refund, you're talking 5+ days to get it back normally
 
7:02 PM
you can even program in variations of counting strategy and just have them play like magic
and then just print out a report on the best strategy
if you really wanted you you could write it into a learning algorithm where it "solved" counting blackjack for you (likely it would report an already existing count strategy)
Ive started down that path a few times ... it gets dark and scary quickly
 
Well I gtg
rbrb all
 
oh blackjack
 
I lied
I am still here
What do you guys think of this method?
it's to check after every turn of the user can keep playing
 
heh lucky you for realizing that was not a good way to paste :P
 
:D
 
user559633
7:15 PM
it's a great day for paste. i've been huffing it all morning
 
I realized 20 lines is probably too much for the chat
also not syntax highlighting
 
ummm thats certainly going to work
you could certainly shorten it
 
how so?
while keeping it easy to read, I hope
 
start with total = sum(card.points for card in self.cards)
you dont want to really return a boolean ... you want to return the hand value
not true/false
afk a while
(15 mins)
 
I see that makes sense
 
7:22 PM
hey I have endorsements for python on linkedin, finally I'm good
 
user559633
linkedin doesn't allow fun new endorsements anymore
 
user559633
i used to endorse everyone on my list for ZUMBA/CSS
 
I made it even shorter @JoranBeasley
1531
A: Does Python have a ternary conditional operator?

Vinko VrsalovicYes, it was added in version 2.5. The syntax is: a if test else b First test is evaluated, then either a or b is returned based on the Boolean value of test; if test evaluates to True a is returned, else b is returned. For example: >>> 'true' if True else 'false' 'true' >>> 'true' if False ...

^^ how to write one line if statments
yet this is invalid?
break if total < 21
When it follow the same syntax?
adding the else block doesn't help either
break if total < 21 else pass
Ahh
Looks like I can't run code when it's true/false
only do small things
like create variables
 
7:37 PM
is there a way to do lambda: pass? A do-nothing anonymous function?
 
@Adam you after an identify function then: lambda L: L
 
Isn't sublime text NOT an IDE?
because it can't take input() for example?
 
@Vader no? What does that even mean?
 
Well IDE means interactive, but ST doesn't have a way to interact with the code, only run it
ST can't ask the user for input
 
@JonClements not exactly. I'm trying to be more clever than I am and it's not working out for me :)
Trying to build a hashmap of user_input -> function, but one of the choices I want to break out of the while True loop
I can always just catch that input before I try to call its function
 
7:47 PM
@Vader neither can PyCharm. What user input?
Interactive means highlighting and completions and error checking, that sort of stuff.
 
@Vader thats a little better its still not greate
 
There's also that ^ for running code
Debugging, I suppose
 
I think of IDEs as having debuggers tautologically.
If an IDE lacks a "step through code" tool, it's just a fancy text editor
 
@davidism
s = input("What is your name?")

print(s * 10)
won't work in ST ^^
also the debugging, yeah
@JoranBeasley well I got it 6 lines shorter ~25%
 
I'm really not getting what you're trying to say with that. How will it work in PyCharm?
Anyway the question is moot. You're wrong, Sublime can be a lightweight Python IDE.
 
7:52 PM
shorter isnt always better. ... you always want very readable code
 
@davidism Well then our definition of an IDE is different, but lets leave it at that
 
but thats a good start
 
But really, what do you expect an ide to do with that code?
 
Run it without crashing
take my input, print it ten times
 
how does it crash?
 
7:54 PM
Its just an example
EOFError: EOF when reading a line
 
SublimeREPL can run that...
 
is it running python 2 and you think its python 3
EOF error typically means you forgot a " somewhere
python 2 input is very different than python3 input
 
No I am runnig 3
 
those are all more likely reasons it crashes than it wont run
 
3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:16:31) [MSC v.1600 64 bit (AMD64)]
 
7:56 PM
so you print that at the top of your script? or you are opening a console vs running a script?
its possible your console is opening 1 python ... but the script is running another
 
running script
 
interesting
I dunno anyway I use pycharm pretty exclusively
 
@davidism Sublime REPL is a bit dangerous
it will crash ST on infinite loops
 
umm pycharm doesnt crash ... youst the running program
*just
not even that unless its recursion
while True:pass ... will just run forever in pycharm ... what does it do in sublime?
 
freezes it for me
 

« first day (1585 days earlier)      last day (3362 days later) »