diff --git a/05week/checkers.js b/05week/checkers.js
index 8f33a089c..df173410a 100644
--- a/05week/checkers.js
+++ b/05week/checkers.js
@@ -7,15 +7,29 @@ const rl = readline.createInterface({
output: process.stdout
});
+// code plan
+// movechecker(s,e)
+// use .split for start and end
+// make the end equal the start in side function
+// islegal function is necessary
+// how to kill a checker
+// use object to describe board
-function Checker() {
- // Your code here
+function Checker(color) {
+ if (color === 'white') {
+ this.symbol = String.fromCharCode(0x125CF);
+ this.color = 'white';
+ }
+ else {
+ this.symbol = String.fromCharCode(0x125CB);
+ this.color = 'black';
+ }
}
function Board() {
this.grid = [];
// creates an 8x8 array, filled with null values
- this.createGrid = function() {
+ this.createGrid = () => {
// loop to create the 8 rows
for (let row = 0; row < 8; row++) {
this.grid[row] = [];
@@ -27,7 +41,7 @@ function Board() {
};
// prints out the board
- this.viewGrid = function() {
+ this.viewGrid = () => {
// add our column numbers
let string = " 0 1 2 3 4 5 6 7\n";
for (let row = 0; row < 8; row++) {
@@ -51,17 +65,42 @@ function Board() {
}
console.log(string);
};
+ this.populateGrid = () => {
+ // loops through the 8 rows
+ for (let row = 0; row < 8; row++) {
+ // ignores rows which should be empty
+ if (row === 3 || row === 4) continue;
+ // loops through the 8 columns
+ for (let col = 0; col < 8; col++) {
+ // sets current color based on the current row
+ let color = (row < 3 ? 'white' : 'black');
+ // alternates cells to populate with either white or black checkers
+ // then pushes checker to array named checkers
+ if (row % 2 === 0 && col % 2 === 1) {
+ this.grid[row][col] = new Checker(color);
+ } else if (row % 2 === 1 && col % 2 === 0) {
+ this.grid[row][col] = new Checker(color);
+ }
+ }
+ }
+ };
// Your code here
}
+
+
function Game() {
this.board = new Board();
this.start = function() {
this.board.createGrid();
- // Your code here
+ this.board.populateGrid();
};
+ // your code here
+ this.moveChecker = (whichPiece, toWhere) => {
+ whichPiece.Split
+ }
}
function getPrompt() {
diff --git a/07week/react-tictactoe/.gitignore b/07week/react-tictactoe/.gitignore
new file mode 100644
index 000000000..d30f40ef4
--- /dev/null
+++ b/07week/react-tictactoe/.gitignore
@@ -0,0 +1,21 @@
+# See https://help.github.com/ignore-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+
+# testing
+/coverage
+
+# production
+/build
+
+# misc
+.DS_Store
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
diff --git a/07week/react-tictactoe/README.md b/07week/react-tictactoe/README.md
new file mode 100644
index 000000000..b8c0b74df
--- /dev/null
+++ b/07week/react-tictactoe/README.md
@@ -0,0 +1,2229 @@
+This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).
+
+Below you will find some information on how to perform common tasks.
+You can find the most recent version of this guide [here](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md).
+
+## Table of Contents
+
+- [Updating to New Releases](#updating-to-new-releases)
+- [Sending Feedback](#sending-feedback)
+- [Folder Structure](#folder-structure)
+- [Available Scripts](#available-scripts)
+ - [npm start](#npm-start)
+ - [npm test](#npm-test)
+ - [npm run build](#npm-run-build)
+ - [npm run eject](#npm-run-eject)
+- [Supported Language Features and Polyfills](#supported-language-features-and-polyfills)
+- [Syntax Highlighting in the Editor](#syntax-highlighting-in-the-editor)
+- [Displaying Lint Output in the Editor](#displaying-lint-output-in-the-editor)
+- [Debugging in the Editor](#debugging-in-the-editor)
+- [Formatting Code Automatically](#formatting-code-automatically)
+- [Changing the Page `