wordSearch プログラムで行き詰まっています。ユーザーが入力したmy からの単語で 2 次元配列を埋めようとしarrayList
ています。誰でも私を助けることができますか?
import java.io.* ;
import java.util.ArrayList ;
public class WordSearchPuzzle
{
private char[][] puzzle ;
private ArrayList<String> puzzleWords ;
private int letterCount = 0 ;
private int gridDimensions;
public WordSearchPuzzle(ArrayList<String> userSpecifiedWords)
{
this.puzzleWords = userSpecifiedWords ;
}
private void createPuzzleGrid()
{
int i;
for(i = 0; i < puzzleWords.size() ; i++){
letterCount = puzzleWords.size() + letterCount ;
}
gridDimensions = letterCount * 2;
puzzle = new char[gridDimensions][gridDimensions] ;
}
public void fill() {
int i, j, row, col;
boolean added;
for (i = 0; i < puzzleWords.size(); i++) {
row = (int) (Math.random() * this.gridDimensions);
col = (int) (Math.random() * this.gridDimensions);
added = false;
???