No description, website, or topics provided.
JavaScript CSS HTML
Switch branches/tags
Nothing to show
Latest commit 2ababc6 Jul 10, 2018
Permalink
Failed to load latest commit information.
.DS_Store rudimentary user-specified size input. Jul 9, 2018
index.css minor CSS fix. Jul 9, 2018
index.html Final MVP. Jul 9, 2018
index.js Final MVP. Jul 9, 2018
readme.md Filled out the readme. Jul 10, 2018

readme.md

n-Tac-Toe - Tic Tac Toe in 3D

Motivation: I love doing stuff in 3D, and this (a student project) seemed like a fun challenge given the time available.

Build status:

Images: Mockup of concept: Wireframe Screen Cap of Actual Game: ![Screen Cap of 3x3x3 Board] (https://i.imgur.com/MfWleff.png)

Features: The main feature of interest here is the user-definable board size--the DOM display of the board is generated procedurally in tandem with a three-dimensional array that records the players' moves. I imagine thie general code might be useful in other contexts--game-related and otherwise.

Code Example: Everything is pretty straightforward. Someone (Drake Talley) had questions about the process by which the game checks for a win. I think my approach is pretty efficient, but if anyone has improvements I would love to hear about them. Below is a simplified (2D) version to demonstrate the basic algorithm:

function checkDiags(arrIn) {
	const diag1 = [];
	const diag2 = [];
	for (let i = 0; i < arrIn.length; i += 1) {
		diag1.push(arrIn[i][i]);
    diag2.push(arrIn[arrIn.length-1-i][i])	
	}
  console.log(diag1,diag2);
}

testArr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];

checkDiags(testArr); // [ 1, 5, 9 ] [ 7, 5, 3 ]```

Credits: Massive nd invaluable assistance was given by the General Assembly Summer 2018 WDI faculty, in particular, Drake Talley, who pretty much walked me through all the asynchronous browser-call stuff. Christopher Lin also helped in this area by introducing me to the preventDefault function.

License: MIT © James Gary