Hi again Cardcounter.
The following is a "cut and paste" of a card counting
QBasic program that I helped another student with in 2005:
_________________
--------------------------------------------------------------------------------
Posted: Sun Oct 09, 2005 8:37 pm Post subject:
--------------------------------------------------------------------------------
Hi ZeroTakenaka.
Here is the latest skeleton for you to use.
You need to use REM statements to document
your Changes.
Programs like this tend to "Evolve" and it is real easy
to lose your place if you have many copies around.
This should be close to what you are trying to accomplish.
Try different ways to "Count" the Next Card Number,
like adding 2 instead of 1 or subtracting 2 instead of 1
or use a Random Number for the Card Number showing,
like:
n = RND(r) - 1 or n = RND(r) + 1
instead of
n = r - 1 or n = r + 1
You will just have to change the variable "n" in different ways
until you find a good algorithm that works closest
to providing the best number of matches.
New Program:
=======
REM: Card Counting Analysis Program
REM: Program Written:
REM: 10-09-2005 09:12 AM EDT
REM: Change Log:
REM: 10-09-2005 08:12 PM EDT Add and print Total Counts for Match / Unmatch.
REM: 10-05-2005 07:23 PM EDT Add Output File for Saved Results.
REM:
REM:
CLS
DEFINT A-Z
a = 0
b = 0
c = 0
n = 0
amatch = 0
bmatch = 0
cmatch = 0
aunmatch = 0
bunmatch = 0
cunmatch = 0
TextFileName = "C:\ZTaka01.txt"
Open TextFileName For Output As #1
RANDOMIZE TIMER
FOR x = 1 TO 10000
r = INT(RND * 13) + 1
p = n
n = r
IF r > 7 THEN n = r - 1: a = a + 1: IF p = n THEN amatch = amatch + 1
IF r = 7 THEN b = b + 1: IF p = n THEN bmatch = bmatch + 1
IF r < 7 THEN n = r + 1: c = c + 1: IF p = n THEN cmatch = cmatch + 1
Record = Record + 1
Result$ = "Record_" + Record +"Card Showing " + r + " Card Count Next Card " + n
PRINT #1,Result$
PRINT Result$
REM: Comment Now: PRINT "Card Showing "; r; " Card Count Next Card "; n
PRINT "Press any Key to continue or type x to Stop.": INPUT a$
IF a$ = "x" OR a$ = "X" THEN GOTO GameOver
a$ = ""
NEXT
GameOver:
aunmatch = a - amatch
bunmatch = b - bmatch
cunmatch = c - cmatch
PRINT
PRINT "Total number of Cards : "; x
PRINT
PRINT "Card > 7 Number of times : "; a; " Matched: "; amatch; " Unmatched: "; aunmatch
PRINT "Card = 7 Number of times : "; b; " Matched: "; bmatch; " Unmatched: "; bunmatch
PRINT "Card < 7 Number of times : "; c; " Matched: "; cmatch; " Unmatched: "; cunmatch
CLOSE
END
=======
Note - The following similar Counts are displayed at the END of program.
Total number of Cards : 101
Card > 7 Number of times : 46 Matched: 8 Unmatched: 38
Card = 7 Number of times : 9 Matched: 2 Unmatched: 7
Card < 7 Number of times : 45 Matched: 2 Unmatched: 43
=======
--------------------------------------------------------------------------------
_________________
Let me know if you have any questions.
Good Luck!