承接 balsama/skyscrapers 相关项目开发

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

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

balsama/skyscrapers

Composer 安装命令:

composer require balsama/skyscrapers

包简介

A little helper for solving NYTimes Skyscraper puzzles.

README 文档

README

Build Status

Skyscrapers

A php class to help you solve the Skyscrapers puzzles from NY Times Magazine.

Usage

Basic

$view = new View();

// There are four buildings per view, for a total of 24 purmutations.
$view->setBlocks(4);

// Only show permutations in which exactly three Skyscrapers are visible.
$view->setDesiredVisible(3);

// Only show permutuations where the fourth Skyscraper is of height 4
$view->addConstraint(4, "==", 4);

// Also, only show permutations where the second is greater than 1
$view->addConstraint(2, ">", 1);

// And the first is not 2
$view->addConstraint(1, "!=", 2);

// Get the solutions
$possibleSolutions = $view->getSolutions();

Description

A View is what one would see if standing at the end of a row or column on the puzzle-board. Instatiate a View:

$view = new View();

The number of total Skyscrapers in a view is set by the blocks() method. By default, there are three blocks in a view. The puzzles in NYTimes have been either 4 or 5 blocks long. To change the number of blocks:

$view->setBlocks($number_of_blocks);

The NYTimes puzzle provides the number of Skyscrapers visible for certain views. To set that number for the view, you can use the setDesiredVisible() method. By default it is 3. To change the desired number visible:

$view->setDesiredVisible($number_visible);

As you solve the puzzle, you'll come across situations where you know that certain blocks will hold a skyscraper of a certain height (or below or above a certain height). Constraints can be chained - that is, you can define more than one constraint without affecting previously defined constraints. To make the class aware of these, you can add a constraint. The addConstraint() method takes three arguments:

  • Position: The position of the block in the view (1 is closest).
  • Operator: The relationship of the building to the value (available operators:
    • greater than (">")
    • less than ("<")
    • equals ("==")
  • Value: The value to use for comparison.

The following constrains the results to those which have a Skyscraper in the third block with a height of three:

$view->setConstraint(3, "==", 3);

Once you have the blocks, desired visible, and any constraints set, you can get the results with:

$view->getSolutions();

balsama/skyscrapers 适用场景与选型建议

balsama/skyscrapers 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 09 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 balsama/skyscrapers 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 balsama/skyscrapers 我们能提供哪些服务?
定制开发 / 二次开发

基于 balsama/skyscrapers 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

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