|
MicroMouse Maze Library
3703225
|
迷路の壁情報を管理するクラス [詳解]
#include <Maze.h>

公開メンバ関数 | |
| Maze (const Positions &goals=Positions(), const Position start=Position(0, 0)) | |
| デフォルトコンストラクタ [詳解] | |
| void | reset (const bool set_start_wall=true, const bool set_range_full=false) |
| 迷路の初期化。壁を削除し、スタート区画を既知に [詳解] | |
| bool | isWall (const WallIndex i) const |
| 壁の有無を返す [詳解] | |
| bool | isWall (const Position p, const Direction d) const |
| bool | isWall (const int8_t x, const int8_t y, const Direction d) const |
| void | setWall (const WallIndex i, const bool b) |
| 壁を更新をする [詳解] | |
| void | setWall (const Position p, const Direction d, const bool b) |
| void | setWall (const int8_t x, const int8_t y, const Direction d, const bool b) |
| bool | isKnown (const WallIndex i) const |
| 壁が探索済みかを返す [詳解] | |
| bool | isKnown (const Position p, const Direction d) const |
| bool | isKnown (const int8_t x, const int8_t y, const Direction d) const |
| void | setKnown (const WallIndex i, const bool b) |
| 壁の既知を更新する [詳解] | |
| void | setKnown (const Position p, const Direction d, const bool b) |
| void | setKnown (const int8_t x, const int8_t y, const Direction d, const bool b) |
| bool | canGo (const WallIndex i) const |
| 通過可能かどうかを返す [詳解] | |
| bool | canGo (const Position p, const Direction d) const |
| bool | canGo (const WallIndex &i, bool knownOnly) const |
| bool | updateWall (const Position p, const Direction d, const bool b, const bool pushRecords=true) |
| 既知の壁情報と照らしあわせながら、壁を更新する関数 [詳解] | |
| void | resetLastWalls (const int num, const bool set_start_wall=true) |
| 直前に更新した壁を見探索状態にリセットする [詳解] | |
| int8_t | wallCount (const Position p) const |
| 引数区画の壁の数を返す [詳解] | |
| int8_t | unknownCount (const Position p) const |
| 引数区画に隣接する未知壁の数を返す [詳解] | |
| void | print (std::ostream &os=std::cout, const int mazeSize=MAZE_SIZE) const |
| 迷路の表示 [詳解] | |
| void | print (const Directions &dirs, const Position start=Position(0, 0), std::ostream &os=std::cout, const int mazeSize=MAZE_SIZE) const |
| パス付きの迷路の表示 [詳解] | |
| void | print (const Positions &positions, std::ostream &os=std::cout, const int mazeSize=MAZE_SIZE) const |
| 位置のハイライト付きの迷路の表示 [詳解] | |
| bool | parse (std::istream &is) |
| 特定の迷路の文字列(*.maze ファイル)から壁をパースする [詳解] | |
| bool | parse (const std::string &filepath) |
| bool | parse (const std::vector< std::string > &data, const int mazeSize) |
| 配列から迷路を読み込むパーサ [詳解] | |
| void | setGoals (const Positions &goals) |
| ゴール区画の集合を更新 [詳解] | |
| void | setStart (const Position start) |
| スタート区画を更新 [詳解] | |
| const Positions & | getGoals () const |
| ゴール区画の集合を取得 [詳解] | |
| const Position & | getStart () const |
| スタート区画を取得 [詳解] | |
| const WallRecords & | getWallRecords () const |
| 壁ログを取得 [詳解] | |
| int8_t | getMinX () const |
| 既知部分の迷路サイズを返す。計算量を減らすために使用。 [詳解] | |
| int8_t | getMinY () const |
| int8_t | getMaxX () const |
| int8_t | getMaxY () const |
| bool | backupWallRecordsToFile (const std::string &filepath, const bool clear=false) |
| 壁ログをファイルに追記保存する関数 [詳解] | |
| bool | restoreWallRecordsFromFile (const std::string &filepath) |
| 壁ログファイルから壁情報を復元する関数 [詳解] | |
限定公開メンバ関数 | |
| bool | isWallBase (const std::bitset< WallIndex::SIZE > &wall, const WallIndex i) const |
| 壁の確認のベース関数。迷路外を参照すると壁ありと返す。 [詳解] | |
| void | setWallBase (std::bitset< WallIndex::SIZE > &wall, const WallIndex i, const bool b) const |
| 壁の更新のベース関数。迷路外を参照すると無視される。 [詳解] | |
限定公開変数類 | |
| std::bitset< WallIndex::SIZE > | wall |
| 壁情報 [詳解] | |
| std::bitset< WallIndex::SIZE > | known |
| 壁の既知未知情報 [詳解] | |
| Positions | goals |
| ゴール区画の集合 [詳解] | |
| Position | start |
| スタート区画 [詳解] | |
| WallRecords | wallRecords |
| 更新した壁のログ [詳解] | |
| int8_t | min_x |
| 既知壁の最小区画 [詳解] | |
| int8_t | min_y |
| 既知壁の最小区画 [詳解] | |
| int8_t | max_x |
| 既知壁の最大区画 [詳解] | |
| int8_t | max_y |
| 既知壁の最大区画 [詳解] | |
| int | wallRecordsBackupCounter |
| 壁ログバックアップのカウンタ [詳解] | |
フレンド | |
| std::istream & | operator>> (std::istream &is, Maze &maze) |
| 入力ストリームの迷路データをパースする [詳解] | |
迷路の壁情報を管理するクラス
|
inline |
デフォルトコンストラクタ
| goals | ゴール区画の集合 |
| start | スタート区画 |

| bool MazeLib::Maze::backupWallRecordsToFile | ( | const std::string & | filepath, |
| const bool | clear = false |
||
| ) |
壁ログをファイルに追記保存する関数

|
inline |

|
inline |
|
inline |
|
inline |
|
inline |
既知部分の迷路サイズを返す。計算量を減らすために使用。
|
inline |
|
inline |
壁ログを取得
|
inline |

|
inline |
|
inline |

|
inline |
|
inlineprotected |
壁の確認のベース関数。迷路外を参照すると壁ありと返す。

|
inline |

| bool MazeLib::Maze::parse | ( | const std::vector< std::string > & | data, |
| const int | mazeSize | ||
| ) |
配列から迷路を読み込むパーサ
| data | 各区画16進表記の文字列配列 例:{"abaf", "1234", "abab", "aaff"} |
| mazeSize | 迷路の1辺の区画数(正方形のみ対応) |

| bool MazeLib::Maze::parse | ( | std::istream & | is | ) |
特定の迷路の文字列(*.maze ファイル)から壁をパースする
テキスト形式。S: スタート区画(単数)、G: ゴール区画(複数可)
| is | *.maze 形式のファイルの input-stream |

| void MazeLib::Maze::print | ( | const Directions & | dirs, |
| const Position | start = Position(0, 0), |
||
| std::ostream & | os = std::cout, |
||
| const int | mazeSize = MAZE_SIZE |
||
| ) | const |
パス付きの迷路の表示
| start | パスのスタート座標 |
| dirs | 移動方向の配列 |
| os | output-stream |
| mazeSize | 迷路の1辺の区画数(正方形のみ対応) |

| void MazeLib::Maze::print | ( | const Positions & | positions, |
| std::ostream & | os = std::cout, |
||
| const int | mazeSize = MAZE_SIZE |
||
| ) | const |
位置のハイライト付きの迷路の表示
| positions | ハイライトする位置の集合 |
| os | output-stream |
| mazeSize | 迷路の1辺の区画数(正方形のみ対応) |
| void MazeLib::Maze::print | ( | std::ostream & | os = std::cout, |
| const int | mazeSize = MAZE_SIZE |
||
| ) | const |
迷路の表示

| void MazeLib::Maze::reset | ( | const bool | set_start_wall = true, |
| const bool | set_range_full = false |
||
| ) |
迷路の初期化。壁を削除し、スタート区画を既知に
| set_start_wall | スタート区画の East と North の壁を設定するかどうか |
| set_range_full | 高速化用の min_x などを予め最大に設定するかどうか |

| void MazeLib::Maze::resetLastWalls | ( | const int | num, |
| const bool | set_start_wall = true |
||
| ) |
直前に更新した壁を見探索状態にリセットする
| num | 消去する直近の壁の数 |
| set_start_wall | スタート区画の East と North の壁を設定するかどうか |

| bool MazeLib::Maze::restoreWallRecordsFromFile | ( | const std::string & | filepath | ) |
壁ログファイルから壁情報を復元する関数

|
inline |
|
inline |

|
inline |
壁の既知を更新する
| i | 壁の位置 |
| b | 壁の未知既知 true:既知、false:未知 |

|
inline |
|
inline |
|
inlineprotected |
| int8_t MazeLib::Maze::unknownCount | ( | const Position | p | ) | const |
引数区画に隣接する未知壁の数を返す
| p | 区画の座標 |

| bool MazeLib::Maze::updateWall | ( | const Position | p, |
| const Direction | d, | ||
| const bool | b, | ||
| const bool | pushRecords = true |
||
| ) |
既知の壁情報と照らしあわせながら、壁を更新する関数
既知の壁と非一致した場合、未知壁にして return する
| p | 区画の座標 |
| d | 壁の方向 |
| b | 壁の有無 |
| pushRecords | 壁更新の記録に追加する |

| int8_t MazeLib::Maze::wallCount | ( | const Position | p | ) | const |
引数区画の壁の数を返す
| p | 区画の座標 |

|
friend |
入力ストリームの迷路データをパースする
使用例: Maze maze; maze << std::cin;
| is | テキスト形式の迷路データを含む入力ストリーム |
| maze | パース結果を書き出す迷路の参照 |
|
protected |
ゴール区画の集合
|
protected |
壁の既知未知情報
|
protected |
既知壁の最大区画
|
protected |
既知壁の最大区画
|
protected |
既知壁の最小区画
|
protected |
既知壁の最小区画
|
protected |
スタート区画
|
protected |
壁情報
|
protected |
更新した壁のログ
|
protected |
壁ログバックアップのカウンタ