SequalsK - A Bidirectional Transpiler
Case Study: Board Game
The board game app covers three games that can be played on an 8x8-board, namely, Reversi, Checkers, and Chess. There is a single-player mode where the user always plays white and an AI opponent plays black. The three games share a lot of common code like the basic data structure to store the board and a straightforward implementation of the minimax algorithm for the AI opponent. Each game, of course, comes with its own game logic ensuring that only valid moves can be made.
The SequalsK transpiler is able to bidirectionally transpile all files that form the model of the app, i.e., both the data structures like the representation of the board and the three game-logic implementations as well as the shared AI implementation. On the SequalsK main web page
, the transpilation can be examined by clicking on the appropriate example (see section "Positive Examples"). In order to work, the transpiled code has to be used together with a platform-specific support file, which can be retrieved from GitHub: for the use with generated Swift-code
and for the use with generated Kotlin-code
The complete source code of the iOS version can be found on GitHub
Here is a screenshot of an ongoing Checkers game, made on an iPad Pro 9.7" simulator.
The complete source code of the Android version can be found on GitHub
Here is a screenshot of a finished Chess game, made on a Pixel 2 emulator.
by Dominik Schultes, Technische Hochschule Mittelhessen