Created
April 14, 2017 20:47
-
-
Save gnmearacaun/621c871d9925d7a999c9079b5768d36a to your computer and use it in GitHub Desktop.
just another word search game
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.7 (1)" project-jdk-type="JavaSDK"> | |
<output url="file://$PROJECT_DIR$/out" /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/ajavaProje17.iml" filepath="$PROJECT_DIR$/ajavaProje17.iml" /> | |
</modules> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="WEB_MODULE" version="4"> | |
<component name="NewModuleRootManager" inherit-compiler-output="true"> | |
<exclude-output /> | |
<content url="file://$MODULE_DIR$" /> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*import java.util.Arrays; | |
import java.util.ArrayList; | |
public class WordSearchPuzzle { | |
private char[][] puzzle ; | |
private List<String> puzzleWords ; | |
puzzleWords = new List<String>( Arrays.aslist( "this", "that","these", | |
"those", "i", "you", | |
"them","us","it","is", | |
"on", "off", "up", | |
"down", "whatever")); | |
// can use basicEnglish.txt as an example | |
private int wordCount ; | |
public class WordSearchPuzzle { | |
private ArrayList<String> index; | |
private ArrayList<String> exceptions; | |
public WordSearchPuzzle () { | |
index = new ArrayList<String>(); | |
} | |
public boolean add(String word) { | |
public WordSearchPuzzle(List<String> userSpecifiedWords) { | |
// puzzle generation using user specified words | |
// The user passes in a list of words to be used | |
// for generating the word search grid. | |
} | |
public WordSearchPuzzle(String wordFile, int wordCount, | |
int shortest, int longest) { | |
// puzzle generation using words from a file | |
// The user supplies the filename. In the file | |
// the words should appear one per line. | |
// to (randomly) select from the file for use in | |
// the puzzle. | |
// shortest and longest specify the shortest | |
// word length to be used and longest specifies | |
// the longest word length to be used. | |
// SO, using the words in the file randomly select | |
// wordCount words with lengths between shortest | |
// and longest. | |
// The class provides an operation that returns the list of words used in the puzzle. The header is as follows | |
public List<String> getWordSearchList() | |
// The class provides an operation that returns the generated grid as a two-dimensional array of characters. The header is as follows | |
public char[][] getPuzzleAsGrid() | |
// The class provides an operation that returns the generated grid as a String with newlines (i.e. \n) at the end of each line/row of the grid. The header is as follows | |
public String getPuzzleAsString() | |
// The class provides an operation that displays the grid and the list of words on the screen. The header is as follows | |
public void showWordSearchPuzzle() | |
// The class should include a private method with the following header | |
private void generateWordSearchPuzzle() | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Map; | |
/** | |
* Created by briain on 06/04/17. | |
*/ | |
public class WordSearch { | |
private char[][] grid; | |
private ArrayList<String> words; | |
private int dimension; | |
// | |
WordSearch (ArrayList<String> aList){ | |
words= aList; | |
dimension= getDimension(); | |
System.out.print(dimension); | |
createGrid(); | |
} | |
int getDimension(){ | |
double result =0; | |
for( int i=0; i<words.size(); i++){ | |
result+= words.get(i).length(); | |
} | |
result*=1.75; | |
result=Math.sqrt(result); | |
result= Math.ceil(result); | |
return (int)result; | |
} | |
void createGrid(){ | |
//create a 2d grid fixed size that reference 'grid' | |
// | |
//loop through each row | |
/// fill | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
class Wsldriver { | |
public static void main (String[] args){ | |
WordSearch wpuzzle = new WordSearch (new ArrayList<String>(Arrays.asList( "this", "that","these", | |
"those", "i", "you", | |
"them","us","it","is", | |
"on", "off", "up", | |
"down", "whatever"))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment