Posts by MDordio • 35 points
5 posts
-
0
votes1
answer421
viewsQ: Write a file with the contents of an array
I have an array of char grid and I want to write a file with its contents. Here’s the code I made: public static String getGrid() { String text = String.valueOf(grid); return text; } public static…
-
0
votes1
answer52
viewsA: Adapt user input to array size
Taking into account previous tips and some research, I found the following solution to my previous problem: public static int getRow() { String nrow = JOptionPane.showInputDialog(null, "Insira o nº…
-
1
votes1
answer52
viewsQ: Adapt user input to array size
I created a program that generates mazes that can be solved, but now I’m not able to implement a way for the size of the generated maze to be defined by the user. The code below is ActionListener of…
-
1
votes1
answer115
viewsQ: Generate grid with random characters - java
I intend to create a grid that is filled randomly or with "W" or "_" and I did the following: public class Gerador_grelha { public static void main(String[] args) { int row = 5; int col = 5;…
-
1
votes0
answers79
viewsQ: How to start an array in another class - java
I’m trying to implement the Depth first algorithm to solve a maze, like the one below, where the starting position is S and the output is E _SW______\n _WWW_W_WW\n _____W__E\n In the Mazereader…