Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function radioCrystals(input) {
- let desiredThickness = Number(input[0])
- let count = 0
- for (i=1; i < input.length; i++) {
- let thickness = Number(input[i])
- console.log("Processing chunk " + thickness + " microns")
- while (thickness > desiredThickness) {
- thickness = thickness / 4
- count++
- if (thickness < desiredThickness) {
- thickness = thickness * 4
- count--
- console.log("Cut x" + count)
- console.log("Transporting and washing")
- break;
- }
- else if (thickness == desiredThickness) {
- console.log("Cut x" + count)
- console.log("Transporting and washing")
- }
- }
- thickness = Math.floor(thickness)
- count = 0
- while (thickness > desiredThickness) {
- let lastValue = thickness * 20 / 100
- thickness = thickness - (thickness * 20 / 100)
- count++;
- if (thickness < desiredThickness) {
- thickness = thickness + lastValue
- count--
- console.log("Lap x" + count)
- console.log("Transporting and washing")
- break;
- }
- else if (thickness == desiredThickness) {
- console.log("Lap x" + count)
- console.log("Transporting and washing")
- }
- }
- thickness = Math.floor(thickness)
- count = 0
- while (thickness > desiredThickness) {
- thickness = thickness - 20
- count++
- if (thickness < desiredThickness) {
- thickness = thickness + 20
- count--
- console.log("Grind x" + count)
- console.log("Transporting and washing")
- break;
- }
- else if (thickness == desiredThickness) {
- console.log("Grind x" + count)
- console.log("Transporting and washing")
- }
- }
- thickness = Math.floor(thickness)
- count = 0
- while (thickness > desiredThickness) {
- thickness = thickness - 2
- count++
- // if (thickness < desiredThickness) {
- // thickness = thickness + 2
- // count--
- // console.log("Etch x" + count)
- // console.log("Transporting and washing")
- // break
- // }
- if (thickness < desiredThickness) {
- console.log("Etch x" + count)
- console.log("Transporting and washing")
- break;
- }
- else if (thickness == desiredThickness) {
- console.log("Etch x" + count)
- console.log("Transporting and washing")
- }
- }
- thickness = Math.floor(thickness)
- count = 0
- while (thickness < desiredThickness) {
- thickness = thickness + 1
- count++
- console.log("X-ray x" + count)
- }
- count = 0
- if (thickness == desiredThickness) {
- console.log("Finished crystal " + desiredThickness + " microns")
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement