beetlebug

Skate Pond 9: Make it yours

In this step you change the game. Each change is a few lines. Make it in a copy of the game, and run the copy with ztk skatepond.tcl. Or open "The code" under the frame on the page of the game, edit it there, and the game runs again with your change.

Your own pond

Add a pond at the top of the list levels, so that it is the first pond (the code). Keep the size of 12 by 9 squares, a wall of # on the border, one S, and one F:

set levels {
    {"My Pond" 5 {
        ############
        #S....#....#
        #..........#
        #.....=....#
        #..R....#..#
        #......*...#
        #ooo.......#
        #....#..F..#
        ############
    }}
    {"First Ice" 2 {

The second word is par. When you change the rows, let the solver of step 6 find par again. Add these lines at the end of the script, and run it:

set way [gen::solve [lindex $levels 0 2] {}]
if {$way eq "none"} { puts "no way to the flag" } else { puts "$way: par [gen::moves $way]" }

It prints the moves of the shortest way and their count. For the pond above it prints right down right down left: par 5. A word bump-left is a push into a wall: it turns the skater and is no move.

Another speed

A slide lasts from 7 to 26 frames: 5 frames and 3 more for each square. Make the skater faster: change this line of push (the code):

set sk(t) 0; set sk(n) [expr {max(7, min(26, 5 + $dist * 3))}]; set sk(end) $end

to this line:

set sk(t) 0; set sk(n) [expr {max(4, min(12, 3 + $dist * 1))}]; set sk(end) $end

Then change easeOut (the code) from a cube to a square, for a softer stop: pow(1 - $t, 2).

A warm pond

The ponds made by hand and the title use theme 0, the array classic (the code). Change the ice, the snow, and the water:

array set classic {bg #2d1b0f panel #3a2414 text #fbf5ee dim #c4a98f ice #f7e4d4 ice2 #f2d8c6 crack #e4c4a9
    snow #fdf8f6 shadow #d2b49d rock #6f7d90 rock2 #9aa8ba water #663a1b red #2563eb gold #ffc93c flake #9a4a12
    thin #eacfb9 crackT #8c6a4d coat #24324a scarf #2563eb weather none}

Check your colors with the rules of step 7: the coat on the ice needs a contrast of 4.5, and the water, the flag, and the snowflakes need 3. Add this line at the end of the script to print the ratios:

foreach {k on} {coat ice water ice red ice flake ice} { puts "$k on $on: [format %.1f [contrast $classic($k) $classic($on)]]" }

Go on