fork download
  1. // ┌ ┐ └ ┘ ├ ┤ ┬ ┴ ┼ ─ │ ═║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬ ╭ ╮ ╯ ╰ ╱ ╲ ╳
  2. #include <chrono>
  3. #include <iostream>
  4. #include <thread>
  5. #include <vector>
  6. using namespace std;
  7.  
  8. vector<string> moves;
  9. string board[8][8] = {
  10. {"♜","♞","♝","♛","♚","♝","♞","♜"},
  11. {"♟","♟","♟","♟","♟","♟","♟","♟"},
  12. {" "," "," "," "," "," "," "," "},
  13. {" "," "," "," "," "," "," "," "},
  14. {" "," "," "," "," "," "," "," "},
  15. {" "," "," "," "," "," "," "," "},
  16. {"♙","♙","♙","♙","♙","♙","♙","♙"},
  17. {"♖","♘","♗","♕","♔","♗","♘","♖"}
  18. };
  19. int pot = 600;
  20. int ptt = 600;
  21.  
  22. void wait(const int s) { this_thread::sleep_for(chrono::seconds(s)); }
  23.  
  24. void render(const string board[8][8]) {
  25. cout << " ┌─────────────────┐\n";
  26. for (int r = 0; r < 8; r++) {
  27. cout << 8 - r << " │ ";
  28. for (int c = 0; c < 8; c++) {
  29. cout << board[r][c] << " ";
  30. }
  31. cout << "│\n";
  32. }
  33. cout << " └─────────────────┘\n";
  34. cout << " a b c d e f g h";
  35. }
  36.  
  37. string getMove(const int n) {
  38. int i = (n - 1) * 2;
  39. string mo = i < moves.size() ? moves[i] : "";
  40. string mt = (i + 1) < moves.size() ? moves[i + 1] : "";
  41. auto pad = [](const string& s) {
  42. return ' ' + s + string(7 - s.size(), ' ');
  43. };
  44. return to_string(n) + pad(mo) + pad(mt) + "\n";
  45. }
  46. int main() {
  47. ios::sync_with_stdio(false);
  48. cin.tie(nullptr);
  49. cout << " ____ _\n"
  50. << " / ___| |__ ___ ___ ___\n"
  51. << "| | | '_ \\ / _ \\/ __/ __|\n"
  52. << "| |___| | | | __/\\__ \\__ \\\n"
  53. << " \\____|_| |_|\\___||___/___/\n\n"
  54. << " 1: play\n"
  55. << " 2: information\n\n> ";
  56. int num;
  57. while (!(cin >> num)) {
  58. cout << "\x1b[1A\x1b[2K> ";
  59. cin.clear();
  60. cin.ignore(100, '\n');
  61. }
  62. return 0;
  63. }
Success #stdin #stdout 0.01s 5320KB
stdin
k
l
9
stdout
   ____ _
 / ___| |__   ___  ___ ___
| |   | '_ \ / _ \/ __/ __|
| |___| | | |  __/\__ \__ \
 \____|_| |_|\___||___/___/

  1: play
  2: information

> > >