Created
April 16, 2018 08:03
-
-
Save MojamojaK/cb85f00e3bd46a1d70c0ce07a9d29a91 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 using threaded 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) { | |
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