As the world and his wife is getting in on the act, here's one from the archives (circa 2001)...
Okay, so it uses the same method as denzilwhatisface to shuffle.
The first person to guess which card game I was writing wins a chocolate santa that's had his head bitten off...
Dim deck(51) SeedRnd MilliSecs() Graphics 640, 480 setup_deck() Repeat Cls shuffle_deck() tx = 100 nc = 0 p = 0 Text 0, 100, "Card No" Text 0, 150, "Value" Text 0, 200, "Card" Text 0, 250, "Total" Repeat p = p + card_value(deck(nc)) If (p = 21) And (nc = 1) Then Text 320, 10, "P O N T O O N !", 1, 0 If (nc = 4) And (p <= 21) Then Text 320, 10, "F I V E C A R D T R I C K !", 1, 0 If p > 21 Then Text 320, 10, "B U S T !", 1, 0 Text tx, 100, deck(nc) Text tx, 150, card_value(deck(nc)) Text tx, 200, show_deck$(deck(nc)) Text tx, 250, p nc = nc + 1 tx = tx + 40 Until (p => 21) Or (nc = 5) Or (WaitKey() = 27) Until KeyDown(1) End ; Function shuffle_deck() For s=0 To 50 r = Rand(s + 1, 51) tmp = deck(s) deck(s) = deck(r) deck(r) = tmp Next End Function Function setup_deck() For c=0 To 51 deck(c) = c + 1 Next End Function Function show_deck$(cardval) suit$ = "SHCD" cardstr$ = "" c = cardval Mod 13 s = Floor((cardval - 1) / 13) Select c Case 0 cardstr$ = "A" Case 10 cardstr$ = "J" Case 11 cardstr$ = "Q" Case 12 cardstr$ = "K" Default cardstr$ = Str$(c + 1) End Select cardstr$ = cardstr$ + Mid$(suit$, s + 1, 1) Return cardstr$ End Function Function card_value(cardval) cv = (cardval Mod 13) + 1 If cv > 10 Then cv = 10 Return cv End Function
Okay, so it uses the same method as denzilwhatisface to shuffle.
The first person to guess which card game I was writing wins a chocolate santa that's had his head bitten off...