Created
April 16, 2018 08:06
-
-
Save MojamojaK/92d8d7150f0af286a98ff5021d7e7784 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Client with unthreaded ClientCommunication | |
import java.io.*; | |
import java.net.*; | |
import java.util.Scanner; | |
public class Client{ | |
public static void main(String[] args) throws IOException{ | |
ClientCommunication comm = new ClientCommunication(args); | |
while (true) { | |
comm.update(); | |
Scanner sc=new Scanner(System.in); | |
char hand = (char)sc.nextByte(); //何を出すかを入力 | |
comm.sendMessage(hand); | |
if (comm.inboxSize() > 0) { | |
char message = comm.getMessage(); | |
System.out.println(message); //勝敗を出力 | |
if(message == 'l' || message == 'c') { //loseが送られてきたら終わり | |
break; | |
} | |
} | |
} | |
comm.sendMessage('e'); | |
comm.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment