//#include ".h" #include <cstdlib> // srand, rand使用 #include <ctime> // time使用 #include <iostream> extern const int g_width = 30; extern const int g_height = 30; bool g_map[g_width][g_height]; struct Rect { // xの始点 int x; // yの始点 int y; // 横幅 int width; // 縦幅 int height; }; int main( int argc, char* args[] ) { // 乱数の種を設定 srand( (unsigned)time( NULL ) ); // マップ初期化 for( int i = 0; i < g_width; ++i ) { for( int j = 0; j < g_height; ++j ) { g_map[i][j] = false; } } // 区画を初期化 const int partition_size = 4; Rect partition[partition_size]; for( int i = 0; i < partition_size; ++i ) { partition[i].x = 0; partition[i].y = 0; partition[i].width = g_width; partition[i].height = g_height; } // 縦に分割する partition[0].width = partition[0].width / 2; partition[1].x = partition[0].width; partition[1].y = partition[0].y; partition[1].width = partition[0].width; partition[1].height = partition[0].height; // 横に分割する partition[0].height = partition[0].height / 2; partition[2].x = partition[0].x; partition[2].y = partition[0].height; partition[2].height = partition[0].height; partition[2].width = partition[0].width; // 横に分割する partition[1].height = partition[1].height / 2; partition[3].x = partition[1].x; partition[3].y = partition[1].height; partition[3].height = partition[1].height; partition[3].width = partition[1].width; // 分割の確認 for( int i = 0; i < partition_size; ++i ) { std::cout << "partition" << i; std::cout << "(" << partition[i].x << ","; std::cout << partition[i].y << ","; std::cout << partition[i].width << ","; std::cout << partition[i].height << ")"; std::cout << std::endl; } // mapに区画を追加 for( int i = 0; i < partition_size; ++i ) { // 縦 for( int j = 0; j < partition[i].height; ++j ) { // if( partition[i].x != 0 ) { g_map[partition[i].y+j][partition[i].x] = true; } } // 横 for( int j = 0; j < partition[i].width; ++j ) { // if( partition[i].y != 0 ) { g_map[partition[i].y][partition[i].x+j] = true; } } } // 部屋の生成 Rect room[partition_size]; const int room_size = 5; for( int i = 0; i < partition_size; ++i ) { room[i].x = partition[i].x + (rand() % room_size + 2); room[i].y = partition[i].y + (rand() % room_size + 2); room[i].width = room_size; room[i].height = room_size; } // mapに部屋を追加 for( int i = 0; i < partition_size; ++i ) { for( int j = 0; j < room[i].height; ++j ) { for( int k = 0; k < room[i].width; ++k ) { g_map[room[i].y+j][room[i].x+k] = true; } } } // mapに通路を追加(要修正) for( int i = 0; i < partition_size; ++i ) { if( partition[i].x < partition[i].width ) { for( int j = 0; g_map[room[i].y][room[i].x+room[i].width+j] == false; ++j ) { g_map[room[i].y][room[i].x+room[i].width+j] = true; } } else { // 初期値1は部屋のtrueを回避用 for( int j = 1; g_map[room[i].y][room[i].x-j] == false; ++j ) { g_map[room[i].y][room[i].x-j] = true; } } } // 分割の確認 for( int i = 0; i < partition_size; ++i ) { std::cout << "room" << i; std::cout << "(" << room[i].x << ","; std::cout << room[i].y << ","; std::cout << room[i].width << ","; std::cout << room[i].height << ")"; std::cout << std::endl; } // マップの内容を表示する for( int i = 0; i < g_width; ++i ) { for( int j = 0; j < g_height; ++j ) { // 通過可能か判定 if( g_map[i][j] ) { std::cout << "."; }// 通路 else { std::cout << "#"; }// 壁 } std::cout << std::endl; } return 0; }
| ハヤブサの個人作業 |
| アキラの個人作業 |
| タツの聖域 |
| 鉄獄 |
| ミルヴァイスの個人作業 |
2011-07-27
2011-06-23
2011-06-09
2011-06-07
2011-05-08
2011-05-06
2011-03-29
2011-03-13
2011-02-28
2011-02-21
2011-02-13
2011-02-12
2011-02-07
2011-02-03
2011-01-30
2011-01-29
2011-01-23
2011-01-20
2011-01-16
2011-01-13
2010-12-23
2010-12-19
| 前月 | 2012年2月 | 翌月 | ||||
| 日 | 月 | 火 | 水 | 木 | 金 | 土 |
| 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 | 29 | |||