Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.dvorkin;
- import java.util.Arrays;
- import java.util.Scanner;
- public class NimConsoleView {
- NimModel model;
- Scanner in = new Scanner(System.in);
- public NimConsoleView(NimModel model) {
- this.model = model;
- }
- public int[] interact() {
- System.out.println("Field: " +
- Arrays.toString(model.getField()));
- int player = model.whoMoves() ? 1 : 2;
- System.out.println("Player " + player + ", make your move:");
- int index = in.nextInt() - 1;
- int amount = in.nextInt();
- return new int[]{index, amount};
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement