Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jefferson10147/lettersoup-algorithm
This java class generates a randomly letter soup in a matrix of order size*size.
https://github.com/jefferson10147/lettersoup-algorithm
algorithm java matrix
Last synced: 11 days ago
JSON representation
This java class generates a randomly letter soup in a matrix of order size*size.
- Host: GitHub
- URL: https://github.com/jefferson10147/lettersoup-algorithm
- Owner: jefferson10147
- License: gpl-3.0
- Created: 2020-01-21T15:37:31.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-04T15:40:57.000Z (over 3 years ago)
- Last Synced: 2023-03-04T14:40:39.056Z (over 1 year ago)
- Topics: algorithm, java, matrix
- Language: Java
- Homepage:
- Size: 48.8 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Letter Soup Java Algorithm
The complexity of this algorithm is based on the numers of words you like to write inside the matrix,
and how big matrix is, this means if you want to write a big numbers of words inside a small matrix,
the algorithm will take some time to find the correct state where the whole words are inside matrix.
And you have to be SURE that the words you like to write inside the matrix can be writen in at least one state,
this can be solved simple as counting the whole letters of your words and comparing if this number is <= that NxN.## How to use this algorithm:
* Make an instance of LetterSoup class, just passing to the constructor the order of the matrix that you like to create, and now you can get the letter soup matrix with just one method, example:
```java
public static void main(String[ ] arg)
{
LetterSoup Game = new LetterSoup(10);
char [][]matrix = Game.getMatrix();for(int i = 0; i < matrix.length; i++)
{
for(int j = 0; j < matrix[i].length; j++)
System.out.print(matrix[i][j]+" ");System.out.println("\n");
}
}
```
* To choose which words are going to be inside the matrix, modify this Class atribute```java
private String [] words = { "pez", "oso","ave","boa","lobo","gato"};
```