Sunday, August 21, 2016

dividing the screen into squares

function findtheenclosingsupersquare(square) {
var supersquarenumber = 0
while (! testsupersquare(square,supersquarenumber)) {supersquarenumber = supersquarenumber + 1}
return supersqarenumber


if (square.right > 0 - square.width


var square = []
square[0].left = 0;square[0].top = 0;
square[0].sidelength = window.innerWidth;
square[0].bottom = square[0].top + square[0].sidelength;
square[0].right = square[0].left + square[0].sidelength;

if (testforintersection(0)) {}

function testforintersection(square) {
if (testleftright(square) && testtopandbottom(square)) {return "true"}}

function testleftright(square) {if (testleft(square) && testright(square)) {return "true"}}
function testtopandbottom(square) {if (testtop(square) && testbottom(square)) {return "true"}}function testleft(square) {if (square.left < window.right) {return "true"}}
function testright(square) {if (square.right > window.left) {return "true"}}
function testtop(square) {if (square.top < window.bottom) {return "true"}}
function testbottom(square) {if (square.bottom < window.top) {return "true"}}

function getsubsquare(square,number) {
var subsquare
subsquare.sidelength = square.sidelength / 3if (number === 1 || 4 || 7) {
subsquare.left = square.left}
if (number === 2 || 5 || 8) {
subsquare.left = square.left + subsquare.sidelength}
if (number === 3 || 6 || 9) {
subsquare.left = square.left + subsquare.sidelength + subsquare.sidelength}
if (number === 1 || 2 || 3) {
subsquare.top = square.top}
if (number === 4 || 5 || 6) {
subsquare.top = square.top + subsquare.sidelength}
if (number === 7 || 8 || 9) {
subsquare.top = square.top + subsquare.sidelength + subsquare.sidelength}

subsquare.right = subsquare.left + subsquare.sidelength
subsquare.bottom = subsquare.top + subsquare.sidelength}