diff --git a/vic-class22-assignment/.eslintignore b/vic-class22-assignment/.eslintignore
new file mode 100644
index 0000000..e90e85f
--- /dev/null
+++ b/vic-class22-assignment/.eslintignore
@@ -0,0 +1,9 @@
+**/node_modules/*
+**/vendor/*
+**/build/*
+**/*.min.js
+*_bundle.js
+*.md
+package.json
+Procfile
+npm-debug.log
diff --git a/vic-class22-assignment/.eslintrc b/vic-class22-assignment/.eslintrc
new file mode 100644
index 0000000..4d749b1
--- /dev/null
+++ b/vic-class22-assignment/.eslintrc
@@ -0,0 +1,42 @@
+{
+"rules": {
+"no-console": 0,
+"indent": [
+2,
+2
+],
+"quotes": [
+2,
+"single"
+],
+"linebreak-style": [
+2,
+"unix"
+],
+"semi": [
+2,
+"always"
+]
+},
+"env": {
+"es6": true,
+"node": true,
+"browser": true,
+"mocha": true,
+"jasmine": true
+},
+"globals": {
+"describe": false,
+"it": false,
+"beforeEach": false,
+"afterEach": false,
+"before": false,
+"after": false
+},
+"ecmaFeatures": {
+"modules": true,
+"experimentalObjectRestSpread": true,
+"impliedStrict": true
+},
+"extends": "eslint:recommended"
+}
diff --git a/vic-class22-assignment/.gitignore b/vic-class22-assignment/.gitignore
new file mode 100644
index 0000000..19e2dfb
--- /dev/null
+++ b/vic-class22-assignment/.gitignore
@@ -0,0 +1,3 @@
+node_modules
+build
+*_bundle.js
diff --git a/vic-class22-assignment/app/css/app.css b/vic-class22-assignment/app/css/app.css
new file mode 100644
index 0000000..6b7fd67
--- /dev/null
+++ b/vic-class22-assignment/app/css/app.css
@@ -0,0 +1,20 @@
+main ul {
+ list-style-type: none;
+ margin: 5px;
+ display: block;
+ height: 400px;
+ width: 600px;
+ border: 1px solid black;
+}
+
+span.game-input {
+ color: green;
+}
+
+span.command-input {
+ color: blue;
+}
+
+span.user-input {
+ color: red;
+}
diff --git a/vic-class22-assignment/app/css/app.css.sav b/vic-class22-assignment/app/css/app.css.sav
new file mode 100644
index 0000000..e69de29
diff --git a/vic-class22-assignment/app/index.html b/vic-class22-assignment/app/index.html
new file mode 100644
index 0000000..845ce94
--- /dev/null
+++ b/vic-class22-assignment/app/index.html
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+ Text Adventure Game
+
+
+
+ Adventure Game:
+
+
+
+
+
+
diff --git a/vic-class22-assignment/app/js/client.js b/vic-class22-assignment/app/js/client.js
new file mode 100644
index 0000000..54f0d1c
--- /dev/null
+++ b/vic-class22-assignment/app/js/client.js
@@ -0,0 +1,6 @@
+'use strict';
+
+const angular = require('angular');
+
+var adventureApp = angular.module('adventureApp', []);
+require('./game/game')(adventureApp);
diff --git a/vic-class22-assignment/app/js/game/controllers/game-controller.js b/vic-class22-assignment/app/js/game/controllers/game-controller.js
new file mode 100644
index 0000000..cadcae5
--- /dev/null
+++ b/vic-class22-assignment/app/js/game/controllers/game-controller.js
@@ -0,0 +1,128 @@
+'use strict';
+
+module.exports = function(app) {
+ app.controller('GameController', GameController);
+};
+
+function GameController() {
+ this.model = {
+ userLocation: 'start',
+ userHasWeapon: false,
+ command: '',
+ gamelog: [],
+ location: {
+ 'start': {
+ commands: ['Enter ? for available commands at any time', 'enter door on left', 'enter door on right'],
+ prompt: 'Welcome to your Quest. You must acquire a weapon to defeat the a monster in order to leave this building.'
+ },
+ 'weaponroom': {
+ commands: ['take the dick\'s burger', 'take the beard oil', 'take the soccerball', 'take the iced tea', 'say ', 'walk through door'],
+ prompt: 'You are in the weapon room. There is a weapon in each corner, a dick\'s burger, beard oil, a soccerball, and iced tea. One of these items may defeat the monster you encounter.'
+ },
+ 'monsterroomwithoutweapon': {
+ commands: ['walk through door', 'say '],
+ prompt: 'You are in a room with a hairy monster.'
+ },
+ 'monsterroomwithweapon': {
+ commands:['pour beard oil on floor', 'feed monster dick\'s burger', 'quench monster thirst with iced tea', 'distract with soccerball'],
+ prompt: 'You are in a room with a monster and you have a weapon.'
+ }
+ }
+ };
+ GameController.prototype.startGame = function() {
+ this.model.gamelog = [];
+ this.model.userLocation = 'start';
+ this.model.userHasWeapon = false;
+ this.model.command = '';
+ this.model.gamelog.push({
+ src: 'game',
+ msg: this.model.location.start.prompt
+ });
+ this.model.location.start.commands.forEach((choice) => {
+ this.model.gamelog.push({
+ src: 'command',
+ msg: choice
+ });
+ });
+ this.model.userLocation = 'start';
+ };
+ GameController.prototype.processInput = function() {
+ this.model.gamelog.push({
+ src: 'user',
+ msg: this.model.command
+ });
+
+ switch (this.model.command) {
+ case '?':
+ this.model.gamelog.push({
+ src: 'command',
+ msg: this.currentHelpMsg()
+ });
+ break;
+ case 'enter door on left':
+ var currentLocation = this.model.userLocation;
+ if(currentLocation === 'weaponroom') {
+ currentLocation = this.model.userLocation = this.model.userHasWeapon ? 'monsterroomwithweapon' : 'monsterroomwithoutweapon';
+ this.model.gamelog.push({
+ src: 'game',
+ msg: this.model.location[currentLocation].prompt
+ });
+ } else {
+ this.model.userLocation = 'weaponroom';
+ this.model.gamelog.push({
+ src: 'game',
+ msg: this.model.location.weaponroom.prompt
+ });
+ }
+
+ this.model.gamelog.push({
+ src: 'game',
+ msg: this.currentHelpMsg()
+ });
+ break;
+ case 'take the dick\'s burger':
+ this.model.userHasWeapon = true;
+ break;
+
+ default:
+
+ var sayArr = this.model.command.split(' ');
+ if(sayArr[0] === 'say') {
+ this.model.gamelog.push({
+ src:'game',
+ msg: sayArr.split(1, sayArr.length).join(' ') || 'SPEAK!'
+ });
+ } else {
+ this.model.gamelog.push({
+ src: 'game',
+ msg: 'BAD COMMAND: Enter ? to see commands'
+ });
+ }
+ }
+ this.model.command = '';
+ };
+ GameController.prototype.currentHelpMsg = function() {
+ var str = '';
+ switch(this.model.userLocation) {
+ case 'start':
+ this.model.location.start.commands.forEach((choice, index) => {
+ str += index > 0 ? ' | ' : '';
+ str += choice;
+ });
+ break;
+ case 'weaponroom':
+ this.model.location.weaponroom.commands.forEach((choice, index) => {
+ str += index > 0 ? ' | ' : '';
+ str += choice;
+ });
+ break;
+ case 'monsterroomwithoutweapon':
+ this.model.location.monsterroomwithoutweapon.commands.forEach((choice, index) => {
+ str += index > 0 ? ' | ' : '';
+ str += choice;
+ });
+ break;
+ }
+ return str;
+ };
+}
diff --git a/vic-class22-assignment/app/js/game/game.js b/vic-class22-assignment/app/js/game/game.js
new file mode 100644
index 0000000..7f2d2c6
--- /dev/null
+++ b/vic-class22-assignment/app/js/game/game.js
@@ -0,0 +1,3 @@
+module.exports = function(app) {
+ require('./controllers/game-controller')(app);
+};
diff --git a/vic-class22-assignment/gulpfile.js b/vic-class22-assignment/gulpfile.js
new file mode 100644
index 0000000..8676c22
--- /dev/null
+++ b/vic-class22-assignment/gulpfile.js
@@ -0,0 +1,57 @@
+'use strict';
+
+const gulp = require('gulp');
+const eslint = require('gulp-eslint');
+const webpack = require('webpack-stream');
+
+var files = ['*.js', './app/*.js', './app/js/*.js', './app/js/game/*.js', './app/js/game/controllers/*.js'];
+
+const paths = {
+ js:__dirname + '/app/js/*.js',
+ html:__dirname + '/app/index.html',
+ css:__dirname + '/app/css/*.css'
+};
+
+gulp.task('lint', () => {
+ return gulp.src(files)
+ .pipe(eslint())
+ .pipe(eslint.format());
+});
+
+gulp.task('webpack:dev', () => {
+ return gulp.src(paths.js)
+ .pipe(webpack({
+ output: {
+ filename: 'bundle.js'
+ }
+ }))
+ .pipe(gulp.dest('build/'));
+});
+
+gulp.task('staticfiles:dev', () => {
+ return gulp.src(paths.html)
+ .pipe(gulp.dest('./build'));
+});
+
+gulp.task('staticcssfiles:dev', () => {
+ return gulp.src(paths.css)
+ .pipe(gulp.dest('./build'));
+});
+
+gulp.task('bundle:test', () => {
+ return gulp.src(__dirname + '/test/*_test.js')
+ .pipe(webpack({
+ output: {
+ filename: 'test_bundle.js'
+ }
+ }))
+ .pipe(gulp.dest(__dirname + '/test'));
+});
+
+gulp.task('build:dev', ['staticfiles:dev', 'staticcssfiles:dev', 'webpack:dev']);
+
+gulp.task('watch', () => {
+ gulp.watch(paths.js, ['lint', 'webpack:dev']);
+ gulp.watch(paths.html, ['staticfiles:dev']);
+ gulp.watch(paths.css, ['staticcssfiles:dev']);
+});
diff --git a/vic-class22-assignment/karma.conf.js b/vic-class22-assignment/karma.conf.js
new file mode 100644
index 0000000..a59771c
--- /dev/null
+++ b/vic-class22-assignment/karma.conf.js
@@ -0,0 +1,69 @@
+// Karma configuration
+// Generated on Thu Jun 16 2016 10:07:33 GMT-0700 (PDT)
+
+module.exports = function(config) {
+ config.set({
+
+ // base path that will be used to resolve all patterns (eg. files, exclude)
+ basePath: '',
+
+
+ // frameworks to use
+ // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+ frameworks: ['jasmine'],
+
+
+ // list of files / patterns to load in the browser
+ files: [
+ 'test/test_bundle.js'
+ ],
+
+
+ // list of files to exclude
+ exclude: [
+ ],
+
+
+ // preprocess matching files before serving them to the browser
+ // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
+ preprocessors: {
+ },
+
+
+ // test results reporter to use
+ // possible values: 'dots', 'progress'
+ // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+ reporters: ['progress'],
+
+
+ // web server port
+ port: 9876,
+
+
+ // enable / disable colors in the output (reporters and logs)
+ colors: true,
+
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ logLevel: config.LOG_INFO,
+
+
+ // enable / disable watching file and executing tests whenever any file changes
+ autoWatch: false,
+
+
+ // start these browsers
+ // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+ browsers: ['Chrome'],
+
+
+ // Continuous Integration mode
+ // if true, Karma captures browsers, runs the tests and exits
+ singleRun: true,
+
+ // Concurrency level
+ // how many browser should be started simultaneous
+ concurrency: Infinity
+ });
+};
diff --git a/vic-class22-assignment/package.json b/vic-class22-assignment/package.json
new file mode 100644
index 0000000..a1f336f
--- /dev/null
+++ b/vic-class22-assignment/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "vic-class22-assignment",
+ "version": "1.0.0",
+ "description": "",
+ "main": "gulpfile.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1",
+ "start": "node server.js"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "dependencies": {
+ "angular": "^1.5.6",
+ "express": "^4.13.4",
+ "express-static": "^1.0.3"
+ },
+ "devDependencies": {
+ "angular-mocks": "^1.5.7",
+ "gulp": "^3.9.1",
+ "gulp-eslint": "^2.0.0",
+ "gulp-watch": "^4.3.6",
+ "webpack-stream": "^3.2.0"
+ }
+}
diff --git a/vic-class22-assignment/server.js b/vic-class22-assignment/server.js
new file mode 100644
index 0000000..3cbd943
--- /dev/null
+++ b/vic-class22-assignment/server.js
@@ -0,0 +1,10 @@
+'use strict';
+
+const express = require('express');
+const app = express();
+
+app.use(express.static(__dirname + '/build'));
+
+const server = app.listen(3000, function() {
+ console.log('server is listening on %s', server.address().port);
+});
diff --git a/vic-class22-assignment/test/browser_test.js b/vic-class22-assignment/test/browser_test.js
new file mode 100644
index 0000000..736317c
--- /dev/null
+++ b/vic-class22-assignment/test/browser_test.js
@@ -0,0 +1,27 @@
+'use strict';
+
+const angular = require('angular');
+
+require('angular-mocks');
+require('../app/js/client');
+
+describe('Controller Tests', () => {
+ let firstctrl;
+
+ beforeEach(() => {
+ angular.mock.module('adventureApp');
+ angular.mock.inject(function($controller) {
+ firstctrl = new $controller('GameController');
+ });
+ });
+
+ it('should have a property gamelog', () => {
+ console.log(firstctrl);
+ expect(Array.isArray(firstctrl.model.gamelog)).toBe(true);
+ });
+
+ it('should start the game', () => {
+ firstctrl.startGame();
+ expect(firstctrl.model.userLocation).toBe('start');
+ });
+});