Skip to the content

Kazu数

Generate checked Sudoku and logic puzzles, read native rules and hints, and draw or embed playable boards.

Kazu is the Japanese word 数 for number. About the name

Contents

Reference · Ripple Effect rules

toggleRippleNotefunction

Apply the requested native Ripple entry or mark to a new immutable game; invalid or fixed targets stay unchanged.

Import it

import { toggleRippleNote } from "@johnmorrisdotca/kazu/ripple";

Also exported from: @johnmorrisdotca/kazu

Definition

function toggleRippleNote(game: RippleGame, cell: number, value: number): RippleGame

Parameters

NameTypeDescription
gameRippleGame

The current immutable game state.

cellnumber

A zero-based row-major cell index.

valuenumber

A candidate board, digit, mark or encoded game specified by this signature.

Returns

RippleGame

Apply the requested native Ripple entry or mark to a new immutable game; invalid or fixed targets stay unchanged.

Examples

import type { RippleBoard } from "@johnmorrisdotca/kazu/ripple";
import { newRipple, toggleRippleNote } from "@johnmorrisdotca/kazu/ripple";

const rippleBoard: RippleBoard = {"width":9,"height":9,"rooms":[0,0,0,1,1,1,2,2,2,0,0,0,1,1,1,2,2,2,0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,3,3,3,4,4,4,5,5,5,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,6,6,6,7,7,7,8,8,8,6,6,6,7,7,7,8,8,8],"clues":[4,null,7,9,2,null,5,null,3,null,null,3,6,7,4,8,9,2,8,null,2,1,3,null,null,null,null,7,null,1,null,6,null,null,null,9,3,8,null,5,1,7,null,null,6,2,4,6,null,9,3,7,5,1,1,null,8,null,5,null,9,2,4,null,2,null,null,null,null,null,null,null,6,null,null,2,4,null,null,3,null]};
const rippleGame = newRipple(rippleBoard);
console.log(toggleRippleNote(rippleGame,0,1));
{
  board: {
    width: 9,
    height: 9,
    rooms: [
      0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0,
      1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1,
      2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5,
      3, 3, 3, 4, 4, 4, 5, 5, 5, 3, 3, 3,
      4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7,
      8, 8, 8, 6, 6, 6, 7, 7, 7, 8, 8, 8,
      6, 6, 6, 7, 7, 7, 8, 8, 8
    ],
    clues: [
      4,    null, 7,    9,    2,    null, 5,    null, 3,    null, null,
      3,    6,    7,    4,    8,    9,    2,    8,    null, 2,    1,
      3,    null, null, null, null, 7,    null, 1,    null, 6,    null,
      null, null, 9,    3,    8,    null, 5,    1,    7,    null, null,
      6,    2,    4,    6,    null, 9,    3,    7,    5,    1,    1,
      null, 8,    null, 5,    null, 9,    2,    4,    null, 2,    null,
      null, null, null, null, null, null, 6,    null, null, 2,    4,
      null, null, 3,    null
    ]
  },
  values: [
    4, 0, 7, 9, 2, 0, 5, 0, 3, 0, 0, 3,
    6, 7, 4, 8, 9, 2, 8, 0, 2, 1, 3, 0,
    0, 0, 0, 7, 0, 1, 0, 6, 0, 0, 0, 9,
    3, 8, 0, 5, 1, 7, 0, 0, 6, 2, 4, 6,
    0, 9, 3, 7, 5, 1, 1, 0, 8, 0, 5, 0,
    9, 2, 4, 0, 2, 0, 0, 0, 0, 0, 0, 0,
    6, 0, 0, 2, 4, 0, 0, 3, 0
  ],
  notes: [
    [], [], [], [], [], [], [], [], [], [], [], [],
    [], [], [], [], [], [], [], [], [], [], [], [],
    [], [], [], [], [], [], [], [], [], [], [], [],
    [], [], [], [], [], [], [], [], [], [], [], [],
    [], [], [], [], [], [], [], [], [], [], [], [],
    [], [], [], [], [], [], [], [], [], [], [], [],
    [], [], [], [], [], [], [], [], []
  ],
  history: [],
  helped: false
}

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kazu 2.1.0.