Swift Game Bench

Some weeks ago I have finished GameBench a simple two player board game framework implemented in the Swift language. It comes with a simple Connect4 App so you can learn how to use it and implement your own board games. SwiftGameBench framework provides an alpha-beta pruning search algorithm for game tree analysis.

Alpha–beta pruning is a search algorithm that seeks to decrease the number of nodes that are evaluated by the minimax algorithm in its search tree. It is an adversarial search algorithm used commonly for machine playing of two-player games. It stops completely evaluating a move when at least one possibility has been found that proves the move to be worse than a previously examined move. Such moves need not be evaluated further. When applied to a standard minimax tree, it returns the same move as minimax would, but prunes away branches that cannot possibly influence the final decision.

An illustration of alpha–beta pruning. The grayed-out subtrees need not be explored (when moves are evaluated from left to right), since we know the group of subtrees as a whole yields the value of an equivalent subtree or worse, and as such cannot influence the final result. The max and min levels represent the turn of the player and the adversary, respectively.

GameBench is open source and you can download it from bitbucket.

tomkausch

Leave a Reply

Your email address will not be published. Required fields are marked *