Created
September 14, 2017 21:20
-
-
Save Arm1stice/3a26e90fb4cbbabee348040a64f1f424 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
### | |
AssemblyLineTest - A script to test the time it takes for a certain process to go through an asembly line | |
### | |
totalUnits = 3550 | |
timePerUnitInSec = 80 | |
testingTimeInSec = 6 | |
assemblyLineArray = []; | |
unitsDone = 0 | |
totalTimeUnits = 0 | |
runAssemblyLine = -> | |
totalTimeUnits++ | |
iterate num for num in [3..0] | |
iterate = (num) -> | |
switch num | |
when 0 | |
assemblyLineArray[0] = unitsDone + 1 | |
if totalTimeUnits is 3 | |
console.log assemblyLineArray | |
console.log totalTimeUnits | |
if unitsDone is 1 | |
console.log assemblyLineArray | |
console.log totalTimeUnits | |
if unitsDone % 100 is 0 and unitsDone isnt 0 | |
console.log assemblyLineArray | |
console.log totalTimeUnits | |
console.log "#{unitsDone} units completed" | |
break | |
when 1 | |
assemblyLineArray[1] = assemblyLineArray[0] | |
break | |
when 2 | |
assemblyLineArray[2] = assemblyLineArray[1] | |
break | |
when 3 | |
assemblyLineArray[3] = assemblyLineArray[2] | |
if assemblyLineArray[3] isnt undefined | |
unitsDone++ | |
break | |
else | |
console.log "Something went really wrong" | |
runAssemblyLine() while unitsDone < totalUnits | |
console.log "Done running the assembly line" | |
console.log "We produced #{totalUnits} units in #{(totalTimeUnits * timePerUnitInSec) + testingTimeInSec} seconds. Average time per unit: #{((totalTimeUnits * timePerUnitInSec) + testingTimeInSec) / totalUnits}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment