An open API service indexing awesome lists of open source software.

https://github.com/sensuikan1973/pedax

Reversi Board desktop app, which has the strongest reversi engine edax.
https://github.com/sensuikan1973/pedax

dart-ffi docusaurus edax fastlane ffi flutter flutter-desktop isolate linux macos othello reversi windows

Last synced: about 2 months ago
JSON representation

Reversi Board desktop app, which has the strongest reversi engine edax.

Awesome Lists containing this project

README

          


pedax_logo
pedax

screenshot_macos






pedax is Reversi Board GUI with edax, which is the strongest reversi engine.




pedax has 4 features.


  • Mac/Windows/Linux are supported. You can install from Mac App Store or Microsoft Store.


  • Seamlessly, you can see evaluation value, e.g. +4, -10.


  • Customizable important options, e.g. book file path, search level, advanced indicator.


  • 2 languages (English, Japanese) are supported.




## Development

[![Flutter CI](https://github.com/sensuikan1973/pedax/actions/workflows/flutter_ci.yaml/badge.svg)](https://github.com/sensuikan1973/pedax/actions/workflows/flutter_ci.yaml)
[![codecov](https://codecov.io/gh/sensuikan1973/pedax/branch/main/graph/badge.svg?token=DoMWFhOPN3)](https://codecov.io/gh/sensuikan1973/pedax)
[![Flutter Build](https://github.com/sensuikan1973/pedax/actions/workflows/flutter_build.yaml/badge.svg)](https://github.com/sensuikan1973/pedax/actions/workflows/flutter_build.yaml)
[![Flutter Deployment MacOS](https://github.com/sensuikan1973/pedax/actions/workflows/deploy_macos.yaml/badge.svg?event=release)](https://github.com/sensuikan1973/pedax/actions/workflows/deploy_macos.yaml)
[![Deploy Website](https://github.com/sensuikan1973/pedax/actions/workflows/deploy_website.yaml/badge.svg)](https://github.com/sensuikan1973/pedax/actions/workflows/deploy_website.yaml)

### Architecture

The technical point of pedax is as follows.

- pedax needs to call _Expensive_ _Native(C)_ logic such as computing evaluation value.
- _Native(C)_ logic needs allocated huge data on memory. It's desirable to daemonize _Native(C)_ process.

So, I use some [isolates](https://dart.dev/language/isolates) with ffi([libedax4dart](https://github.com/sensuikan1973/libedax4dart)) to achieve _seamless non-blocking_ UI.

```mermaid
%% https://mermaid-js.github.io/mermaid/#/sequenceDiagram
sequenceDiagram
actor User
participant MainIsolate as Main Isolate
participant EdaxServer as Edax Server
participant EphemeralWorker as Ephemeral Worker
participant EdaxProcess as Edax Process [C]

link EdaxServer: source @ https://github.com/sensuikan1973/pedax/tree/main/lib/engine
link EdaxServer: caller @ https://github.com/sensuikan1973/pedax/blob/main/lib/models/board_notifier.dart
link EphemeralWorker: source @ https://github.com/sensuikan1973/pedax/tree/main/lib/engine
link EdaxProcess: binding source (Dart) @ https://github.com/sensuikan1973/libedax4dart
link EdaxProcess: origin source(C) @ https://github.com/sensuikan1973/edax-reversi/tree/libedax_sensuikan1973

User ->> MainIsolate: launch pedax
MainIsolate ->> EdaxServer: spawn and notify my SendPort
EdaxServer ->> MainIsolate: notify my SendPort
and start listening
EdaxServer ->> EdaxProcess: initialize via ffi

User ->> MainIsolate: action (e.g. tap)
MainIsolate ->> EdaxServer: request EdaxCommand
via SendPort

alt light EdaxCommand
EdaxServer ->> EdaxProcess: stop EdaxCommand being executed via ffi
EdaxServer ->> EdaxProcess: execute requested EdaxCommand via ffi
EdaxProcess ->> EdaxServer: return result
EdaxServer ->> MainIsolate: notify result via SenPort
MainIsolate ->> MainIsolate: update UI
else heavy EdaxCommand
note right of EdaxServer: spawn another isolate not to block EdaxServer.
Then, EdaxServer can accept other requests.
EdaxServer ->>+ EphemeralWorker: spawn and notify Main Isolate SendPort
EphemeralWorker ->> EdaxProcess: stop EdaxCommand being executed via ffi
EphemeralWorker ->> EdaxProcess: execute requested EdaxCommand via ffi
note over EdaxProcess: heavy...
EdaxProcess ->> EphemeralWorker: return result
EphemeralWorker ->>- MainIsolate: notify result via SenPort
MainIsolate ->> MainIsolate: update UI
end
```

### Run

```sh
./scripts/setup_flutter.sh
flutter run --device-id macos --dart-define "SENTRY_DSN=xxx" # env is optional
```

### References
- [`important` issues](https://github.com/sensuikan1973/pedax/issues?q=label%3Aimportant+sort%3Acreated-desc)
- https://dart.dev/language/concurrency