NaaLaa
Card Suit Symbols - Printable Version

+- NaaLaa (https://www.naalaa.com/forum)
+-- Forum: NaaLaa (https://www.naalaa.com/forum/forum-1.html)
+--- Forum: NaaLaa 7 Questions (https://www.naalaa.com/forum/forum-3.html)
+--- Thread: Card Suit Symbols (/thread-381.html)



Card Suit Symbols - 1micha.elok - 04-11-2026

   

I’ve noticed an interesting quirk in my application: the card suit symbols (♥, ♦, ♣, ♠) render perfectly in the console, but they appear as empty spaces when running in windowed mode. Is there a way to correctly display these symbols using the chr() function for a windowed environment ?

Code:
'--------------
' CONSOLE MODE
'--------------
randomize time()

values = ["A ", "2 ", "3 ", "4 ", "5 ", "6 ", "7 ", "8 ", "9 ", "10", "J ", "Q ", "K "]

v = values[rnd(0,12)]
s = rnd(3,6)            'ASCII code 3=heart, 4=diamond, 5=club,  6=spade
card(5,4,v,s)
   
pln chr(7) 'bell sound
wait 1000


'--------------
' WINDOW MODE
'--------------
set window "cards",300,300,false

do 
    wln "My card is the "+v+" of "+chr(s)
    'ASCII code 3=heart, 4=diamond, 5=club,  6=spade
   
    do;wait 1;until keydown(KEY_ESCAPE,true)
    end
loop


'----------
' FUNCTION
'----------
function card(w,h,value,suit)
    'top border
    write chr(218) ; for i = 1 to w write chr(196) ; wln chr(191)
   
    'vertical border
    write chr(179)+value ; for i = 3 to w write chr(32) ; wln chr(179)
    for i = 1 to h-2
        write chr(179) ; for j = 1 to w write chr(32); wln chr(179)
    next
    write chr(179); for i = 1 to w-2 write chr(32) ; write chr(suit)+chr(32);wln chr(179)
   
    'bottom border         
    write chr(192); for i = 1 to w write chr(196) ; wln chr(217)
endfunc



RE: Card Suit Symbols - Marcus - 04-11-2026

(04-11-2026, 07:27 AM)1micha.elok Wrote: I’ve noticed an interesting quirk in my application: the card suit symbols (♥, ♦, ♣, ♠) render perfectly in the console, but they appear as empty spaces when running in windowed mode. Is there a way to correctly display these symbols using the chr() function for a windowed environment ?

Code:
'--------------
' CONSOLE MODE
'--------------
randomize time()

values = ["A ", "2 ", "3 ", "4 ", "5 ", "6 ", "7 ", "8 ", "9 ", "10", "J ", "Q ", "K "]

v = values[rnd(0,12)]
s = rnd(3,6)            'ASCII code 3=heart, 4=diamond, 5=club,  6=spade
card(5,4,v,s)
   
pln chr(7) 'bell sound
wait 1000


'--------------
' WINDOW MODE
'--------------
set window "cards",300,300,false

do 
    wln "My card is the "+v+" of "+chr(s)
    'ASCII code 3=heart, 4=diamond, 5=club,  6=spade
   
    do;wait 1;until keydown(KEY_ESCAPE,true)
    end
loop


'----------
' FUNCTION
'----------
function card(w,h,value,suit)
    'top border
    write chr(218) ; for i = 1 to w write chr(196) ; wln chr(191)
   
    'vertical border
    write chr(179)+value ; for i = 3 to w write chr(32) ; wln chr(179)
    for i = 1 to h-2
        write chr(179) ; for j = 1 to w write chr(32); wln chr(179)
    next
    write chr(179); for i = 1 to w-2 write chr(32) ; write chr(suit)+chr(32);wln chr(179)
   
    'bottom border         
    write chr(192); for i = 1 to w write chr(196) ; wln chr(217)
endfunc

No, sorry, naalaa only supports ascii.


RE: Card Suit Symbols - 1micha.elok - 04-15-2026

Here it is the Blackjack (ASCII Edition) 
https://www.naalaa.com/forum/thread-385-post-2600.html#pid2600


RE: Card Suit Symbols - kevin - 04-15-2026

Very good - it's nice to see some console games. Thanks for sharing.....


RE: Card Suit Symbols - johnno56 - 04-15-2026

Ahh... Gotta love the old ASCII games... Memories...