I'm setting up a game board. Grid is the actual board with characters, and gameBoard is what's shown to the user. Both methods use the same 2 variables to create the arrays, except the variables are user inputs, and when I compile I am asked twice to enter the RxC.
我正在建立一个游戏板。 Grid是具有字符的实际板,gameBoard是向用户显示的内容。两种方法使用相同的2个变量来创建数组,除了变量是用户输入,当我编译时,我被要求两次输入RxC。
How can I run both grid and game board, without having to call new Grid() again?
如何运行网格和游戏板,而无需再次调用新的Grid()?
public class Controller
{
public void start()
{
String result = "";
Grid grid = new Grid();
grid.addMines();
grid.update();
View view = new View();
Grid gameBoard = new Grid();
result = gameBoard.toString();
view.display(result);
}
}
1 个解决方案
#1
1
Confusion between naming object in Controller class, Solution is
在Controller类中命名对象之间的混淆,解决方案是
String result = "";
Grid grid = new Grid();
grid.addMines();
grid.update();
grid.gameBoard();
View view = new View();
result = grid.toString();
view.display(result);
#1
1
Confusion between naming object in Controller class, Solution is
在Controller类中命名对象之间的混淆,解决方案是
String result = "";
Grid grid = new Grid();
grid.addMines();
grid.update();
grid.gameBoard();
View view = new View();
result = grid.toString();
view.display(result);