Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- static char arr[]= new char[10];
- static char ttt='X'; //Character that is either o or x
- static String ArrToSend()
- {
- String str = String.valueOf(arr);
- return str;
- }
- static void ServerDownloader() //Ta funkcja ma pobierać stringa z serwera. wywoła się ją za każdym razem jak będzie się chciało coś dodać do tablicy lub po naciśnięciu R
- {
- }
- static void ServerUploader() //TO wysyłasz do serwera, on to zapisuje i wysyła każdemu z użytkowników, albo temu jedenmu co przydzielił go do pary
- {
- }
- static void UpdateArray(String a)
- {
- arr[0]=a.charAt(0);
- arr[1]=a.charAt(1);
- arr[2]=a.charAt(2);
- arr[3]=a.charAt(3);
- arr[4]=a.charAt(4);
- arr[5]=a.charAt(5);
- arr[6]=a.charAt(6);
- arr[7]=a.charAt(7);
- arr[8]=a.charAt(8);
- arr[9]=a.charAt(9);
- }
- static int counter()
- {
- int tmp=0;
- for (int i=1; i<10; i++)
- {
- if(arr[i]=='z') tmp++;
- }
- return tmp;
- }
- static void draw()
- {
- if (arr[7]!='z')
- {
- System.out.print(arr[7]);
- }
- else
- {
- System.out.print('*');
- }
- if (arr[8]!='z')
- {
- System.out.print(arr[8]);
- }
- else
- {
- System.out.print('*');
- }
- if (arr[9]!='z')
- {
- System.out.println(arr[9]);
- }
- else
- {
- System.out.println('*');
- }
- if (arr[4]!='z')
- {
- System.out.print(arr[4]);
- }
- else
- {
- System.out.print('*');
- }
- if (arr[5]!='z')
- {
- System.out.print(arr[5]);
- }
- else
- {
- System.out.print('*');
- }
- if (arr[6]!='z')
- {
- System.out.println(arr[6]);
- }
- else
- {
- System.out.println('*');
- }
- if (arr[1]!='z')
- {
- System.out.print(arr[1]);
- }
- else
- {
- System.out.print('*');
- }
- if (arr[2]!='z')
- {
- System.out.print(arr[2]);
- }
- else
- {
- System.out.print('*');
- }
- if (arr[3]!='z')
- {
- System.out.print(arr[3]);
- }
- else
- {
- System.out.print('*');
- }
- }
- public static void main(String[] args) {
- Scanner myObj = new Scanner(System.in);
- for (int i=0; i<10; i++)
- {
- arr[i]='z';
- }
- while (counter()>0)
- {
- char tmp =myObj.next().charAt(0);
- Boolean IsNumber=Character.isDigit(tmp);
- if (tmp=='r')
- {
- System.out.println("Updating");
- ServerDownloader();
- }
- if (IsNumber==true)
- {
- ServerDownloader();
- int tmp2=Character.getNumericValue(tmp);
- if (arr[tmp2]=='z')
- {
- arr[tmp2]=ttt;
- }
- else
- {
- System.out.println("Impossible move");
- }
- }
- else
- {
- }
- draw();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement