tictacgame.java

来自「網路連線圈圈叉叉...... 可以互相連線」· Java 代码 · 共 37 行

JAVA
37
字号
   import java.io.*;

   public class TicTacGame implements Serializable {
      char[] pos = {' ',' ',' ',' ',' ',' ',' ',' ',' '};
      public void clearAll() {
         for (int i=0;i<9;i++) 
            pos[i] = ' ';
      
      }
      public void clear(int i) {
         pos[i]=' ';
      }
      public void clear(int x, int y) {
         pos[x+y*3]=' ';
      }
      public void putX(int i) {
         pos[i]='X';
      }
      public void putX(int x, int y) {
         pos[x+y*3]='X';
      }
   
      public void putO(int i) {
         pos[i]='O';
      }
      public void putO(int x, int y) {
         pos[x+y*3]='O';
      }
      public char get(int i) {
         return pos[i];
      }
      public char get(int x, int y) {
         return pos[x+3*y];
      }
   }	

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?