change demo url
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
Similar Words Game.
|
||||
============
|
||||
A demo is on http://w.r0xy.it/
|
||||
|
||||
A demo is on https://similarwords.31337.it/
|
||||
|
||||
To create your own wordlist just edit ```createwordlist.js``` and run it with ```node```.
|
||||
|
@@ -25,7 +25,8 @@ if (typeof(sw) == 'undefined') {
|
||||
|
||||
var getKey = function(obj) {
|
||||
var word = [];
|
||||
for(var k in obj) word.push(k);
|
||||
for ( var k in obj)
|
||||
word.push(k);
|
||||
return word[0];
|
||||
};
|
||||
|
||||
@@ -40,7 +41,10 @@ if (typeof(sw) == 'undefined') {
|
||||
similar.push(word);
|
||||
similar = shuffle(similar);
|
||||
|
||||
return {word: word, similar: similar};
|
||||
return {
|
||||
word: word,
|
||||
similar: similar
|
||||
};
|
||||
};
|
||||
|
||||
var startGame = function(word) {
|
||||
@@ -59,15 +63,20 @@ if (typeof(sw) == 'undefined') {
|
||||
|
||||
if (sw.finaltime > 33) {
|
||||
result = 'You can do better!';
|
||||
};
|
||||
}
|
||||
if (sw.finaltime > 36) {
|
||||
result = 'meh...';
|
||||
};
|
||||
}
|
||||
if (sw.wrongWords > 0 && sw.finaltime <= 32) {
|
||||
result = 'You are fast, but you made errors';
|
||||
};
|
||||
}
|
||||
|
||||
$("#main").empty().html('views/gameover.ejs', {result: result, time: sw.finaltime, wrong: sw.wrongWords, correct: sw.correctWords});
|
||||
$("#main").empty().html('views/gameover.ejs', {
|
||||
result: result,
|
||||
time: sw.finaltime,
|
||||
wrong: sw.wrongWords,
|
||||
correct: sw.correctWords
|
||||
});
|
||||
};
|
||||
|
||||
var startNewGame = function() {
|
||||
@@ -142,7 +151,7 @@ if (typeof(sw) == 'undefined') {
|
||||
}
|
||||
$('.word-button').addClass('disabled');
|
||||
|
||||
var wrongWord = undefined;
|
||||
var wrongWord;
|
||||
if (sw.currentWord.word == el.html()) {
|
||||
sw.correctWords = sw.correctWords + 1;
|
||||
sw.rounds += 1;
|
||||
@@ -171,7 +180,7 @@ if (typeof(sw) == 'undefined') {
|
||||
sw.time = 0;
|
||||
sw.finaltime = 0;
|
||||
sw.gameover = false;
|
||||
sw.currentWord;
|
||||
sw.currentWord = '';
|
||||
})(jQuery);
|
||||
|
||||
|
||||
@@ -197,4 +206,3 @@ if (typeof(sw) == 'undefined') {
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
|
@@ -19,7 +19,8 @@ fs.readFile(dict, 'utf8', function(err, data) {
|
||||
if (word.length > 6 && word.length < 10) {
|
||||
// console.log('using ' + word);
|
||||
words.push(word);
|
||||
};
|
||||
}
|
||||
;
|
||||
}
|
||||
console.log('using ' + words.length + ' words out of the dictionary');
|
||||
|
||||
@@ -52,7 +53,7 @@ fs.readFile(dict, 'utf8', function(err, data) {
|
||||
}
|
||||
|
||||
// add to dictionary?
|
||||
if(matches.length >= 4) {
|
||||
if (matches.length >= 6) {
|
||||
console.log('using ' + word);
|
||||
var mw = {};
|
||||
mw[word] = matches;
|
||||
@@ -67,6 +68,8 @@ fs.readFile(dict, 'utf8', function(err, data) {
|
||||
|
||||
|
||||
console.log('final result');
|
||||
console.log(JSON.stringify(matchingWordlist));
|
||||
console.log(JSON.stringify({
|
||||
words: matchingWordlist
|
||||
}));
|
||||
process.exit(0);
|
||||
});
|
||||
|
Reference in New Issue
Block a user