Browse Source

now generates completely. i shall say, v0.9. Added SBT.

Henry Jameson 9 years ago
parent
commit
eb7a09fc19

+ 1
- 0
.gitignore View File

@@ -15,6 +15,7 @@ local.properties
15 15
 .classpath
16 16
 .settings/
17 17
 .loadpath
18
+target
18 19
 
19 20
 # External tool builders
20 21
 .externalToolBuilders/

+ 7
- 0
build.sbt View File

@@ -0,0 +1,7 @@
1
+name := "Weeapass"
2
+
3
+version := "1.0"
4
+
5
+scalaVersion := "2.10.1"
6
+
7
+libraryDependencies += "com.beust" % "jcommander" % "1.30"

+ 1
- 0
project/plugins.sbt View File

@@ -0,0 +1 @@
1
+addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.4.0")

+ 0
- 9
src/Launcher.scala View File

@@ -1,9 +0,0 @@
1
-/**
2
- * Created with IntelliJ IDEA.
3
- * User: jcd
4
- * Date: 4/25/13
5
- * Time: 9:46 PM
6
- */
7
-object Launcher extends App{
8
-
9
-}

+ 38
- 0
src/main/scala/org/hjiri/weapass/Launcher.scala View File

@@ -0,0 +1,38 @@
1
+package org.hjiri.weapass
2
+import com.beust.jcommander.{JCommander, Parameter}
3
+
4
+
5
+/**
6
+ * Created with IntelliJ IDEA.
7
+ * User: jcd
8
+ * Date: 4/25/13
9
+ * Time: 9:46 PM
10
+ */
11
+object Launcher extends App{
12
+  object Args {
13
+    // Declared as var because JCommander assigns a new collection declared
14
+    // as java.util.List because that's what JCommander will replace it with.
15
+    // It'd be nice if JCommander would just use the provided List so this
16
+    // could be a val and a Scala LinkedList.
17
+    @Parameter(
18
+      names = Array("-l"),
19
+      description = "When genelatingu wolds use L instead of R")
20
+    var lefto: Boolean = false
21
+
22
+    @Parameter(
23
+      names = Array("-s"),
24
+      description = "When generating wordsh ushe S instead of SH")
25
+    var shisi: Boolean = false
26
+  }
27
+
28
+  if (args != null){
29
+    new JCommander(Args, args.toArray : _*)
30
+  }
31
+  val s:SyllableGenerator = new SyllableGenerator(!Args.shisi, !Args.lefto)
32
+	val w:WordGenerator = new WordGenerator(s)
33
+	for (i <- 1 to Randomizer.pickInt(2,5)){
34
+		System.out.print (w.generateWord.toString+" ")
35
+	}
36
+
37
+
38
+}

src/Randomizer.scala → src/main/scala/org/hjiri/weapass/Randomizer.scala View File

@@ -1,3 +1,5 @@
1
+package org.hjiri.weapass
2
+
1 3
 import scala.util.Random
2 4
 
3 5
 /**

src/Rarity.scala → src/main/scala/org/hjiri/weapass/Rarity.scala View File

@@ -1,3 +1,5 @@
1
+package org.hjiri.weapass
2
+
1 3
 /**
2 4
  * Created with IntelliJ IDEA.
3 5
  * User: jcd

src/Syllable.scala → src/main/scala/org/hjiri/weapass/Syllable.scala View File

@@ -1,3 +1,5 @@
1
+package org.hjiri.weapass
2
+
1 3
 /**
2 4
  * Created with IntelliJ IDEA.
3 5
  * User: jcd

src/SyllableGenerator.scala → src/main/scala/org/hjiri/weapass/SyllableGenerator.scala View File

@@ -1,10 +1,12 @@
1
+package org.hjiri.weapass
2
+
1 3
 /**
2 4
  * Created with IntelliJ IDEA.
3 5
  * User: jcd
4 6
  * Date: 4/25/13
5 7
  * Time: 9:54 PM
6 8
  */
7
-class SyllableGenerator (val useX: Boolean, val sInsteadOfsh: Boolean = false, val righto: Boolean = true){
9
+class SyllableGenerator (val sInsteadOfsh: Boolean = false, val righto: Boolean = true){
8 10
 	val sh = if (sInsteadOfsh) "s" else "sh"
9 11
 	val r = if (righto) "r" else "l"
10 12
 	val j = "j" // add option to replace with z?
@@ -34,13 +36,13 @@ class SyllableGenerator (val useX: Boolean, val sInsteadOfsh: Boolean = false, v
34 36
 		val rarity =
35 37
 		if (youonForce){
36 38
 			Rarity.Youon
37
-		} else if (Randomizer.pickWithProb(0.50)){
39
+		} else if (Randomizer.pickWithProb(0.80)){
38 40
 			Rarity.Common
39
-		} else if (Randomizer.pickWithProb(0.50)){
41
+		} else if (Randomizer.pickWithProb(0.70)){
40 42
 			Rarity.Uncommon
41
-		} else if (Randomizer.pickWithProb(0.50)){
43
+		} else if (Randomizer.pickWithProb(0.60)){
42 44
 			Rarity.Youon
43
-		} else if (Randomizer.pickWithProb(0.50)){
45
+		} else if (Randomizer.pickWithProb(0.75)){
44 46
 			Rarity.Epic
45 47
 		} else {
46 48
 			Rarity.EpicAlt

src/Word.scala → src/main/scala/org/hjiri/weapass/Word.scala View File

@@ -1,3 +1,5 @@
1
+package org.hjiri.weapass
2
+
1 3
 /**
2 4
  * Created with IntelliJ IDEA.
3 5
  * User: jcd

src/WordGenerator.scala → src/main/scala/org/hjiri/weapass/WordGenerator.scala View File

@@ -1,3 +1,5 @@
1
+package org.hjiri.weapass
2
+
1 3
 /**
2 4
  * Created with IntelliJ IDEA.
3 5
  * User: jcd
@@ -12,7 +14,7 @@ class WordGenerator(val sg:SyllableGenerator) {
12 14
 			val syllable =
13 15
 			if ((0 to 5 contains(word.n())) && Randomizer.pickWithProb(0.25)){
14 16
 				sg.generateSyllableV(useN = true)
15
-			} else if ((0 to 25 contains(word.vsyl())) && Randomizer.pickWithProb(0.49)){
17
+			} else if ((0 to 15 contains(word.vsyl())) && Randomizer.pickWithProb(0.25)){
16 18
 				sg.generateSyllableV(useN = false)
17 19
 			} else {
18 20
 				sg.generateSyllableF(youonForce = false, youonProhibit = lastYouon)

+ 0
- 48
src/testing.sc View File

@@ -1,48 +0,0 @@
1
-/**
2
- * Created with IntelliJ IDEA.
3
- * User: jcd
4
- * Date: 4/25/13
5
- * Time: 10:43 PM
6
- *
7
- * sample workspace file to view how generator behaves.
8
- */
9
-val s:SyllableGenerator = new SyllableGenerator(false, false, true)
10
-val w:WordGenerator = new WordGenerator(s)
11
-for (i <- 1 to 28){
12
-	System.out.println (w.generateWord.toString+" ")
13
-}
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-