All Projects → fulldecent → FDChessboardView

fulldecent / FDChessboardView

Licence: MIT license
An iOS / Mac view controller for chess boards

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to FDChessboardView

ChessBoardScanner
Java based Chess Board Scanner, which converts 2D chess board image into a machine readable format a.k.a. Forsyth–Edwards Notation (FEN). It uses OpenCV and Deeplearning4j frameworks, complemented with some proprietary algorithms implemented for realizing the goal. It currently supports the chess board and pieces sets of the most common online c…
Stars: ✭ 32 (-57.33%)
Mutual labels:  chess, chessboard
ChessLib
C# chess library containing a complete data structure and move generation.
Stars: ✭ 37 (-50.67%)
Mutual labels:  chess, chessboard
Online-Chess
A chess website where people can play against each other online.
Stars: ✭ 28 (-62.67%)
Mutual labels:  chess, chessboard
stockfish-chess-web-gui
Responsive chess web GUI to play against the Stockfish 10 chess engine. Multiple web GUI implementations have also been included.
Stars: ✭ 21 (-72%)
Mutual labels:  chess, chessboard
chessboard-recognizer
Uses neural networks to extract chess positions from images
Stars: ✭ 59 (-21.33%)
Mutual labels:  chess, chessboard
FlyingCarUdacity
🛩️⚙️ 3D Planning, PID Control, Extended Kalman Filter for the Udacity Flying Car Nanodegree // FCND-Term1
Stars: ✭ 16 (-78.67%)
Mutual labels:  control
Quadcopter SimCon
Quadcopter Simulation and Control. Dynamics generated with PyDy.
Stars: ✭ 84 (+12%)
Mutual labels:  control
linux-show-player
Linux Show Player - Cue player designed for stage productions
Stars: ✭ 147 (+96%)
Mutual labels:  control
ChineseChessOnline
一款canvas版中国象棋游戏,支持高清图像/canvas响应式设计/ 实时对战/棋谱功能/在线聊天。A Canvas version of the Chinese chess game, supporting high-definition images / Canvas responsive design / real-time combat / chess spectrum function / online chat
Stars: ✭ 25 (-66.67%)
Mutual labels:  chess
chessops
Chess and chess variant rules and operations in TypeScript
Stars: ✭ 66 (-12%)
Mutual labels:  chess
OpenChess
A cross-platform chess game.
Stars: ✭ 18 (-76%)
Mutual labels:  chess
token-allowance-checker
Control ERC20 token approvals
Stars: ✭ 72 (-4%)
Mutual labels:  control
FabChess
UCI compliant chess engine written in Rust
Stars: ✭ 27 (-64%)
Mutual labels:  chess
syzygy-tables.info
User interface and public API for probing Syzygy endgame tablebases
Stars: ✭ 49 (-34.67%)
Mutual labels:  chess
Panuon.UI.Silver
Professional wpf ui library.
Stars: ✭ 391 (+421.33%)
Mutual labels:  control
shakmaty-syzygy
A Rust library to probe Syzygy endgame tablebases
Stars: ✭ 14 (-81.33%)
Mutual labels:  chess
Checkmate
A human vs human chess game build on basic JAVA.
Stars: ✭ 15 (-80%)
Mutual labels:  chess
ocs2
Optimal Control for Switched Systems
Stars: ✭ 263 (+250.67%)
Mutual labels:  control
Batch-First
A JIT compiled chess engine which traverses the search tree in batches in a best-first manner, allowing for neural network batching, asynchronous GPU use, and vectorized CPU computations.
Stars: ✭ 27 (-64%)
Mutual labels:  chess
the-Cooper-Mapper
An open source autonomous driving research platform for Active SLAM & Multisensor Data Fusion
Stars: ✭ 38 (-49.33%)
Mutual labels:  control

FDChessboardView

CI Status Version License Platform Carthage compatible

Features

  • High resolution graphics
  • Customizable themes and game graphics
  • Supports all single board chess variants: suicide, losers, atomic, etc.
  • Supports games with odd piece arrangement and non-standard castling (Fisher 960)
  • Very clean API, this is just a view
  • Supports a minimum deployment target of iOS 8 or OS X Mavericks (10.9)

Installation

Add FDChessboardView to your project using Swift Package Manager. In Xcode that is simply: File > Swift Packages > Add Package Dependency... and you're done. Alternative installations options are shown below for legacy projects.

CocoaPods

If you are already using CocoaPods, just add 'FDChessboardView' to your Podfile then run pod install.

Carthage

If you are already using Carthage, just add to your Cartfile:

github "fulldecent/FDChessboardView" ~> 0.1

Then run carthage update to build the framework and drag the built FDChessboardView.framework into your Xcode project.

Usage

Import the project and implement a data source:

import FDChessboardView

public protocol FDChessboardViewDataSource: class {
    /// What piece is on the square?
    func chessboardView(_ board: FDChessboardView, pieceForSquare square: FDChessboardSquare) -> FDChessboardPiece?

    /// The last move
    func chessboardViewLastMove(_ board: FDChessboardView) -> (from:FDChessboardSquare, to:FDChessboardSquare)?

    /// The premove
    func chessboardViewPremove(_ board: FDChessboardView) -> (from:FDChessboardSquare, to:FDChessboardSquare)?
}

If your application will allow the pieces to be moved, implement a delegate:

public protocol FDChessboardViewDelegate: class {
    /// Where can this piece move to?
    func chessboardView(_ board: FDChessboardView, legalDestinationsForPieceAtSquare from: FDChessboardSquare) -> [FDChessboardSquare]

    /// Before a move happenes
    func chessboardView(_ board: FDChessboardView, canMoveFrom from: FDChessboardSquare, to: FDChessboardSquare, withPromotion promotion: FDChessboardPiece?) -> Bool

    /// After a move happened
    func chessboardView(_ board: FDChessboardView, didMoveFrom from: FDChessboardSquare, to: FDChessboardSquare, withPromotion promotion: FDChessboardPiece?)
}

Then you can customize the view or call certain actions:

/// The location of a square on a chess board
public struct FDChessboardSquare: Hashable {
    /// From 0...7 (a...h)
    public let file: Int
    
    /// From 0...7 (white king starting position to black king starting position)
    public let rank: Int
}

/// The pieces on a chess board
public enum FDChessboardPiece: String {
    case WhitePawn
    case BlackPawn
    case WhiteKnight
    case BlackKnight
    case WhiteBishop
    case BlackBishop
    case WhiteRook
    case BlackRook
    case WhiteQueen
    case BlackQueen
    case WhiteKing
    case BlackKing
}

/// Display for a chess board
@IBDesignable open class FDChessboardView: UIView {
    @IBInspectable open var lightBackgroundColor: UIColor
    @IBInspectable open var darkBackgroundColor: UIColor
    open var targetBackgroundColor: UIColor
    open var legalBackgroundColor: UIColor
    open var lastMoveColor: UIColor
    open var premoveColor: UIColor
    open weak var dataSource: FDChessboardViewDataSource?
    open weak var delegate: FDChessboardViewDelegate?
    open var doesAnimate: Bool
    open var doesShowLegalSquares: Bool
    open var doesShowLastMove: Bool
    open var doesShowPremove: Bool

    /// Add a piece onto the board
    open func setPiece(_ piece: FDChessboardPiece?, forSquare square: FDChessboardSquare)

    /// Repull all board information from data source
    open func reloadData()

    /// Move a piece on the board, clears any prior premove
    open func move(_ piece: FDChessboardPiece, from: FDChessboardSquare, to: FDChessboardSquare, promotedTo promoted: FDChessboardPiece?)
    
    /// Premove a piece on the board, clears any prior premove
    open func premove(_ piece: FDChessboardPiece, from: FDChessboardSquare, to: FDChessboardSquare, promotedTo promoted: FDChessboardPiece?)
    
    /// Removes any premove on the board
    open func clearPremove()
    
    /// Move a piece on the board, clears any prior premove
    open func unmove(_ piece: FDChessboardPiece, from: FDChessboardSquare, to: FDChessboardSquare, promotedTo promoted: FDChessboardPiece?, capturing: FDChessboardPiece)
}

Upcoming features

These following items are in the API for discussion and awaiting implementation:

  • Display for last move
  • Mutable game state (i.e. can move the pieces)
  • Animation for piece moves
  • Highlighting of legal squares for a piece after begin dragging
  • Premove

See also

See also Kibitz for Mac which is making a comeback https://github.com/fulldecent/kibitz

License

FDChessboardView is available under the MIT license. See the LICENSE file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].