shogi 0.0.1

  • Readme
  • Changelog
  • Installing
  • 52

shogi #

A simple shogi engine for Dart and Flutter. This engine can be combined with flutter_shogi_board to render static game board positions, tsume problems or shogi castles.

Presently the package is very basic in which it can determine the static board position for a given game. In future versions, dynamic games will be considered

Getting Started #

Import the package #

To import this package, simply add shogi as a dependency in pubspec.yaml

    sdk: flutter

Note that this package requires dart >= 2.3.0.

Example #

import 'package:flutter/material.dart';
import 'package:shogi/shogi.dart';

void main() {
  final boardPieces = ShogiUtils.initialBoard;
  boardPieces.forEach((p) => print(p));

Importing a Game Board #

As the game board is presently static, a board position can be notated by {PieceType}-{Row}{Column}, i.e. K-59. Note that 11 is the top left board cell as per japanese notation.

final yagura = ['L-99', 'N-89', 'K-88', 'G-78', 'P-97', 'P-87', 'S-77', 'G-67', 'P-76', 'P-66', 'P-56'];

final boardPieces = ShogiUtils.stringArrayToBoardPiecesArray(yagura);

If sente or gote aren't specified, then sente is chosen by default. To import pieces for both players, use the notation {Player}:{PieceType}-{Row}{Column}.

final tsume1 = ['G:K-51', 'G:S-61', 'G:S-41', 'S:+P-53', 'S:+B-25'];

Future Plans #

The packages shogi and flutter_shogi_board grew out of my desired to visualize shogi castles in Flutter, and with no game board widget or even a shogi engine available, I decided to roll my own.

Presently the package contains the business logic components from flutter_shogi_board. For the future I would like to utilize these packages not just for displaying static game boards, but also for tsume problems, thus user interaction may be considered.

As the game board is static, the notation G:K-51 is currently utilized to import game boards, however KIF may be more suitable for future versions:

1 7六歩(77)
2 3四歩(33)
3 7五歩(76)

Raising Issues and Contributing #

Please report bugs and issues, and raise feature requests on GitHub.

To contribute, submit a PR with a detailed description and tests, if applicable.

[0.0.1] - 13/10/2019

  • Initial release of shogi package, based on business logic components from flutter_shogi_board.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  shogi: ^0.0.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:shogi/shogi.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health suggestions

Format lib/src/models/board_piece.dart.

Run flutter format to format lib/src/models/board_piece.dart.

Format lib/src/utils/package_utils.dart.

Run flutter format to format lib/src/utils/package_utils.dart.

Format lib/src/utils/shogi_utils.dart.

Run flutter format to format lib/src/utils/shogi_utils.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and shogi.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
flutter 0.0.0
meta ^1.1.6 1.1.8
Transitive dependencies
collection 1.14.11 1.14.12
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies