From b331da6c1f95fc7712b14936d8f767eba9ab80e6 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 24 May 2018 18:10:38 -0500 Subject: [PATCH 1/2] initial commit --- 03week/towersOfHanoi.js | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/03week/towersOfHanoi.js b/03week/towersOfHanoi.js index 3cf6df049..cc5325df1 100644 --- a/03week/towersOfHanoi.js +++ b/03week/towersOfHanoi.js @@ -1,4 +1,28 @@ -'use strict'; +'use strict' +/* define columns by arrays[of strings] the strings which are local variables because they change order/* +/*build a function that monitor's the state of these array strings/*... maybe a readline. +/* correct order of blocks being a-yellow,b-red,c-green,n-blue... use const= hanoi and these blocks are global variables/* +// remember the array is a zero index in javascript and in 'strict' mode global variables will not be automatically created// +/* each column should be an array and we should be able to search through it with a 'for/each loop'*/ +/* the 'for/each loop' should be used because it takes first argument as a callback*/ + +/*begin the game with an onclick attribute(with code targeting the element id), and add to a button element*/ +/* once block is clicked it will disappear and reappear upon clicking a second time */ +/*create a readline.Interface so that it will listen for the 'line' event when pieces of the string are moved. +/* write a function that allows blocks to move from first to second column or second to first column in an order[n,c,b,a] or [a,b,c,n]/* +//test to make sure this works// + /* Write a function that only allows First or Second column to move to third column by[a,b,c,n] ...largest size FIRST to smallest size LAST*/ +//Write an alert for 3rd column if it is not in that[a,b,c,n] sequential order// function assert {if !(condition){throw message ll "no";})} + +//test to prove this is not a move user can make/ + +/* when third column is in same order as (initial) game starting block order(a,b,c,n) And first two columns[arrays] are ...empty declare a win with an alert and reset game function */ +//write a test function to test win// +/*test cases(1)no blocks can even enter third column unless in sequential order of (a,b,c,n).*/ +/* (2) First and Second columns[arrays] work in sequences of [a,b,c,n] and [n,b,c,a] between eachother but do not have to have all pieces of string to stick. +//make arrays of strings// + + const assert = require('assert'); const readline = require('readline'); @@ -91,4 +115,4 @@ if (typeof describe === 'function') { getPrompt(); -} +} \ No newline at end of file From 483d62607726398420703b310e93fb3d20132684 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 24 May 2018 18:16:22 -0500 Subject: [PATCH 2/2] initial commit --- 03week/towersOfHanoi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/03week/towersOfHanoi.js b/03week/towersOfHanoi.js index cc5325df1..71e48beef 100644 --- a/03week/towersOfHanoi.js +++ b/03week/towersOfHanoi.js @@ -20,7 +20,7 @@ //write a test function to test win// /*test cases(1)no blocks can even enter third column unless in sequential order of (a,b,c,n).*/ /* (2) First and Second columns[arrays] work in sequences of [a,b,c,n] and [n,b,c,a] between eachother but do not have to have all pieces of string to stick. -//make arrays of strings// +//make arrays of strings///