import ucb.util.Stopwatch; import java.util.Scanner; /** A simple test of setting time limits. * @author */ public class TimeLimits { /** Alternately accept an arbitrary line of input from Player 1 and Player 2 * (both using the standard input). If the player has exhausted * his time limit at the time he finishes entering a line, * print an appropriate message. Continue until one player or the * other runs out of time. ARGS[0], a number (possibly with * decimal point) is the number of minutes each player gets. The * actual lines entered by the players are irrelevant (a simple * carriage return will do.) */ public static void main(String... args) { Scanner inp = new Scanner(System.in); // FILL IN while (true) { // FILL IN // REPLACE 0 with appropriate expression. System.out.print("Player 1 (%d seconds left): ", 0); System.out.flush(); inp.nextLine(); // FILL IN // REPLACE 0 with appropriate expression. System.out.print("Player 2 (%d seconds left): ", 0); System.out.flush(); inp.nextLine(); // FILL IN } } }