Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class JogoDaVelha {
- protected static int [][] matriz = new int[3][3];
- private static final String jogador1 = "1";
- private static final String jogador2 = "2";
- protected int vazio = 0;
- private int coluna;
- private boolean linha;
- public JogoDaVelha() {
- ZerarTabuleiro();
- }
- public void ZerarTabuleiro() {
- for(int i = 0; i < 3; i++) {
- for(int j = 0; j < 3; j++) {
- matriz[i][j] = vazio;
- }
- }
- }
- public void desenharGrade(){
- System.out.println();
- for(int linha = 0 ; linha < 3 ; linha++){
- for(int coluna = 0 ; coluna < 3 ; coluna++){
- if(matriz[linha][coluna] == 1){
- System.out.print(" X ");
- }
- if(matriz[linha][coluna] == 2){
- System.out.print(" O ");
- }
- if(matriz[linha][coluna] == 0){
- System.out.print(" ");
- }
- if(coluna == 0 || coluna == 1)
- System.out.print("|");
- }
- System.out.println();
- }
- }
- public boolean verificaJogada(int linha, int coluna) {
- if (this.linha || this.coluna > 2) {
- return false;
- } else {
- return true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement