From 104b6f0880c4969d9aa9581557b7f9313f7d1411 Mon Sep 17 00:00:00 2001 From: Matthew Huntington Date: Tue, 2 May 2023 13:30:56 -0400 Subject: [PATCH] drums uses all limbs --- drums.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drums.js b/drums.js index e6d07f1..f90b356 100644 --- a/drums.js +++ b/drums.js @@ -1,16 +1,22 @@ const numBeats = Math.ceil(Math.random()*9); let resultString = ''; -const instructionPosibilities = [ 'n', 'p', 'm', 'b' ] +const appendages = [ 'lh', 'rh', 'lf', 'rf' ]; -for(let i = 1; i <= numBeats; i++){ - const instructionIndex = Math.floor(Math.random()*instructionPosibilities.length); +for(let appendage of appendages){ + let resultString = ''; + for(let i = 1; i <= numBeats; i++){ + const hit = Math.floor(Math.random()*2); + if(hit === 1){ + resultString += appendage + ' '; + } else { + resultString += ' '; + } - resultString += instructionPosibilities[instructionIndex] + ' '; + } + console.log(resultString); } -console.log(resultString); - const breakDown = (node)=>{ if(node.value < 4){