Created
March 3, 2021 17:09
-
-
Save HirbodBehnam/8e9463d296e8f8e2a7f3522905a70840 to your computer and use it in GitHub Desktop.
View mazes generated by our maze generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| Maze example: | |
| 1e11111111111 | |
| 1*0*0*0*0*0*1 | |
| 1110111111101 | |
| 1*1*0*1*0*1*1 | |
| 1011111010101 | |
| 1*0*0*0*1*0*1 | |
| 11111111111e1 | |
| */ | |
| #include <iostream> | |
| #include <string> | |
| using namespace std; | |
| int main() { | |
| string result; // do not print each char at time because we will fuck up the terminal | |
| for (int row = 0;; row++) { | |
| string line; | |
| getline(cin, line); | |
| if (line.empty()) // end the program by empty line | |
| break; | |
| if (row % 2 == 0) { // horizontal walls | |
| for (int column = 0; column < line.size(); column++) | |
| result += line[column] == '1' || column % 2 == 0 ? "█" : " "; | |
| } else { // vertical walls | |
| for (int column = 0; column < line.size(); column += 2) | |
| result += line[column] == '1' ? "█ " : " "; | |
| } | |
| result += "\n"; | |
| } | |
| cout << result; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment