View/Edit #5730:draw_hand

Switch to edit mode.

Name(s): draw_hand
1:  {cards} = args
2:  cws = $list_utils:map_arg($string_utils, "words", cards)
3:  tens = 0
4:  for x in (cws)
5:    tens = tens + (x[1] == "Ten")
6:  endfor
7:  pic = $ascii_utils:new_picture(length(cards) * 3 + 4, 6)
8:  x = 1
9:  for cw in (cws)
10:   if (cw == {"hidden"})
11:     val = 0
12:     card = $ascii_utils.card_back
13:   else
14:     suit = cw[3][1]
15:     val = cw[1] in {"Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"}
16:     card = $ascii_utils:draw_card(val, suit)
17:   endif
18:   pic = $ascii_utils:superimpose(pic, card, x, 1)
19:   x = x + 2 + (val == 10)
20: endfor
21: return pic

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: manta (#7165)

You are not logged in.

[home | help | who | search | setup | code]