dice.java

来自「Java based Snakes and Ladders game.」· Java 代码 · 共 23 行

JAVA
23
字号
// Description: This class is for the dice of the game, getting player rolls.public class Dice{    // Variables Of class Dice    private Gui gui;    // The Constructor of class Dice    public Dice(){        gui = new Gui();        // Empty               // this.gui = gUI1;    }    // Method of rolling the dice.    public int rollDice(){        // Roll the Dice        int diceroll = (int)(6*Math.random() + 1);  // Range 1-6        diceroll = diceroll;            gui.drawDice(diceroll);        return diceroll;        // End of roll    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?