1#lang scribble/doc 2@(require "common.rkt" racket/class racket/draw (only-in pict dc) 3 "../same/same-lib.rkt") 4 5@(define board-width 6) 6@(define board-height 6) 7@(define scale-factor 24) 8@(define (render-board board) 9 (define w (ceiling (* board-width scale-factor))) 10 (define h (ceiling (* board-height scale-factor))) 11 (dc 12 (λ (dc dx dy) 13 (define-values (ox oy) (send dc get-origin)) 14 (define pen (send dc get-pen)) 15 (define brush (send dc get-brush)) 16 (define-values (scale-x scale-y) (send dc get-scale)) 17 (send dc set-origin (+ ox dx) (+ oy dy)) 18 (draw-board dc board-width board-height board w h 19 #f #f #f #f) 20 (send dc set-origin ox oy) 21 (send dc set-pen pen) 22 (send dc set-brush brush) 23 (send dc set-scale scale-x scale-y)) 24 w h)) 25 26@(define (copy-board board) 27 (let loop ([board board]) 28 (cond 29 [(vector? board) 30 (list->vector (map loop (vector->list board)))] 31 [else board]))) 32 33 34 35@gametitle["Same" "same" "Dot-Removing Game"] 36 37The object of @game{Same} is to score points by removing blobs from the 38board. 39 40@section{The Rules} 41 42To remove a blob, click on it. As long the blob is not just 43a simple circle, it will disappear. After the blob disappears, 44the remaining pieces of the board shift around, breaking up blobs into 45new blobs as pieces of the old blobs fall down to fill in the empty space. 46If an entire column is wiped out, all of the blobs from the 47right will slide left to take up the empty column's space. 48 49As an example, imagine a board looked like this: 50@(define board1 51 (build-vector 52 board-width 53 (lambda (i) 54 (build-vector 55 board-height 56 (lambda (j) 57 (vector 58 (cond 59 [(and (= i 4) (member j '(3 4 5))) 60 3] 61 [(and (= i 4) (member j '(1 2))) 62 4] 63 [(and (member i '(3 5)) (= j 5)) 64 2] 65 [else 66 (modulo (+ i j) 2)]) 67 #f)))))) 68 69@(render-board board1) 70 71There are two places where we can click, on the green blob or on the purple one. 72Clicking on the green one results in this board: 73 74@(define board2 75 (let ([b (copy-board board1)]) 76 (make-a-move 4 3 b board-width board-height) 77 b)) 78 79@(render-board board2) 80 81Notice the new horizontal blue blob that has appeared. That appears because 82the blue ball falls down into the vacated space and joins into the two adjacent 83blue balls. 84 85Next, if we ignore that new blue blob and click the purple one, we get this board: 86 87@(define board3 88 (let ([b (copy-board board2)]) 89 (make-a-move 4 5 b board-width board-height) 90 b)) 91 92@(render-board board3) 93 94The blue circle has continued falling, which breaks up our blue blob and no new 95one appears because the blue circle is now next to brown circles. 96 97If, however, we had clicked on blue blob before clicking on the purple one, we would get this board: 98 99@(define board4 100 (let ([b (copy-board board2)]) 101 (make-a-move 4 3 b board-width board-height) 102 b)) 103 104@(render-board board4) 105 106and then clicking the purple one would produce this board: 107 108@(define board5 109 (let ([b (copy-board board4)]) 110 (make-a-move 4 5 b board-width board-height) 111 b)) 112@(render-board board5) 113 114Note that the purple blob was the only blob in its column, so clicking on it shifts 115all of the columns to the right over to eliminate the empty space. 116 117@section{Scoring} 118Your score increases for each ball removed from the board, in two ways. 119First, when you remove a blob, you get as many points as the square of the number 120of cells the blob occupied, so removing bigger blobs is better. Second, if there 121are fewer than 50 cells occupied on the board, you get a bonus. 122Specifically if you have 49 cells left, you 123get a 100 point bonus, 48 cells left yields a 200 point bonus, 12447 cells a 300 point bonus etc., and if there 125are no cells left, you get a 5000 point bonus. 126 127Click the @onscreen{New Game} button to play again. 128