承接 davaxi/takuzu 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

davaxi/takuzu

Composer 安装命令:

composer require davaxi/takuzu

包简介

PHP Class to check and resolve step by step Takuzu grids

README 文档

README

PHP Class to check and resolve by step (with explain) Takuzu grids.

Build Status Latest Stable Version Total Downloads Latest Unstable Version License Code Climate Test Coverage Issue Count

Game

Takuzu is a logic-based number placement puzzle. The objective is to fill a (usually 10×10) grid with 1s and 0s, where there is an equal number of 1s and 0s in each row and column and no more than two of either number adjacent to each other. Additionally, there can be no identical rows or columns.

Source: Wikipédia

Solving Methods

  • Each row and each column should contain an equal number of 0s and 1s. If the required number of 0s or 1s is reached in a row or a column, the remaining cells should contain the other number. (1xx101 - 100101)

  • More than two of the same number can't be adjacent. If two adjacent cells contain the same number, the cells next to the numbers should contain the other number. (xxx00x - xx1001) If two cells contain the same number with an empty cell between, this empty cell should contain the other number because otherwise three same number appears. (x1x1xx - x101xx)

  • Each row and column is unique. (100101 1001xx - 100101 100110)

  • Eliminate impossible combinations. For example, 110xxx, the cell n°6 should contain 0 because otherwise a trio appears (110xx1 - 110001)

Installation

This page contains information about installing the Library for PHP.

Requirements

  • PHP version 5.4.0 or greater

Obtaining the client library

There are two options for obtaining the files for the client library.

Using Composer

You can install the library by adding it as a dependency to your composer.json.

  "require": {
    "davaxi/takuzu": "^1.0"
  }

Cloning from GitHub

The library is available on GitHub. You can clone it into a local repository with the git clone command.

git clone https://github.com/davaxi/Takuzu.git

What to do with the files

After obtaining the files, ensure they are available to your code. If you're using Composer, this is handled for you automatically. If not, you will need to add the autoload.php file inside the client library.

require '/path/to/takuzu/folder/autoload.php';

Examples

<?php

// ...

$grid = new \Davaxi\Takuzu\Grid();
$grid->setGridFromString(
    "1..1...0..\n" .
    "..0.1....1\n" .
    "......0.01\n" .
    "..00......\n" .
    ".....1..0.\n" .
    ".....1.1..\n" .
    "..0.0...0.\n" .
    "1.....00.0\n" .
    "..1.0.0.0.\n" .
    "0.1.1...01"
);

$resolver = new \Davaxi\Takuzu\Resolver($grid);
$resolver->resolve();

$resolvedGrid = $resolver->getResolvedGrid();

统计信息

  • 总下载量: 18
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固