@@ -72,17 +72,17 @@ const scoringAlgorithms = [
72
72
{
73
73
"name" : "Simple Score" ,
74
74
"description" : "Each letter is worth 1 point." ,
75
- "scorerFunction" : simpleScorer ( )
75
+ "scorerFunction" : simpleScorer
76
76
} ,
77
77
{
78
78
"name" : "Vowel Bonus" ,
79
79
"description" : "Vowels are 3 points." ,
80
- "scorerFunction" : vowelBonusScorer ( )
80
+ "scorerFunction" : vowelBonusScorer
81
81
} ,
82
82
{
83
83
"name" : "Scrabble" ,
84
84
"description" : "Uses scabble point system." ,
85
- "scorerFunction" : oldScrabbleScorer ( )
85
+ "scorerFunction" : oldScrabbleScorer
86
86
}
87
87
] ;
88
88
@@ -92,7 +92,7 @@ function scorerPrompt() {
92
92
while ( scorerProgramIndex < 0 || scorerProgramIndex > 2 || isNaN ( scorerProgramIndex ) ) {
93
93
scorerProgramIndex = input . question ( `Please enter a number from 0-2. What scoring algorithym would you like to use? ${ scorerOptions } ` ) ;
94
94
}
95
- return
95
+ return scoringAlgorithms [ scorerProgramIndex ] ;
96
96
} ;
97
97
// create an array with the scorer functions, from the user input, call the relavant algorithym and print the word and score
98
98
@@ -101,10 +101,11 @@ function transform() { };
101
101
function runProgram ( ) {
102
102
initialPrompt ( ) ;
103
103
scorerPrompt ( ) ;
104
-
104
+
105
105
// Somehow I need to take the returned index from the user's response and call the selected algorithym, printing the word and score
106
106
}
107
-
107
+ console . log ( "algorithym name: " , scoringAlgorithms [ 2 ] . name ) ;
108
+ console . log ( "scorerFunction result: " , scoringAlgorithms [ 2 ] . scorerFunction ( 'JavaScript' ) ) ;
108
109
// Don't write any code below this line //
109
110
// And don't change these or your program will not run as expected //
110
111
module . exports = {
0 commit comments