全部评论 1

  • 置顶

    作者挺辛苦(已点赞)

    2026-04-29 来自 天津

    2
    • 不小心把你的删了请重发一下sorry

      2026-05-02 来自 湖北

      1
    • #include <bits/stdc++.h>
      #define clear() printf("\033c") 
      #include <windows.h>
      using namespace std;
      char c[4][4];
      int cnt;
      void on() {
          for(int i = 1; i <= 3; i++) {
              for(int j = 1; j <= 3; j++) {
                  cout << c[i][j] << " ";
              }
              cout << endl;
          }
      }
      bool check() {
          for(int i = 1; i <= 3; i++) {
              if(c[i][1] == 'o' && c[i][2] == 'o' && c[i][3] == 'o') return true;
          }
          for(int i = 1; i <= 3; i++) {
              if(c[i][1] == 'x' && c[i][2] == 'x' && c[i][3] == 'x') return true;
          }
          
          for(int i = 1; i <= 3; i++) {
              if(c[1][i] == 'o' && c[2][i] == 'o' && c[3][i] == 'o') return true;
          }
          for(int i = 1; i <= 3; i++) {
              if(c[1][i] == 'x' && c[2][i] == 'x' && c[3][i] == 'x') return true;
          }
          
          if(c[1][1] == 'o' && c[2][2] == 'o' && c[3][3] == 'o') return true;
          if(c[1][1] == 'x' && c[2][2] == 'x' && c[3][3] == 'x') return true;
          
          if(c[1][3] == 'o' && c[2][2] == 'o' && c[3][1] == 'o') return true;
          if(c[1][3] == 'x' && c[2][2] == 'x' && c[3][1] == 'x') return true;
          return false;
      }
      bool ss() {
      	for(int i = 1; i <= 3; i++) {
      		for(int j = 1; j <= 3; j++) {
      			if(c[i][j] == '-') return false;
      		}
      	}
      	return true;
      }
      int main() {
      	cnt = 1;
          for(int i = 1; i <= 3; i++) {
              for(int j = 1; j <= 3; j++) {
                  c[i][j] = '-';
              }
          }
          while(true) {
      		int x, y;
      		clear();
          	if(cnt % 2 == 1) {
      	        on();
      	        cout << "1号玩家选择" << endl << "行:";
      	        cin >> x;
      	        cout << "列:";
      	        cin >> y;
      	        if(c[x][y] == '-') {
      				c[x][y] = 'o';
      				cnt++;
      			}
      	        else {
      				clear();
      				cout << "选择无效" << endl;
      				Sleep(2000); // 暂停 2000 毫秒(即 2 秒)
      				continue;
      			}
      	        
      

      2026-05-02 来自 天津

      1
    • 
      	        clear();
      	        if(check()) {
      	        	clear();
      	            on();
      	            cout << endl;
      	            cout << "1号玩家胜利" << endl;
      	            return 0;
      	        }
      		} else {
      	        on();
      	        cout << "2号玩家选择" << endl << "行:";
      	        cin >> x;
      
      ```后半个
      

      2026-05-02 来自 天津

      1

热门讨论