Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drawcards
#1
Ascii card drawing routine and a simple deck shuffling routine. I'm using the 8x8 font set but it's in "amazing" RGB32 graphics!
Code: (Select All)
'drawcards v1
'ascii playing cards but for 32 bit graphics
'by James D. Jarvis
'use as you wish
Screen _NewImage(480, 288, 32)
_Font 8
_FullScreen
Color _RGB32(5, 5, 5), _RGB32(250, 250, 250)
_ControlChr Off
Dim Shared card$(0 To 52)
_Title "DRAWCARDS v1.0"
buildcards 'got to build the deck
Do
    shuffledeck 'shuffle the whole deck
    'just a demo of the first 21 cards laid out  after shuffling hte deck
    drawcard 0, 10, card$(1)
    drawcard 50, 10, card$(2)
    drawcard 100, 10, card$(3)
    drawcard 150, 10, card$(4)
    drawcard 200, 10, card$(5)
    drawcard 250, 10, card$(6)
    drawcard 300, 10, card$(7)

    drawcard 50, 110, card$(8)
    drawcard 80, 115, card$(9)
    drawcard 110, 120, card$(10)
    drawcard 140, 125, card$(11)
    drawcard 170, 120, card$(12)
    drawcard 200, 115, card$(13)
    drawcard 230, 110, card$(14)

    drawcard 300, 90, card$(15)
    drawcard 320, 105, card$(16)
    drawcard 340, 120, card$(17)
    drawcard 360, 135, card$(18)
    drawcard 380, 150, card$(19)
    drawcard 400, 165, card$(20)
    drawcard 420, 180, card$(21)

    _PrintString (10, 250), "Press any key to reshuffle, <esc> to quit"
    Do
        _Limit 60
        kk$ = InKey$
    Loop Until kk$ <> ""
Loop Until kk$ = Chr$(27)
Sub buildcards
    'build a deck of cards
    Dim cc$(13)
    Dim st$(4)
    cc$(1) = "A": cc$(10) = "T": cc$(11) = "J": cc$(12) = "Q": cc$(13) = "K"
    cc$(2) = "2": cc$(3) = "3": cc$(4) = "4": cc$(5) = "5": cc$(6) = "6": cc$(7) = "7": cc$(8) = "8": cc$(9) = "9"
    st$(1) = "H": st$(2) = "C": st$(3) = "S": st$(4) = "D"
    c = 0
    For ss = 1 To 4
        For rr = 1 To 13
            c = c + 1
            card$(c) = cc$(rr) + st$(ss)
        Next rr
    Next ss
End Sub

Sub shuffledeck
    'shuffle the whole deck by randomly swapping pairs of cards
    For x = 1 To 676 'this should sort the deck enoguh
        a = Int(1 + Rnd * 52)
        Do
            b = Int(1 + Rnd * 52)
        Loop Until a <> b
        Swap card$(a), card$(b)
    Next x
End Sub

Sub drawcard (cx, cy, card$)
    'draws a ascii graphics card using the 8x8 fonts
    Dim klr As _Unsigned Long
    suit$ = Mid$(card$, 2, 1)
    rank$ = Mid$(card$, 1, 1)
    st = 0
    _PrintString (cx, cy), Chr$(201) + Chr$(205) + Chr$(205) + Chr$(205) + Chr$(187)
    _PrintString (cx, cy + 8), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 16), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 24), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 32), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 40), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 48), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 56), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 64), Chr$(200) + Chr$(205) + Chr$(205) + Chr$(205) + Chr$(188)
    Select Case suit$
        Case "H"
            st = 3
            klr = _RGB32(250, 0, 0)
        Case "C"
            st = 5
            klr = _RGB32(50, 50, 50)
        Case "S"
            st = 6
            klr = _RGB32(50, 50, 50)
        Case "D"
            st = 4
            klr = _RGB32(250, 0, 0)
    End Select
    Color klr, _RGB32(250, 250, 250)
    Select EveryCase rank$
        Case "2", "3"
            _PrintString (cx + 8, cy + 8), Chr$(Asc(rank$))
            _PrintString (cx + 8, cy + 48), Chr$(st)
            _PrintString (cx + 24, cy + 16), Chr$(st)
            _PrintString (cx + 24, cy + 56), Chr$(Asc(rank$))
        Case "4", "5"
            _PrintString (cx + 8, cy + 16), Chr$(st)
            _PrintString (cx + 8, cy + 48), Chr$(st)
            _PrintString (cx + 24, cy + 16), Chr$(st)
            _PrintString (cx + 24, cy + 48), Chr$(st)
        Case "6", "7"
            _PrintString (cx + 8, cy + 16), Chr$(st)
            _PrintString (cx + 8, cy + 32), Chr$(st)
            _PrintString (cx + 8, cy + 48), Chr$(st)
            _PrintString (cx + 24, cy + 16), Chr$(st)
            _PrintString (cx + 24, cy + 32), Chr$(st)
            _PrintString (cx + 24, cy + 48), Chr$(st)
        Case "8", "9"
            _PrintString (cx + 8, cy + 16), Chr$(st)
            _PrintString (cx + 8, cy + 24), Chr$(st)
            _PrintString (cx + 8, cy + 40), Chr$(st)
            _PrintString (cx + 8, cy + 48), Chr$(st)
            _PrintString (cx + 24, cy + 16), Chr$(st)
            _PrintString (cx + 24, cy + 24), Chr$(st)
            _PrintString (cx + 24, cy + 40), Chr$(st)
            _PrintString (cx + 24, cy + 48), Chr$(st)
        Case "T"
            _PrintString (cx + 8, cy + 8), "10"
            _PrintString (cx + 8, cy + 16), Chr$(st)
            _PrintString (cx + 8, cy + 24), Chr$(st)
            _PrintString (cx + 8, cy + 32), Chr$(st)
            _PrintString (cx + 8, cy + 40), Chr$(st)
            _PrintString (cx + 8, cy + 48), Chr$(st)
            _PrintString (cx + 24, cy + 16), Chr$(st)
            _PrintString (cx + 24, cy + 24), Chr$(st)
            _PrintString (cx + 24, cy + 32), Chr$(st)
            _PrintString (cx + 24, cy + 40), Chr$(st)
            _PrintString (cx + 24, cy + 48), Chr$(st)
            _PrintString (cx + 16, cy + 56), "10"

        Case "A", "3", "5", "7", "9"
            _PrintString (cx + 16, cy + 32), Chr$(st)
        Case "J"
            _PrintString (cx + 12, cy + 26), Chr$(192) + Chr$(217)
            _PrintString (cx + 16, cy + 26), Chr$(193)

        Case "Q"
            _PrintString (cx + 8, cy + 26), Chr$(192) + Chr$(st) + Chr$(217)
            _PrintString (cx + 10, cy + 32), Chr$(40)
            _PrintString (cx + 24, cy + 32), Chr$(41)
        Case "K"
            _PrintString (cx + 16, cy + 18), Chr$(215)
            _PrintString (cx + 8, cy + 26), Chr$(200) + Chr$(202) + Chr$(188)
            _PrintString (cx + 16, cy + 38), Chr$(31)
        Case "J", "Q", "K"
            _PrintString (cx + 8, cy + 8), Chr$(Asc(rank$)) + Chr$(st)
            _PrintString (cx + 16, cy + 32), Chr$(1)
        Case "2", "3", "4", "5", "6", "7", "8", "9", "A", "J", "Q", "K"
            _PrintString (cx + 8, cy + 8), Chr$(Asc(rank$))
            _PrintString (cx + 24, cy + 56), Chr$(Asc(rank$))
    End Select
    Color _RGB32(5, 5, 5), _RGB32(250, 250, 250)
End Sub
Reply
#2
Version 2 of course.   
The only differences here are in the shuffle routine, it's a little bit quicker and slightly more robust.
Code: (Select All)
'drawcards v2
'ascii playing cards but for 32 bit graphics
'by James D. Jarvis
'use as you wish
Screen _NewImage(480, 288, 32)
_Font 8
_FullScreen
Color _RGB32(5, 5, 5), _RGB32(250, 250, 250)
_ControlChr Off
Dim Shared card$(0 To 52)
_Title "DRAWCARDS v2.0"
buildcards 'got to build the deck
Do
    shuffledeck 'shuffle the whole deck
    'just a demo of the first 21 cards laid out  after shuffling the deck
    drawcard 0, 10, card$(1)
    drawcard 50, 10, card$(2)
    drawcard 100, 10, card$(3)
    drawcard 150, 10, card$(4)
    drawcard 200, 10, card$(5)
    drawcard 250, 10, card$(6)
    drawcard 300, 10, card$(7)

    drawcard 50, 110, card$(8)
    drawcard 80, 115, card$(9)
    drawcard 110, 120, card$(10)
    drawcard 140, 125, card$(11)
    drawcard 170, 120, card$(12)
    drawcard 200, 115, card$(13)
    drawcard 230, 110, card$(14)

    drawcard 300, 90, card$(15)
    drawcard 320, 105, card$(16)
    drawcard 340, 120, card$(17)
    drawcard 360, 135, card$(18)
    drawcard 380, 150, card$(19)
    drawcard 400, 165, card$(20)
    drawcard 420, 180, card$(21)

    _PrintString (10, 250), "Press any key to reshuffle, <esc> to quit"
    Do
        _Limit 60
        kk$ = InKey$
    Loop Until kk$ <> ""
Loop Until kk$ = Chr$(27)
Sub buildcards
    'build a deck of cards
    Dim cc$(13)
    Dim st$(4)
    cc$(1) = "A": cc$(10) = "T": cc$(11) = "J": cc$(12) = "Q": cc$(13) = "K"
    cc$(2) = "2": cc$(3) = "3": cc$(4) = "4": cc$(5) = "5": cc$(6) = "6": cc$(7) = "7": cc$(8) = "8": cc$(9) = "9"
    st$(1) = "H": st$(2) = "C": st$(3) = "S": st$(4) = "D"
    c = 0
    For ss = 1 To 4
        For rr = 1 To 13
            c = c + 1
            card$(c) = cc$(rr) + st$(ss)
        Next rr
    Next ss
End Sub

Sub shuffledeck
    'shuffle the whole deck by randomly swapping pairs of cards
    sortsize = UBound(card$)
    For x = 1 To sortsize
        Do
            a = Int(1 + Rnd * sortsize)
        Loop Until a <> x 'let's make sure the cards change position
        Swap card$(x), card$(a)
    Next x
End Sub

Sub drawcard (cx, cy, card$)
    'draws a ascii graphics card using the 8x8 fonts
    Dim klr As _Unsigned Long
    suit$ = Mid$(card$, 2, 1)
    rank$ = Mid$(card$, 1, 1)
    st = 0
    _PrintString (cx, cy), Chr$(201) + Chr$(205) + Chr$(205) + Chr$(205) + Chr$(187)
    _PrintString (cx, cy + 8), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 16), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 24), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 32), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 40), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 48), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 56), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 64), Chr$(200) + Chr$(205) + Chr$(205) + Chr$(205) + Chr$(188)
    Select Case suit$
        Case "H"
            st = 3
            klr = _RGB32(250, 0, 0)
        Case "C"
            st = 5
            klr = _RGB32(50, 50, 50)
        Case "S"
            st = 6
            klr = _RGB32(50, 50, 50)
        Case "D"
            st = 4
            klr = _RGB32(250, 0, 0)
    End Select
    Color klr, _RGB32(250, 250, 250)
    Select EveryCase rank$
        Case "2", "3"
            _PrintString (cx + 8, cy + 8), Chr$(Asc(rank$))
            _PrintString (cx + 8, cy + 48), Chr$(st)
            _PrintString (cx + 24, cy + 16), Chr$(st)
            _PrintString (cx + 24, cy + 56), Chr$(Asc(rank$))
        Case "4", "5"
            _PrintString (cx + 8, cy + 16), Chr$(st)
            _PrintString (cx + 8, cy + 48), Chr$(st)
            _PrintString (cx + 24, cy + 16), Chr$(st)
            _PrintString (cx + 24, cy + 48), Chr$(st)
        Case "6", "7"
            _PrintString (cx + 8, cy + 16), Chr$(st)
            _PrintString (cx + 8, cy + 32), Chr$(st)
            _PrintString (cx + 8, cy + 48), Chr$(st)
            _PrintString (cx + 24, cy + 16), Chr$(st)
            _PrintString (cx + 24, cy + 32), Chr$(st)
            _PrintString (cx + 24, cy + 48), Chr$(st)
        Case "8", "9"
            _PrintString (cx + 8, cy + 16), Chr$(st)
            _PrintString (cx + 8, cy + 24), Chr$(st)
            _PrintString (cx + 8, cy + 40), Chr$(st)
            _PrintString (cx + 8, cy + 48), Chr$(st)
            _PrintString (cx + 24, cy + 16), Chr$(st)
            _PrintString (cx + 24, cy + 24), Chr$(st)
            _PrintString (cx + 24, cy + 40), Chr$(st)
            _PrintString (cx + 24, cy + 48), Chr$(st)
        Case "T"
            _PrintString (cx + 8, cy + 8), "10"
            _PrintString (cx + 8, cy + 16), Chr$(st)
            _PrintString (cx + 8, cy + 24), Chr$(st)
            _PrintString (cx + 8, cy + 32), Chr$(st)
            _PrintString (cx + 8, cy + 40), Chr$(st)
            _PrintString (cx + 8, cy + 48), Chr$(st)
            _PrintString (cx + 24, cy + 16), Chr$(st)
            _PrintString (cx + 24, cy + 24), Chr$(st)
            _PrintString (cx + 24, cy + 32), Chr$(st)
            _PrintString (cx + 24, cy + 40), Chr$(st)
            _PrintString (cx + 24, cy + 48), Chr$(st)
            _PrintString (cx + 16, cy + 56), "10"

        Case "A", "3", "5", "7", "9"
            _PrintString (cx + 16, cy + 32), Chr$(st)
        Case "J"
            _PrintString (cx + 12, cy + 26), Chr$(192) + Chr$(217)
            _PrintString (cx + 16, cy + 26), Chr$(193)

        Case "Q"
            _PrintString (cx + 8, cy + 26), Chr$(192) + Chr$(st) + Chr$(217)
            _PrintString (cx + 10, cy + 32), Chr$(40)
            _PrintString (cx + 24, cy + 32), Chr$(41)
        Case "K"
            _PrintString (cx + 16, cy + 18), Chr$(215)
            _PrintString (cx + 8, cy + 26), Chr$(200) + Chr$(202) + Chr$(188)
            _PrintString (cx + 16, cy + 38), Chr$(31)
        Case "J", "Q", "K"
            _PrintString (cx + 8, cy + 8), Chr$(Asc(rank$)) + Chr$(st)
            _PrintString (cx + 16, cy + 32), Chr$(1)
        Case "2", "3", "4", "5", "6", "7", "8", "9", "A", "J", "Q", "K"
            _PrintString (cx + 8, cy + 8), Chr$(Asc(rank$))
            _PrintString (cx + 24, cy + 56), Chr$(Asc(rank$))
    End Select
    Color _RGB32(5, 5, 5), _RGB32(250, 250, 250)
End Sub
Reply
#3
(06-20-2023, 02:44 PM)James D Jarvis Wrote: Version 2 of course.   
The only differences here are in the shuffle routine, it's a little bit quicker and slightly more robust.
Code: (Select All)
'drawcards v2
'ascii playing cards but for 32 bit graphics
'by James D. Jarvis
'use as you wish
Screen _NewImage(480, 288, 32)
_Font 8
_FullScreen
Color _RGB32(5, 5, 5), _RGB32(250, 250, 250)
_ControlChr Off
Dim Shared card$(0 To 52)
_Title "DRAWCARDS v1.0"
buildcards 'got to build the deck
Do
    shuffledeck 'shuffle the whole deck
    'just a demo of the first 21 cards laid out  after shuffling the deck
    drawcard 0, 10, card$(1)
    drawcard 50, 10, card$(2)
    drawcard 100, 10, card$(3)
    drawcard 150, 10, card$(4)
    drawcard 200, 10, card$(5)
    drawcard 250, 10, card$(6)
    drawcard 300, 10, card$(7)

    drawcard 50, 110, card$(8)
    drawcard 80, 115, card$(9)
    drawcard 110, 120, card$(10)
    drawcard 140, 125, card$(11)
    drawcard 170, 120, card$(12)
    drawcard 200, 115, card$(13)
    drawcard 230, 110, card$(14)

    drawcard 300, 90, card$(15)
    drawcard 320, 105, card$(16)
    drawcard 340, 120, card$(17)
    drawcard 360, 135, card$(18)
    drawcard 380, 150, card$(19)
    drawcard 400, 165, card$(20)
    drawcard 420, 180, card$(21)

    _PrintString (10, 250), "Press any key to reshuffle, <esc> to quit"
    Do
        _Limit 60
        kk$ = InKey$
    Loop Until kk$ <> ""
Loop Until kk$ = Chr$(27)
Sub buildcards
    'build a deck of cards
    Dim cc$(13)
    Dim st$(4)
    cc$(1) = "A": cc$(10) = "T": cc$(11) = "J": cc$(12) = "Q": cc$(13) = "K"
    cc$(2) = "2": cc$(3) = "3": cc$(4) = "4": cc$(5) = "5": cc$(6) = "6": cc$(7) = "7": cc$(8) = "8": cc$(9) = "9"
    st$(1) = "H": st$(2) = "C": st$(3) = "S": st$(4) = "D"
    c = 0
    For ss = 1 To 4
        For rr = 1 To 13
            c = c + 1
            card$(c) = cc$(rr) + st$(ss)
        Next rr
    Next ss
End Sub

Sub shuffledeck
    'shuffle the whole deck by randomly swapping pairs of cards
    sortsize = UBound(card$)
    For x = 1 To sortsize
        Do
            a = Int(1 + Rnd * sortsize)
        Loop Until a <> x 'let's make sure the cards change position
        Swap card$(x), card$(a)
    Next x
End Sub

Sub drawcard (cx, cy, card$)
    'draws a ascii graphics card using the 8x8 fonts
    Dim klr As _Unsigned Long
    suit$ = Mid$(card$, 2, 1)
    rank$ = Mid$(card$, 1, 1)
    st = 0
    _PrintString (cx, cy), Chr$(201) + Chr$(205) + Chr$(205) + Chr$(205) + Chr$(187)
    _PrintString (cx, cy + 8), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 16), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 24), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 32), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 40), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 48), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 56), Chr$(186) + Chr$(32) + Chr$(32) + Chr$(32) + Chr$(186)
    _PrintString (cx, cy + 64), Chr$(200) + Chr$(205) + Chr$(205) + Chr$(205) + Chr$(188)
    Select Case suit$
        Case "H"
            st = 3
            klr = _RGB32(250, 0, 0)
        Case "C"
            st = 5
            klr = _RGB32(50, 50, 50)
        Case "S"
            st = 6
            klr = _RGB32(50, 50, 50)
        Case "D"
            st = 4
            klr = _RGB32(250, 0, 0)
    End Select
    Color klr, _RGB32(250, 250, 250)
    Select EveryCase rank$
        Case "2", "3"
            _PrintString (cx + 8, cy + 8), Chr$(Asc(rank$))
            _PrintString (cx + 8, cy + 48), Chr$(st)
            _PrintString (cx + 24, cy + 16), Chr$(st)
            _PrintString (cx + 24, cy + 56), Chr$(Asc(rank$))
        Case "4", "5"
            _PrintString (cx + 8, cy + 16), Chr$(st)
            _PrintString (cx + 8, cy + 48), Chr$(st)
            _PrintString (cx + 24, cy + 16), Chr$(st)
            _PrintString (cx + 24, cy + 48), Chr$(st)
        Case "6", "7"
            _PrintString (cx + 8, cy + 16), Chr$(st)
            _PrintString (cx + 8, cy + 32), Chr$(st)
            _PrintString (cx + 8, cy + 48), Chr$(st)
            _PrintString (cx + 24, cy + 16), Chr$(st)
            _PrintString (cx + 24, cy + 32), Chr$(st)
            _PrintString (cx + 24, cy + 48), Chr$(st)
        Case "8", "9"
            _PrintString (cx + 8, cy + 16), Chr$(st)
            _PrintString (cx + 8, cy + 24), Chr$(st)
            _PrintString (cx + 8, cy + 40), Chr$(st)
            _PrintString (cx + 8, cy + 48), Chr$(st)
            _PrintString (cx + 24, cy + 16), Chr$(st)
            _PrintString (cx + 24, cy + 24), Chr$(st)
            _PrintString (cx + 24, cy + 40), Chr$(st)
            _PrintString (cx + 24, cy + 48), Chr$(st)
        Case "T"
            _PrintString (cx + 8, cy + 8), "10"
            _PrintString (cx + 8, cy + 16), Chr$(st)
            _PrintString (cx + 8, cy + 24), Chr$(st)
            _PrintString (cx + 8, cy + 32), Chr$(st)
            _PrintString (cx + 8, cy + 40), Chr$(st)
            _PrintString (cx + 8, cy + 48), Chr$(st)
            _PrintString (cx + 24, cy + 16), Chr$(st)
            _PrintString (cx + 24, cy + 24), Chr$(st)
            _PrintString (cx + 24, cy + 32), Chr$(st)
            _PrintString (cx + 24, cy + 40), Chr$(st)
            _PrintString (cx + 24, cy + 48), Chr$(st)
            _PrintString (cx + 16, cy + 56), "10"

        Case "A", "3", "5", "7", "9"
            _PrintString (cx + 16, cy + 32), Chr$(st)
        Case "J"
            _PrintString (cx + 12, cy + 26), Chr$(192) + Chr$(217)
            _PrintString (cx + 16, cy + 26), Chr$(193)

        Case "Q"
            _PrintString (cx + 8, cy + 26), Chr$(192) + Chr$(st) + Chr$(217)
            _PrintString (cx + 10, cy + 32), Chr$(40)
            _PrintString (cx + 24, cy + 32), Chr$(41)
        Case "K"
            _PrintString (cx + 16, cy + 18), Chr$(215)
            _PrintString (cx + 8, cy + 26), Chr$(200) + Chr$(202) + Chr$(188)
            _PrintString (cx + 16, cy + 38), Chr$(31)
        Case "J", "Q", "K"
            _PrintString (cx + 8, cy + 8), Chr$(Asc(rank$)) + Chr$(st)
            _PrintString (cx + 16, cy + 32), Chr$(1)
        Case "2", "3", "4", "5", "6", "7", "8", "9", "A", "J", "Q", "K"
            _PrintString (cx + 8, cy + 8), Chr$(Asc(rank$))
            _PrintString (cx + 24, cy + 56), Chr$(Asc(rank$))
    End Select
    Color _RGB32(5, 5, 5), _RGB32(250, 250, 250)
End Sub
Is the '_title' the way you want it? It don't match 1st comment. I might be mistaken.
Reply
#4
I downloaded and ran DRAWCARD. It ran great. The graphics looked good. Liked it.
Reply
#5
JDJ your second version looked pretty cool!

However I'm bothered a bit by that really long crown the king has LOL. Sort of looks like Magneto or some other Marvel Comics bad guy or deranged hero. Maybe put the crown that's on the jack on the king, and only put a face for the jack? Can't do anything about making the queen look like a lady...
Reply
#6
(06-20-2023, 06:59 PM)mnrvovrfc Wrote: JDJ your second version looked pretty cool!

However I'm bothered a bit by that really long crown the king has LOL. Sort of looks like Magneto or some other Marvel Comics bad guy or deranged hero. Maybe put the crown that's on the jack on the king, and only put a face for the jack? Can't do anything about making the queen look like a lady...

I do suppose the kings have a Kirby-like look to them. Making the queen look like a lady in ascii was a little baffling... they've go hair?
Reply
#7
(06-20-2023, 09:52 PM)James D Jarvis Wrote:
(06-20-2023, 06:59 PM)mnrvovrfc Wrote: JDJ your second version looked pretty cool!

However I'm bothered a bit by that really long crown the king has LOL. Sort of looks like Magneto or some other Marvel Comics bad guy or deranged hero. Maybe put the crown that's on the jack on the king, and only put a face for the jack? Can't do anything about making the queen look like a lady...

I do suppose the kings have a Kirby-like look to them. Making the queen look like a lady in ascii was a little baffling... they've go hair?
Interesting use of EVERYCASE. I haven't used it yet simply because I've never really thought about it's usefulness. Thanks for the demo.

Edit: By the way, does anyone know in which version of QB64 EVERYCASE was introduced? The Wiki forwards me to SELECT CASE when I search for EVERYCASE.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#8
(06-21-2023, 12:32 AM)TerryRitchie Wrote: Interesting use of EVERYCASE. I haven't used it yet simply because I've never really thought about it's usefulness. Thanks for the demo.

Edit: By the way, does anyone know in which version of QB64 EVERYCASE was introduced? The Wiki forwards me to SELECT CASE when I search for EVERYCASE.


I'm not sure exactly when EVERYCASE was implemented, but I'm pretty sure it was one of Clippy's requests and it came to be right around the end of SDL / beginning of GL.

EDIT :
From the QB64GL v1000 help files dated 02-22-2014 :
Quote:(partial)
'''SELECT CASE''' is used to determine the program flow by comparing the value of a variable to specific values.

{{PageSyntax}}
:::::SELECT CASE variable
::::::' [[CASE]]
::::::' [[CASE IS]]
::::::' [[CASE ELSE]]
:::::[[END SELECT]]



From the QB64GL v1.1 help files dated 03-18-2016 :
Quote:(partial)
'''SELECT CASE''' is used to determine the program flow by comparing the value of a variable to specific CASE values.

{{PageSyntax}}
:::'''SELECT''' [EVERY]'''CASE''' ''checkvalue''
::::[[CASE]]
::::[[CASE IS]]
::::[[CASE ELSE]]
:::'''[[END SELECT]]'''
Reply
#9
Wow, that long ago. Thank you for pointing that out. During my next program I'll keep EVERYCASE in mind and see if I can use it to my advantage.

I wanted to know the time frame because I would like to add EVERYCASE to the tutorial's SELECT CASE section and to be sure I noted the minimum version of QB64 needed.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply




Users browsing this thread: 3 Guest(s)