{"size": 3981, "ext": "scrbl", "max_stars_repo_path": "scribblings/same.scrbl", "max_stars_repo_name": "samth/games", "max_stars_repo_stars_event_min_datetime": "2015-01-13T15:10:10.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-17T14:43:11.000Z", "max_issues_repo_path": "scribblings/same.scrbl", "max_issues_repo_name": "samth/games", "max_issues_repo_issues_event_min_datetime": "2017-08-25T20:26:37.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T17:48:40.000Z", "max_forks_repo_path": "scribblings/same.scrbl", "max_forks_repo_name": "samth/games", "max_forks_repo_forks_event_min_datetime": "2015-03-13T22:19:54.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-28T21:04:36.000Z"}
{"max_stars_count": 48, "max_issues_count": 15, "max_forks_count": 29, "avg_line_length": 31.1015625, "max_line_length": 100, "alphanum_fraction": 0.6588796785}
#lang scribble/doc
@(require "common.rkt" racket/class racket/draw (only-in pict dc)
          "../same/same-lib.rkt")

@(define board-width 6)
@(define board-height 6)
@(define scale-factor 24)
@(define (render-board board)
   (define w (ceiling (* board-width scale-factor)))
   (define h (ceiling (* board-height scale-factor)))
   (dc
    (λ (dc dx dy)
      (define-values (ox oy) (send dc get-origin))
      (define pen (send dc get-pen))
      (define brush (send dc get-brush))
      (define-values (scale-x scale-y) (send dc get-scale))
      (send dc set-origin (+ ox dx) (+ oy dy))
      (draw-board dc board-width board-height board w h
                  #f #f #f #f)
      (send dc set-origin ox oy)
      (send dc set-pen pen)
      (send dc set-brush brush)
      (send dc set-scale scale-x scale-y))
    w h))

@(define (copy-board board)
   (let loop ([board board])
     (cond
       [(vector? board)
        (list->vector (map loop (vector->list board)))]
       [else board])))



@gametitle["Same" "same" "Dot-Removing Game"]

The object of @game{Same} is to score points by removing blobs from the
board. 

@section{The Rules}

To remove a blob, click on it.  As long the blob is not just
a simple circle, it will disappear.  After the blob disappears,
the remaining pieces of the board shift around, breaking up blobs into
new blobs as pieces of the old blobs fall down to fill in the empty space.
If an entire column is wiped out, all of the blobs from the
right will slide left to take up the empty column's space.

As an example, imagine a board looked like this:
@(define board1 
   (build-vector
    board-width
    (lambda (i)
      (build-vector
       board-height
       (lambda (j)
         (vector
          (cond
            [(and (= i 4) (member j '(3 4 5)))
             3]
            [(and (= i 4) (member j '(1 2)))
             4]
            [(and (member i '(3 5)) (= j 5))
             2]
            [else
             (modulo (+ i j) 2)])
          #f))))))

@(render-board board1)

There are two places where we can click, on the green blob or on the purple one.
Clicking on the green one results in this board:

@(define board2 
   (let ([b (copy-board board1)])
     (make-a-move 4 3 b board-width board-height)
     b))

@(render-board board2)

Notice the new horizontal blue blob that has appeared. That appears because
the blue ball falls down into the vacated space and joins into the two adjacent
blue balls.

Next, if we ignore that new blue blob and click the purple one, we get this board:

@(define board3
   (let ([b (copy-board board2)])
     (make-a-move 4 5 b board-width board-height)
     b))

@(render-board board3)

The blue circle has continued falling, which breaks up our blue blob and no new
one appears because the blue circle is now next to brown circles.

If, however, we had clicked on blue blob before clicking on the purple one, we would get this board:

@(define board4
   (let ([b (copy-board board2)])
     (make-a-move 4 3 b board-width board-height)
     b))

@(render-board board4)

and then clicking the purple one would produce this board:

@(define board5
   (let ([b (copy-board board4)])
     (make-a-move 4 5 b board-width board-height)
     b))
@(render-board board5)

Note that the purple blob was the only blob in its column, so clicking on it shifts
all of the columns to the right over to eliminate the empty space.

@section{Scoring}
Your score increases for each ball removed from the board, in two ways.
First, when you remove a blob, you get as many points as the square of the number
of cells the blob occupied, so removing bigger blobs is better. Second, if there
are fewer than 50 cells occupied on the board, you get a bonus.
Specifically if you have 49 cells left, you
get a 100 point bonus, 48 cells left yields a 200 point bonus, 
47 cells a 300 point bonus etc., and if there
are no cells left, you get a 5000 point bonus.

Click the @onscreen{New Game} button to play again.
