diff --git a/game/functions.ink b/game/functions.ink index d46546a..732e263 100644 --- a/game/functions.ink +++ b/game/functions.ink @@ -13,7 +13,9 @@ ~ return x === function lastcard(ref list) - ~ return LIST_MIN(list) + { !x: ~ return "" } + ~ temp x = LIST_MIN(list) + ~ return x === function is_clubs(x) ~ return (x == two_of_clubs || x == three_of_clubs || x == four_of_clubs || x == five_of_clubs || x == six_of_clubs || x == seven_of_clubs || x == eight_of_clubs || x == nine_of_clubs || x == ten_of_clubs || x == jack_of_clubs || x == queen_of_clubs || x == king_of_clubs || x == ace_of_clubs) @@ -60,6 +62,8 @@ === function tonumber(x) { + - x == (): + ~ return 0 - is_two(x): ~ return 2 - is_three(x): @@ -103,17 +107,30 @@ ~ return follows(x,y) } -=== function can_move_to_full(ref col) +=== function can_move_to_foundation(ref col) ~ temp x = lastcard(col) ~ temp y = "" { - is_spades(x): - ~ y = lastcard(full1) + ~ y = lastcard(foundation1) - is_diamonds(x): - ~ y = lastcard(full2) + ~ y = lastcard(foundation2) - is_clubs(x): - ~ y = lastcard(full3) + ~ y = lastcard(foundation3) - is_hearts(x): - ~ y = lastcard(full4) + ~ y = lastcard(foundation4) } ~ return follows(x,y) + +=== function can_move_to_empty(ref col, ref empty) + {col == () || empty != (): + ~ return false + } + ~ return true + +=== function can_move_to_col(ref column_one, ref column_two) + ~ temp x = lastcard(column_one) + ~ temp y = lastcard(column_two) + {!x: ~ return false} + {!y:~ return true} + ~ return (( (!is_black(x) && is_black(y)) || (is_black(x) && !is_black(y)) ) && follows(y,x) ) diff --git a/game/game.ink b/game/game.ink index 1e5c9b1..e52ffd4 100644 --- a/game/game.ink +++ b/game/game.ink @@ -14,10 +14,10 @@ VAR col8 = () VAR empty1 = () VAR empty2 = () -VAR full1 = () -VAR full2 = () -VAR full3 = () -VAR full4 = () +VAR foundation1 = () +VAR foundation2 = () +VAR foundation3 = () +VAR foundation4 = () // Put 7 random cards to slot 1 ~ col1 += randomcard(cards) @@ -87,10 +87,10 @@ VAR full4 = ()