2 Star 0 Fork 0

mirrors_dlbeer/cdok

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
ISC
Cdok
====

Calcudoku is a sudoku-like game invented by Tetsuya Miyamoto (marketed
under the trademarked name "KenKen"). The following is an example of a
6x6 calcudoku puzzle:

    ╔═════╦═════╦═════╦═════╦═══════════╗
    ║12+  ║4/   ║     ║     ║3*   ┊     ║
    ║     ║     ║  5  ║  2  ║     ┊     ║
    ║     ║     ║     ║     ║     ┊     ║
    ║┈┈┈┈┈║┈┈┈┈┈╠═════╩═════╬═══════════╣
    ║     ║     ║7+   ┊     ║60*  ┊     ║
    ║     ║     ║     ┊     ║     ┊     ║
    ║     ║     ║     ┊     ║     ┊     ║
    ║┈┈┈┈┈╠═════╬═══════════╩═════╗┈┈┈┈┈║
    ║     ║12+  ║28+  ┊     ┊     ║     ║
    ║     ║     ║     ┊     ┊     ║     ║
    ║     ║     ║     ┊     ┊     ║     ║
    ╠═════╣┈┈┈┈┈╠═══════════╗┈┈┈┈┈╚═════╣
    ║     ║     ║1-   ┊     ║     ┊     ║
    ║  3  ║     ║     ┊     ║     ┊     ║
    ║     ║     ║     ┊     ║     ┊     ║
    ╠═════╣┈┈┈┈┈╚═════╦═════╣┈┈┈┈┈╔═════╣
    ║     ║     ┊     ║11+  ║     ║2*   ║
    ║  4  ║     ┊     ║     ║     ║     ║
    ║     ║     ┊     ║     ║     ║     ║
    ╠═════╩═══════════╣┈┈┈┈┈╠═════╣┈┈┈┈┈║
    ║10+  ┊     ┊     ║     ║     ║     ║
    ║     ┊     ┊     ║     ║  4  ║     ║
    ║     ┊     ┊     ║     ║     ║     ║
    ╚═════════════════╩═════╩═════╩═════╝

As in sudoku, each row and each column must contain the numbers 1 to 6
once each. Some initial values may be given. There are no sub-boxes,
but groups of connected cells outlined in double-lines contain a clue
in the top-left corner (e.g. "11+"). The clue consists of a target
value and one of the characters +, -, * or /, indicating the type of
the group:

Sum: +

  ~ The numbers in this group must add to the target value.

Difference: -

  ~ One of the numbers in this group, minus the rest, must equal the
    target value (the number to be subtracted from may be any of the
    cells).

Product: *

  ~ The numbers in this group must multiply to produce the target value.

Ratio: /

  ~ One of the numbers in this group, divided by all of the others,
    must equal the target value. As in a difference group, which of
    the cells contains the number to be divided is not specified.

Numbers may be repeated within a group (so long as they're not also
repeated within a row or column). Each puzzle has a unique
solution. The solution to the example shown above is:

    ╔═════╦═════╦═════╦═════╦═══════════╗
    ║12+  ║4/   ║     ║     ║3*   ┊     ║
    ║  6  ║  4  ║  5  ║  2  ║  1  ┊  3  ║
    ║     ║     ║     ║     ║     ┊     ║
    ║┈┈┈┈┈║┈┈┈┈┈╠═════╩═════╬═══════════╣
    ║     ║     ║7+   ┊     ║60*  ┊     ║
    ║  5  ║  1  ║  4  ┊  3  ║  2  ┊  6  ║
    ║     ║     ║     ┊     ║     ┊     ║
    ║┈┈┈┈┈╠═════╬═══════════╩═════╗┈┈┈┈┈║
    ║     ║12+  ║28+  ┊     ┊     ║     ║
    ║  1  ║  2  ║  6  ┊  4  ┊  3  ║  5  ║
    ║     ║     ║     ┊     ┊     ║     ║
    ╠═════╣┈┈┈┈┈╠═══════════╗┈┈┈┈┈╚═════╣
    ║     ║     ║1-   ┊     ║     ┊     ║
    ║  3  ║  6  ║  2  ┊  1  ║  5  ┊  4  ║
    ║     ║     ║     ┊     ║     ┊     ║
    ╠═════╣┈┈┈┈┈╚═════╦═════╣┈┈┈┈┈╔═════╣
    ║     ║     ┊     ║11+  ║     ║2*   ║
    ║  4  ║  3  ┊  1  ║  5  ║  6  ║  2  ║
    ║     ║     ┊     ║     ║     ║     ║
    ╠═════╩═══════════╣┈┈┈┈┈╠═════╣┈┈┈┈┈║
    ║10+  ┊     ┊     ║     ║     ║     ║
    ║  2  ┊  5  ┊  3  ║  6  ║  4  ║  1  ║
    ║     ┊     ┊     ║     ║     ║     ║
    ╚═════════════════╩═════╩═════╩═════╝

This program, cdok, can be used to examine, print, solve and generate
these puzzles. Puzzles are parsed in a "puzzle spec" format, where
rows are given one per line, with cells separated by spaces. Groups
are labelled with alphabetic characters, which are then used to
identify cell membership. A valid puzzle spec for the example above
is:

    J+12    F/4     5       2       E*3     E
    J       F       H+7     H       I*60    I
    J       D+12    G+28    G       G       I
    3       D       K-1     K       G       G
    4       D       D       B+11    G       A*2
    C+10    C       C       B       4       A

Puzzle specs may be terminated by a blank line. Anything following the
blank line is ignored when parsing.

Installation
------------

To build cdok, type ``make``. Type ``make install`` to install the
resulting binary.

Try it out by typing ``cdok generate`` to generate a 6x6 puzzle. If
your terminal supports UTF-8, use the ``-u`` flag to draw the puzzle
using UTF-8 line-drawing characters.

Some definitions of Calcudoku require that difference and ratio groups
be limited to two cells (to avoid confusion due to the
non-associativity of subtraction and division). Cdok does not impose
this requirement in generated puzzles by default, but it will if you
use the ``-T`` option.

Type ``cdok --help`` to get a full list of options.

Copyright
---------

Copyright (C) 2012 Daniel Beer <dlbeer@gmail.com>

Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all
copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
cdok -- Calcudoku solver/generator Copyright (C) 2012 Daniel Beer <dlbeer@gmail.com> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

简介

暂无描述 展开 收起
C 等 2 种语言
ISC
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_dlbeer/cdok.git
git@gitee.com:mirrors_dlbeer/cdok.git
mirrors_dlbeer
cdok
cdok
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385