📜  石头剪刀布java代码示例

📅  最后修改于: 2022-03-11 14:52:05.148000             🧑  作者: Mango

代码示例1
import java.util.Random;

public class RandomComputerPlayer implements RPSPlayer {
    private final Random random;

    public RandomComputerPlayer(Random random) {
        this.random = random;
    }

    public String play() {
        return CHOICES[this.random.nextInt(CHOICES.length)];
    }
}