BoardGameManager 1.2.0

BoardGameManager 1.2.0

Maintained by Prasad Shinde.



  • By
  • Prasad Shinde

BoardGameManager

Version Platform GitHub top language License

BoardGameManager is a Cocoapod that helps with score calculation, transformation and traversal in board games on iOS. It gives the direction and angles between nodes in trails on the board which can be used for score calculation (Weirder the angle, higher the score). It has spiral traversal and various flipping and rotational transformations.

Requirements

  • Swift 5
  • iOS 12 and above

Installation

BoardGameManager is available on CocoaPods.

Add this line to your Podfile.

pod 'BoardGameManager'

Run pod install.

Usage

Create a board

let board = Board(height: 5, width: 3, rule: .orthogonalAndDiagonal)

List of methods:

areNeighbours(first : (a: Int, b: Int), second : (a: Int, b: Int))  -> Bool?
createAndSetRandomString (from set: [Character]? = nil) -> String
createAndSetRandomStringUsingLetterFrequency() -> String
isValidIndex(_ indices : (Int, Int)...) -> Bool
getAngle(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() -> Int
getIndices(from position : Int) -> (a: Int, b: Int)?
getPosition(from indices: (a: Int, b: Int)) -> Int?
getSpiralTraversalPath() -> [(x: Int, y: Int)]
getWidth() -> Int
transform(transformation : Transformation) -> [[(x: Int, y: Int)]]

License

This project is licensed under the MIT License - see the LICENSE file for details