-
-
Notifications
You must be signed in to change notification settings - Fork 81
dtl::shape::CellularAutomatonMixIsland (形状クラス)
Kasugaccho edited this page Aug 17, 2019
·
11 revisions
<DTL/Shape/CellularAutomatonMixIsland.hpp>
namespace dtl::shape {
template <typename T>
class CellularAutomatonMixIsland;
}
※ T
は1bit以上の型
機能名 | 対応 |
---|---|
非長方形Matrix | 不可 |
CellularAutomatonMixIsland
とは "Matrixの描画範囲に1/2の確率で1番目の描画値を設置し、残りの確率で2番目以降の描画値をランダムに設置し、セルオートマトンを指定回数行う" 機能を持つクラスである。
描画範囲の全てを必ず塗りつぶす。
#include <DTL.hpp>
#include <cstdint>
#include <array>
int main() {
using shape_t = std::uint_fast8_t;
std::array<std::array<shape_t, 32>, 24> matrix{ {} };
dtl::shape::CellularAutomatonMixIsland<shape_t>(5, 0, 1, 2, 3, 4, 5).draw(matrix);
dtl::console::OutputNumber<shape_t>(",").draw(matrix);
dtl::console::OutputString<shape_t>("//", "AA", "BB", "CC", "DD", "EE").draw(matrix);
return 0;
}
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,
0,0,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,
0,3,0,3,3,2,3,3,0,0,0,1,1,1,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,0,
0,3,3,3,3,3,3,3,3,3,1,1,1,1,0,0,5,5,0,2,2,2,2,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,2,2,3,3,1,1,0,1,1,5,5,5,5,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
////////////////////////////////////////////////////////////////
//////////////////CC////////////////////////////////////////////
//////////////////////////////////////////AAAA//////////////////
//////CCCCCCCC//////////////////////////////////////////////////
//////CCCCCCCC////////////////////////////AA//////////AA////////
//CC//CCCCBBCCCC//////AAAAAA//////////BBBBBB////////////////////
//CCCCCCCCCCCCCCCCCCAAAAAAAA////EEEE//BBBBBBBB//////////////////
////////////BBBBCCCCAAAA//AAAAEEEEEEEE//BB//////////////////////
////////////BBBB//////DDDDDDEEEEEEEEEE////////////DD////////////
//////////////BB////DDDDDDBBEEEE////EE////////////DD//////AAAA//
////////////////BB//DD////BBEEEE////EEEE////////////////AA//AA//
////////BBBB////BBBBBBBB//EEBBBBBBBBBBEEEE//////////////////AA//
////////BBBBBBBBBBBBBBBBEEEEBBBBBBEEAA////DD////////////////AA//
//////////BBBBBBBBEEEEEEEEEEBBBBBBBBEEEE////////////////////////
//////////BBEEEEEEEEEEEEEEEEBBBBBB//EEEEEE//////////////////////
//////////BBEE////EEEEBBBBBBEEEE////////////////////////////////
//////////////EEEEEEEEBBBBEEEEEE////////////////////////////////
////////////////EE////////EEEEEE////////////////////////////////
////////BBBBBB//EE//////////EEEEEE//////////////////////////AA//
//BB////BBBBBB//////////////////EE////////////////////AAAAAA////
////EEEEBBBBBB////////////////////////////////////////AAAA//////
////////BBBBBB////////////////////////////////////////AA////////
////////////////////////////////////////////CC////////AA////////
////////////////////////////////////////////////////////////////
Copyright (c) 2018-2021 As Project.
Distributed under the Boost Software License, Version 1.0.(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)