LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-25-2017, 04:31 PM   #46
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Original Poster
Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148

Quote:
Originally Posted by Laserbeak View Post
Oh there are public domain card images available.
https://github.com/hayeah/playing-cards-assets

png and svg 2 sets of 52 plus jokers git hub

https://github.com/hayeah/playing-cards-assets
 
1 members found this post helpful.
Old 04-25-2017, 04:42 PM   #47
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
Quote:
Originally Posted by BW-userx View Post
Thanks. I think they're more, but any would do at least for testing. If I were to actually post an application on the Apple Appstore, I could always replace them with a commercial version if it is affordable and looks much better.
 
Old 04-25-2017, 04:48 PM   #48
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
Quote:
Originally Posted by BW-userx View Post
that is like do not get caught in a casino doing that.
Depends where it is. In Atlantic City they can not throw you out for counting cards, as long as you're just using your mind, not any type of hidden device.

In Las Vegas, they can throw you out and ban you from ever playing blackjack there again.

I've read several books on it, and I just don't have the concentration to actually do it while playing a casino, I just want to drink and have fun!

Professional players don't drink or just sip on a light beer or something and rarely go to the same casino often, and if they win a lot, they usually get out fast before they garner attention.

Last edited by Laserbeak; 04-25-2017 at 05:29 PM.
 
Old 04-25-2017, 05:07 PM   #49
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Original Poster
Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
Quote:
Originally Posted by Laserbeak View Post
Depends were it is. In Atlantic City they can not throw you out for counting cards, as long as you're just using your mind, not any type of hidden device.

In Las Vegas, they can throw you out and ban you from ever playing blackjack there again.

I've read several books on it, and I just don't have the concentration to actually do it while playing a casino, I just want to drink and have fun!

Professional players don't drink or just sip on a light beer or something and rarely go to the same casino often, and if they win a lot, they usually get out fast before they garner attention.
exactly - that too is why they now use more then one deck of cards now.
using one own mind it makes it harder to prove. BUT that casino - if it cannot figure out how someone is winning a lot and all of the time (taking their profits) then they can call "counting cards" and kick you out. Logically speaking of course. because what else can the accuse one of? luck has noting to do with it.
 
Old 04-25-2017, 05:08 PM   #50
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Original Poster
Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
Quote:
Originally Posted by Laserbeak View Post
Thanks. I think they're more, but any would do at least for testing. If I were to actually post an application on the Apple Appstore, I could always replace them with a commercial version if it is affordable and looks much better.
yep. shouldn't be that hard to replace the images when it is all done and working properly.
 
Old 04-25-2017, 05:17 PM   #51
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
Quote:
Originally Posted by BW-userx View Post
exactly - that too is why they now use more then one deck of cards now.
using one own mind it makes it harder to prove. BUT that casino - if it cannot figure out how someone is winning a lot and all of the time (taking their profits) then they can call "counting cards" and kick you out. Logically speaking of course. because what else can the accuse one of? luck has noting to do with it.
The people watching the tables from the cameras know how to count cards themselves, so they know the difference between a card counter and a lucky drunk!
 
Old 04-25-2017, 05:32 PM   #52
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
Just to be clear, my program is just to practice the game and it will give you hints on what to do so you can learn. It is not meant to, or able to, help you illegally count cards in an actual game in a casino.
 
Old 04-25-2017, 05:38 PM   #53
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
The key is how to adjust your bet. Card counters bet heavily when the shoe's count is in their favor while throttling down to the minimum bet when it is unfavorable. That's how they can tell.

If you're betting a constant amount or seemingly randomly, then you're not counting cards.
 
Old 04-25-2017, 05:43 PM   #54
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Original Poster
Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
in programs I'd think that it would develop a pattern eventually that one if watching it in how it does things if played long enough should see because random is not random using RANDOM seed. etc. But to use a card game to learn how to count cards, I never thought of that until now. all because of you! you have corrupted my mind. lol
 
Old 04-25-2017, 05:48 PM   #55
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
Quote:
Originally Posted by BW-userx View Post
in programs I'd think that it would develop a pattern eventually that one if watching it in how it does things if played long enough should see because random is not random using RANDOM seed. etc. But to use a card game to learn how to count cards, I never thought of that until now. all because of you! you have corrupted my mind. lol
LOL

This actually shuffles the shoe in my code (borrowed from someone else on the Internet):

Code:
- (void)shuffle
{
    NSUInteger count = [self count];
    if (count <= 1) return;
    for (NSUInteger i = 0; i < count - 1; ++i) {
        NSInteger remainingCount = count - i;
        NSInteger exchangeIndex = i + arc4random_uniform((u_int32_t )remainingCount);
        [self exchangeObjectAtIndex:i withObjectAtIndex:exchangeIndex];
    }
}
It is Objective-C but shouldn't be too difficult for anyone to read.
 
Old 04-25-2017, 06:12 PM   #56
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Original Poster
Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
Quote:
Originally Posted by Laserbeak View Post
LOL

This actually shuffles the shoe in my code (borrowed from someone else on the Internet):

Code:
- (void)shuffle
{
    NSUInteger count = [self count];
    if (count <= 1) return;
    for (NSUInteger i = 0; i < count - 1; ++i) {
        NSInteger remainingCount = count - i;
        NSInteger exchangeIndex = i + arc4random_uniform((u_int32_t )remainingCount);
        [self exchangeObjectAtIndex:i withObjectAtIndex:exchangeIndex];
    }
}
It is Objective-C but shouldn't be too difficult for anyone to read.

returns pseudo-random pseudorandom-random numbers

pseudo being the key word -

arc4random_uniform being the developed one that gives a larger range to select as an output, therefore the chances of repeated same numbers is not lessened but rather extended before it happens again.

therefore increasing the chances of it not happening again until the mathematical equation used has the same values again.

4 can only be randomized so many way before the same numbers keep showing up.

using an algorithm for random numbers - increase the max number increases the changes of not getting the same number twice for a longer period of time.

it is because the "random" number is gotten form a mathematical algorithm it is therefore not random and a pattern arises.

Last edited by BW-userx; 04-25-2017 at 07:18 PM.
 
Old 04-25-2017, 06:42 PM   #57
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
Quote:
Originally Posted by BW-userx View Post
returns pseudo-random pseudorandom-random numbers

pseudo being the key word -
Yes, but the implementation also collects truly random information from the keystrokes, mouse movements (or touch movements on an iPhone). According to Apple it's the best thing to use on their systems and is constantly updated as new technology makes it able to make the output even more random.

The man page is here (look at History section):

Code:
ARC4RANDOM(3)            BSD Library Functions Manual            ARC4RANDOM(3)

NAME
     arc4random, arc4random_buf, arc4random_uniform -- random number generator

SYNOPSIS
     #include <stdlib.h>

     uint32_t
     arc4random(void);

     void
     arc4random_buf(void *buf, size_t nbytes);

     uint32_t
     arc4random_uniform(uint32_t upper_bound);

DESCRIPTION
     These functions use a cryptographic pseudo-random number generator to generate high quality
     random bytes very quickly.  One data pool is used for all consumers in a process, so that con-
     sumption under program flow can act as additional stirring.  The subsystem is re-seeded from
     the kernel random number subsystem on a regular basis, and also upon fork(2).

     This family of functions provides higher quality random data than those described in rand(3),
     random(3), and rand48(3).  They can be called in almost environments, including chroot(2) and
     their use is encouraged over all other standard library functions for random numbers.

     arc4random() returns a single 32-bit value.

     arc4random_buf() fills the region buf of length nbytes with random data.

     arc4random_uniform() will return a single 32-bit value, uniformly distributed but less than
     upper_bound.  This is recommended over constructions like ``arc4random() % upper_bound'' as it
     avoids "modulo bias" when the upper bound is not a power of two.  In the worst case, this
     function may require multiple iterations to ensure uniformity.

RETURN VALUES
     These functions are always successful, and no return value is reserved to indicate an error.

SEE ALSO
     rand(3), rand48(3), random(3), random(4)

HISTORY
     The original version of this random number generator used the RC4 (also known as ARC4) algo-
     rithm.  In OS X 10.12 it was replaced with the NIST-approved AES cipher, and it may be
     replaced again in the future as cryptographic techniques advance.  A good mnemonic is ``A
     Replacement Call for Random''.

BSD                              July 30, 2015                             BSD
 
Old 04-25-2017, 07:18 PM   #58
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Original Poster
Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
Quote:
Originally Posted by Laserbeak View Post
Yes, but the implementation also collects truly random information from the keystrokes, mouse movements (or touch movements on an iPhone). According to Apple it's the best thing to use on their systems and is constantly updated as new technology makes it able to make the output even more random.

The man page is here (look at History section):
yeah I read that already googled that function call to random. where is it stated keyboard etc used to collect -- interesting as it is.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] argc and argv confusion atlantis43 Programming 4 09-28-2013 10:42 AM
C programming linux copying argv to wchar_t argv babbab Programming 1 08-09-2012 05:32 AM
[SOLVED] why char *argv[] declaration is ok in main arg, but not in body? hppyhjh Programming 5 09-13-2010 08:36 PM
main(int argc, char **argv) Longinus Programming 4 06-12-2004 07:22 AM
argc argv linuxanswer Programming 8 10-25-2003 07:54 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration