Uno (Card Game)/Julia: Difference between revisions
m
→{{header|Julia}}
m (const globals) |
|||
Line 18:
""" The Uno card type. The first field is color, second field is number or command. """
color(c::UnoCard) = first(c)
type(c::UnoCard) = last(c)
Line 335:
"Green" => colorant"green", "Blue" => colorant"blue", "Wild" => colorant"black")
""" CSS style button for bold colored text """
function colorbutton(txt::String, clr::String)
button = GtkButton(txt)
Line 465 ⟶ 466:
hand = first(game.players).hand
isempty(hand) && return
nrow = (length(hand) + 15) ÷
for row in 1:nrow
cards = hand[(row - 1) *
startx, starty = 40 + (
for (i, card) in enumerate(cards)
idx, x0 = (row - 1) *
cardpositions[idx] = [x0, starty, x0 + 40, starty + 80]
cairocard(ctx, card, x0, starty, 40, 80)
|