Skip to content

dtl::shape::Shogi (形状クラス)

Kasugaccho edited this page Aug 17, 2019 · 3 revisions

バージョン:0.4.10.0以降

<DTL/Shape/Shogi.hpp>

namespace dtl::shape {
  template <typename T>
  class Shogi;
}

T は1bit以上の型

概要

Shogiとは "Matrixの描画範囲に将棋の駒を初期位置に設置する" 機能を持つクラスである。

描画範囲の全てを必ず塗りつぶすとは限らない (Matrixの初期化が必要)

対応機能

機能名 対応
非長方形Matrix 可能✅

例 (C++11)

#include <DTL.hpp>
#include <cstdint>
#include <array>

int main() {

	using shape_t = std::uint_fast8_t;
	std::array<std::array<shape_t, 9>, 9> matrix{ {} };

	dtl::shape::Shogi<shape_t>(
		1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
		15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28).draw(matrix);

	dtl::console::OutputString<shape_t>(
		" *   ", "fuh< ", "fuh> ", "tok< ", "tok> ", "kyo< ", "kyo> ", "nky< ", "nky> ", "kei< ", "kei> ", "nke< ", "nke> ", "gin< ", "gin> ",
		"ngi< ", "ngi> ", "his< ", "his> ", "ryo< ", "ryo> ", "kak< ", "kak> ", "rym< ", "rym> ", "kin< ", "kin> ", "osh< ", "gyo> ").draw(matrix);

	return 0;
}

出力

kyo< kei< gin< kin< osh< kin< gin< kei< kyo<
 *   his<  *    *    *    *    *   kak<  *
fuh< fuh< fuh< fuh< fuh< fuh< fuh< fuh< fuh<
 *    *    *    *    *    *    *    *    *
 *    *    *    *    *    *    *    *    *
 *    *    *    *    *    *    *    *    *
fuh> fuh> fuh> fuh> fuh> fuh> fuh> fuh> fuh>
 *   kak>  *    *    *    *    *   his>  *
kyo> kei> gin> kin> gyo> kin> gin> kei> kyo>

関連項目

dtl::shape::Chess

dtl::shape::Reversi

Clone this wiki locally