nextPlays(pbn, currentDirection, playedCards): Calculates the next possible plays given the current state of the game, including the player in turn and any cards that have already been played in the current trick.
rotatePBN(pbn, newDirection): Rotates the given PBN string to change the perspective to a new direction (North, East, South, West), effectively reordering the hands in the PBN without altering the cards within each hand.
loadImage(filePath): Loads an image (likely of a bridge hand) from the specified file path into a canvas for further processing.
sliceImage(canvas, boxes): Slices the given canvas into smaller images based on specified coordinates, typically used for isolating individual cards or sections of an image for recognition.
rmse(array1, array2): Calculates the Root Mean Square Error between two arrays, used as a measure of similarity or difference between two sets of data, often in the context of image comparison.
loadReferenceData(blackCardImagePath, redCardImagePath): Loads reference data for card recognition, likely including images or patterns for black and red cards to assist in identifying cards from images.
recognizeHand(canvas, referenceData): Recognizes a bridge hand from an image represented by a canvas, using preloaded reference data to interpret the cards and convert the visual representation into a PBN format.
undo(): Reverts the game state to the previous play, allowing for the correction of mistakes or reconsideration of strategy.
undoToPlay(trickIndex, playIndex): Reverts the game state to a specific play within a trick, based on provided indices, for detailed review or analysis.
toPBN(): Converts the current state of the game into a Portable Bridge Notation (PBN) string, representing the distribution of all cards among the players.