This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tty, sys | |
from interface import Interface | |
class Game: | |
def __init__(self): | |
self.X = [] | |
self.O = [] | |
self.cursor_row = 0 | |
self.cursor_column = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="board"> | |
<div class="row" ng-repeat="row in boards[0] track by $index"> | |
<div class="cell-container" ng-repeat="cell in row track by $index"> | |
<div class="cell {{cell}}"></div> | |
</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var lifeControllers = angular.module("lifeControllers", []); | |
lifeApp.controller("BoardCtrl", ["$scope", "$http", "$timeout", | |
function($scope, $http, $timeout){ | |
$http.get("/random_board").success(function(data){ | |
$scope.boards = data; | |
var loading = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
configure do | |
set :root, File.dirname(__FILE__) | |
set :public_folder, "public/app" | |
end | |
get "/" do | |
File.read("public/app/index.html") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var lifeApp = angular.module("lifeApp", [ | |
"ngRoute", | |
"lifeControllers" | |
]); | |
lifeApp.config(["$routeProvider", | |
function($routeProvider){ | |
$routeProvider. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html ng-app="lifeApp"> | |
<head> | |
<title>The Game of Life</title> | |
<link href="/css/normalize.css" type="text/css" rel="stylesheet"> | |
<link href="/css/app.css" type="text/css" rel="stylesheet"> | |
<script src="lib/jquery/jquery-1.10.2.min.js"></script> | |
<script src="lib/angular/angular.min.js"></script> | |
<script src="lib/angular/angular-route.min.js"></script> | |
<script src="lib/angular/angular-resource.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get "/random_board" do | |
board = Board.new(20,20) | |
board.starting_move!(board.randomize_start) | |
turns = [] | |
turns << board.cell_states | |
50.times do | |
board.evaluate_all | |
board.tick! | |
turns << board.cell_states | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What does the following code print to the console? | |
var person = { | |
name: "Joe Camel", | |
age: 42, | |
status: "dead" | |
} | |
console.log(typeof person); | |
ans: object | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function target(threat){ | |
function attack(weapon){ | |
return 'You attack a ' + threat + ' with a ' + weapon + '.'; | |
} | |
return attack; | |
} | |
var targetZombie = target("zombie"); | |
targetZombie("chainsaw"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What does the following expression return? | |
4 > 1; | |
What does the following expression return? | |
"chatty" === "chatty"; | |
NewerOlder