diff --git a/modules/report/commands.js b/modules/report/commands.js index 3dd79e1..3b24df3 100644 --- a/modules/report/commands.js +++ b/modules/report/commands.js @@ -295,8 +295,6 @@ var commands = function(dbot) { commands['~ununsub'].regex = [/^ununsub ([^ ]+)$/, 2]; commands['~ustatus'].regex = [/^ustatus ([^ ]+)$/, 2]; commands['~sustatus'].regex = [/^sustatus ([^ ]+)$/, 2]; - commands['~nunsub'].access = 'power_user'; - commands['~ununsub'].access = 'power_user'; return commands; }; diff --git a/modules/wordcrimes/config.json b/modules/wordcrimes/config.json index 9392f57..4c768eb 100644 --- a/modules/wordcrimes/config.json +++ b/modules/wordcrimes/config.json @@ -1,258 +1,14 @@ { "dict": "/usr/share/dict/british-english", "puzzles": [ - { - "type": "end", - "part": "er" - }, - { - "type": "end", - "part": "or" - }, - { - "type": "end", - "part": "ance" - }, - { - "type": "end", - "part": "ence" - }, - { - "type": "end", - "part": "ant" - }, - { - "type": "end", - "part": "ent" - }, - { - "type": "end", - "part": "ee" - }, - { - "type": "end", - "part": "ess" - }, - { - "type": "end", - "part": "ian" - }, - { - "type": "end", - "part": "ism" - }, - { - "type": "end", - "part": "ics" - }, - { - "type": "end", - "part": "ist" - }, - { - "type": "end", - "part": "ity" - }, - { - "type": "end", - "part": "ment" - }, - { - "type": "end", - "part": "ness" - }, - { - "type": "end", - "part": "ship" - }, - { - "type": "end", - "part": "tion" - }, - { - "type": "end", - "part": "ation" - }, - { - "type": "end", - "part": "ate" - }, - { - "type": "end", - "part": "ify" - }, - { - "type": "end", - "part": "ize" - }, - { - "type": "end", - "part": "able" - }, - { - "type": "end", - "part": "ible" - }, - { - "type": "end", - "part": "al" - }, - { - "type": "end", - "part": "ful" - }, - { - "type": "end", - "part": "ish" - }, - { - "type": "end", - "part": "ive" - }, - { - "type": "end", - "part": "ous" - }, - { - "type": "end", - "part": "ious" - }, - { - "type": "end", - "part": "ly" - }, - { - "type": "end", - "part": "ally" - }, { "type": "start", - "part": "anti" - }, - { - "type": "start", - "part": "bi" - }, - { - "type": "start", - "part": "contra" - }, - { - "type": "start", - "part": "di" - }, - { - "type": "start", - "part": "dis" - }, - { - "type": "start", - "part": "ex" - }, - { - "type": "start", - "part": "extra" - }, - { - "type": "start", - "part": "hyper" - }, - { - "type": "start", - "part": "in" - }, - { - "type": "start", - "part": "inter" - }, - { - "type": "start", - "part": "intra" - }, - { - "type": "start", - "part": "intro" - }, - { - "type": "start", - "part": "macro" - }, - { - "type": "start", - "part": "micro" - }, - { - "type": "start", - "part": "mis" - }, - { - "type": "start", - "part": "mono" - }, - { - "type": "start", - "part": "multi" - }, - { - "type": "start", - "part": "neo" - }, - { - "type": "start", - "part": "non" - }, - { - "type": "start", - "part": "omni" - }, - { - "type": "start", - "part": "poly" - }, - { - "type": "start", - "part": "post" - }, - { - "type": "start", - "part": "pre" + "part": "en" }, { "type": "start", "part": "re" }, - { - "type": "start", - "part": "retro" - }, - { - "type": "start", - "part": "semi" - }, - { - "type": "start", - "part": "sub" - }, - { - "type": "start", - "part": "super" - }, - { - "type": "start", - "part": "tri" - }, - { - "type": "start", - "part": "un" - }, - { - "type": "start", - "part": "uni" - }, - { - "type": "start", - "part": "en" - }, { "type": "end", "part": "tain" @@ -266,5 +22,5 @@ "part": "under" } ], - "allowed_chans": [ "#realitree", "#realitwo" ] + "allowed_chans": [ "#realitree" ] } diff --git a/modules/wordcrimes/wordcrimes.js b/modules/wordcrimes/wordcrimes.js index 8a2a3fe..919e8f5 100644 --- a/modules/wordcrimes/wordcrimes.js +++ b/modules/wordcrimes/wordcrimes.js @@ -8,96 +8,34 @@ var fs = require('fs'), var wordcrimes = function(dbot) { this.game = null; - this.internalAPI = { - 'createPuzzle': function(channel) { - // if(_.random(0, 3) === 1) { - return this.internalAPI.createAnagramPuzzle(channel); - // } - - var puzzle = this.puzzles[_.random(0, this.puzzles.length -1)], - solutions = _.filter(this.dict, function(word) { - if(puzzle.type === 'start') { - return word.match('^' + puzzle.part); - } else if(puzzle.type === 'end') { - return word.match(puzzle.part + '$'); - } - }); - - this.game = { - 'puzzle': puzzle, - 'solutions': solutions, - 'channel': channel, - 'found': [], - 'scores': {} - }; - - return true; - }.bind(this), - - 'createAnagramPuzzle': function(channel) { - var randomV = function(len) { - var chars = "aeiou"; - return len ? chars.charAt(~~(Math.random()*chars.length)) + randomV(len-1) : ""; - }; - var randomC = function(len) { - var chars = "bcdfghklmnpqrstvwxyz"; - return len ? chars.charAt(~~(Math.random()*chars.length)) + randomC(len-1) : ""; - }; - var puzzle = { - 'type': 'anagram', - 'part': (randomV(3) + randomC(6)).split('').sort(function(){return 0.5-Math.random();}).join('') - }; - - var partArr = puzzle.part.split(''), - solutions = _.filter(this.dict, function(word) { - return (word.length > 1 && _.difference(word.split(''), partArr).length === 0); - }); - - if(solutions.length < 30) { - return this.internalAPI.createAnagramPuzzle(channel); - } - - this.game = { - 'puzzle': puzzle, - 'solutions': solutions, - 'channel': channel, - 'found': [], - 'scores': {} - }; - - return true; - - }.bind(this) - }; - this.commands = { '~startgame': function(event) { - if(_.isNull(this.game) && _.include(this.config.allowed_chans, event.channel.name)) { - this.game = {}; + if(!this.game && _.include(this.config.allowed_chans, event.channel.name)) { event.reply('WORD GAME STARTING IN 5 SECONDS'); setTimeout(function() { - this.internalAPI.createPuzzle(event.channel.name); - - var game = this.game; + var puzzle = this.puzzles[_.random(0, this.puzzles.length -1)], + solutions = _.filter(this.dict, function(word) { + if(puzzle.type === 'start') { + return word.match('^' + puzzle.part); + } else if(puzzle.type === 'end') { + return word.match(puzzle.part + '$'); + } + }); - if(game.puzzle.type === 'start') { - event.reply('NAME ALL THE WORDS YOU CAN THINK OF THAT START WITH ' + game.puzzle.part); - } else if(game.puzzle.type === 'end') { - event.reply('NAME ALL THE WORDS YOU CAN THINK OF THAT END IN ' + game.puzzle.part); - } else if(game.puzzle.type === 'anagram') { - event.reply('NAME ALL THE ANAGRAMS OF ' + game.puzzle.part); + this.game = { + 'puzzle': puzzle, + 'solutions': solutions, + 'channel': event.channel.name, + 'found': [], + 'scores': {} + }; + + if(puzzle.type === 'start') { + event.reply('NAME ALL THE WORDS YOU CAN THINK OF THAT START WITH ' + puzzle.part); + } else if(puzzle.type === 'end') { + event.reply('NAME ALL THE WORDS YOU CAN THINK OF THAT END IN ' + puzzle.part); } - /* setTimeout(function() { - if(!_.isNull(this.game)) { - event.reply('30 SECONDS REMAINING'); - } - }.bind(this), 30000);*/ - setTimeout(function() { - if(!_.isNull(this.game)) { - event.reply('10 SECONDS REMAINING'); - } - }.bind(this), 20000); setTimeout(function() { if(!_.isNull(this.game)) { if(this.game.found.length > 0) { @@ -109,10 +47,8 @@ var wordcrimes = function(dbot) { } this.game = null; } - }.bind(this), 30000); + }.bind(this), 40000); }.bind(this), 5000); - } else { - event.reply('GAME ALREADY RUNNING'); } } }; diff --git a/views/layout.jade b/views/layout.jade index 0b198ae..b1b22d7 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -4,7 +4,6 @@ html(lang='en') meta(charset='utf-8') script(type="text/javascript", src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js") script(type="text/javascript", src="/fs_edit.js") - script(type="text/javascritp" src="project.js") link(rel="stylesheet", type="text/css", href="http://fonts.googleapis.com/css?family=Source+Sans+Pro") link(rel="stylesheet", type="text/css", href="/bootstrap/css/bootstrap.min.css") link(rel='stylesheet', type='text/css', href='/styles.css') @@ -26,5 +25,5 @@ html(lang='en') a#bread(href='/login') Login script(type="text/javascript", src="/bootstrap/js/bootstrap.min.js") - script(type="text/javascript", src="/d3/d3.min.js") + script(type="text/javascript", src="/d3/d3.v3.min.js") script(type="text/javascript", src="/script.js") diff --git a/views/project/project.jade b/views/project/project.jade index c3dcc55..1cbf597 100644 --- a/views/project/project.jade +++ b/views/project/project.jade @@ -1,7 +1,18 @@ -extends ../layout - -block content +!!! +html(lang='#{curr839}') + head + meta(charset='utf-8') + script(type="text/javascript", src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js") + link(rel="stylesheet", type="text/css", href="http://fonts.googleapis.com/css?family=Source+Sans+Pro") + link(rel="stylesheet", type="text/css", href="/bootstrap/css/bootstrap.min.css") + link(rel='stylesheet', type='text/css', href='/styles.css') + link(rel="stylesheet", href="/project.css") + script(src="../project.js") + body div.container + div#page + div#title #{pagetitle} + div.container#main p.intro #{dquote} section#git h2 #{development}