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 = ()
<>
{empty1}
<>
{empty2}
<> -
{full1}
<> -
{full2}
<> -
{full3}
<> -
{full4}
<> +
{foundation1}
<> +
{foundation2}
<> +
{foundation3}
<> +
{foundation4}
<>
{col1}
<>
{col2}
<>
{col3}
<> @@ -101,12 +101,11 @@ VAR full4 = ()
{col8}
<>
-+ {empty1 == () && col1 != ()} Move {lastcard(col1)} from col1 to empty1 - -> move_from_col1_to_empty1 -+ {empty2 == () && col1 != ()} Move {lastcard(col1)} from col1 to empty2 - -> move_from_col1_to_empty2 - --> END ++ {can_move_to_empty(col1, empty1)} [Move {lastcard(col1)} to empty space] -> move_from_col1_to_empty1 ++ {empty1 != () && can_move_to_empty(col1, empty2)} [Move {lastcard(col1)} to empty space] -> move_from_col1_to_empty2 ++ {can_move_to_col(empty1, col1)} [Move {lastcard(empty1)} to col1] -> move_from_empty1_to_col1 ++ {can_move_to_col(empty2, col1)} [Move {lastcard(empty2)} to col1] -> move_from_empty2_to_col1 ++ -> END === move_from_col1_to_empty1 @@ -119,3 +118,15 @@ VAR full4 = () ~ empty2 += pop(col1) -> main + +=== move_from_empty1_to_col1 + +~ col1 += pop(empty1) + +-> main + +=== move_from_empty2_to_col1 + +~ col1 += pop(empty2) + +-> main diff --git a/scss/style.scss b/scss/style.scss index 02a15ad..55e07bd 100644 --- a/scss/style.scss +++ b/scss/style.scss @@ -270,7 +270,7 @@ body { } } @for $i from 1 through 4 { - #full#{$i} { + #foundation#{$i} { right: ($card_width * ($i - 1) + ($gutter / 2)); } }