BoardGameManager
BoardGameManager 是一个 cocoa pod,可帮助在 iOS 游戏板上进行计分、转换和遍历。它提供了游戏板路径上节点之间的方向和角度,可用于计分(越奇怪的角度,得分越高)。它具有螺旋遍历和多种翻转和旋转转换。
要求
- Swift 5
- iOS 12 及以上
安装
BoardGameManager 可在 CocoaPods 上使用。
将以下行添加到您的 Podfile。
pod 'BoardGameManager'
运行 pod install。
使用方法
创建棋盘
let board = Board(height: 5, width: 3, rule: .orthogonalAndDiagonal)方法列表
areNeighbours(first : (a: Int, b: Int), second : (a: Int, b: Int)) -> Bool?createAndSetRandomString (from set: [Character]? = nil) -> StringcreateAndSetRandomStringUsingLetterFrequency() -> StringisValidIndex(_ indices : (Int, Int)...) -> BoolgetAngle(first: (x: Int, y: Int), second: (x: Int, y: Int), third: (x: Int, y: Int)) -> Angle?getDirection(first: (x: Int, y: Int), second: (x: Int, y: Int)) -> Direction?getHeight() -> IntgetIndices(from position : Int) -> (a: Int, b: Int)?getPosition(from indices: (a: Int, b: Int)) -> Int?getSpiralTraversalPath() -> [(x: Int, y: Int)]getWidth() -> Inttransform(transformation : Transformation) -> [[(x: Int, y: Int)]]许可证
本工程遵循MIT许可协议 - 有关详细信息,请参阅许可证文件