@@ -84,10 +84,29 @@ function setupEnsembleBlocks(activity) {
8484 // Refactor TurtleHeapBlock
8585 class TurtleHeapBlock extends LeftBlock {
8686 constructor ( ) {
87- super ( "turtleheap" , _THIS_IS_MUSIC_BLOCKS_ ? _ ( "mouse index heap" ) : _ ( "turtle index heap" ) ) ;
88- initializeBlock ( this , "ensemble" , _THIS_IS_MUSIC_BLOCKS_
89- ? [ _ ( "The Mouse index heap block returns a value in the heap at a specified location for a specified mouse." ) , "documentation" , "" ]
90- : [ _ ( "The Turtle index heap block returns a value in the heap at a specified location for a specified turtle." ) , "documentation" , "" ] ) ;
87+ super (
88+ "turtleheap" ,
89+ _THIS_IS_MUSIC_BLOCKS_ ? _ ( "mouse index heap" ) : _ ( "turtle index heap" )
90+ ) ;
91+ initializeBlock (
92+ this ,
93+ "ensemble" ,
94+ _THIS_IS_MUSIC_BLOCKS_
95+ ? [
96+ _ (
97+ "The Mouse index heap block returns a value in the heap at a specified location for a specified mouse."
98+ ) ,
99+ "documentation" ,
100+ ""
101+ ]
102+ : [
103+ _ (
104+ "The Turtle index heap block returns a value in the heap at a specified location for a specified turtle."
105+ ) ,
106+ "documentation" ,
107+ ""
108+ ]
109+ ) ;
91110
92111 const formOptions = {
93112 args : 2 ,
@@ -432,7 +451,9 @@ function setupEnsembleBlocks(activity) {
432451 super ( "setturtle" ) ;
433452 if ( _THIS_IS_MUSIC_BLOCKS_ ) {
434453 this . setHelpString ( [
435- _ ( "The Set mouse block sends a stack of blocks to be run by the specified mouse." ) ,
454+ _ (
455+ "The Set mouse block sends a stack of blocks to be run by the specified mouse."
456+ ) ,
436457 "documentation" ,
437458 ""
438459 ] ) ;
@@ -445,7 +466,9 @@ function setupEnsembleBlocks(activity) {
445466 } ) ;
446467 } else {
447468 this . setHelpString ( [
448- _ ( "The Set turtle block sends a stack of blocks to be run by the specified turtle." ) ,
469+ _ (
470+ "The Set turtle block sends a stack of blocks to be run by the specified turtle."
471+ ) ,
449472 "documentation" ,
450473 ""
451474 ] ) ;
@@ -574,7 +597,9 @@ function setupEnsembleBlocks(activity) {
574597 //.TRANS: notes played by this mouse
575598 super ( "turtleelapsednotes" , _ ( "mouse notes played" ) ) ;
576599 this . setHelpString ( [
577- _ ( "The Mouse elapse notes block returns the number of notes played by the specified mouse." ) ,
600+ _ (
601+ "The Mouse elapse notes block returns the number of notes played by the specified mouse."
602+ ) ,
578603 "documentation" ,
579604 ""
580605 ] ) ;
@@ -588,7 +613,9 @@ function setupEnsembleBlocks(activity) {
588613 //.TRANS: notes played by this turtle
589614 super ( "turtlelapsednotes" , _ ( "turtle notes played" ) ) ;
590615 this . setHelpString ( [
591- _ ( "The Turtle elapse notes block returns the number of notes played by the specified turtle." ) ,
616+ _ (
617+ "The Turtle elapse notes block returns the number of notes played by the specified turtle."
618+ ) ,
592619 "documentation" ,
593620 ""
594621 ] ) ;
@@ -628,7 +655,9 @@ function setupEnsembleBlocks(activity) {
628655 //.TRANS: convert current note for this turtle to piano key (1-88)
629656 super ( "turtlepitch" , _ ( "mouse pitch number" ) ) ;
630657 this . setHelpString ( [
631- _ ( "The Mouse pitch block returns the current pitch number being played by the specified mouse." ) ,
658+ _ (
659+ "The Mouse pitch block returns the current pitch number being played by the specified mouse."
660+ ) ,
632661 "documentation" ,
633662 ""
634663 ] ) ;
@@ -642,7 +671,9 @@ function setupEnsembleBlocks(activity) {
642671 //.TRANS: convert current note for this turtle to piano key (1-88)
643672 super ( "turtlepitch" , _ ( "turtle pitch number" ) ) ;
644673 this . setHelpString ( [
645- _ ( "The Turtle pitch block returns the current pitch number being played by the specified turtle." ) ,
674+ _ (
675+ "The Turtle pitch block returns the current pitch number being played by the specified turtle."
676+ ) ,
646677 "documentation" ,
647678 ""
648679 ] ) ;
@@ -886,7 +917,9 @@ function setupEnsembleBlocks(activity) {
886917 super ( "foundturtle" ) ;
887918 if ( _THIS_IS_MUSIC_BLOCKS_ ) {
888919 this . setHelpString ( [
889- _ ( "The Found mouse block will return true if the specified mouse can be found." ) ,
920+ _ (
921+ "The Found mouse block will return true if the specified mouse can be found."
922+ ) ,
890923 "documentation" ,
891924 ""
892925 ] ) ;
@@ -902,7 +935,9 @@ function setupEnsembleBlocks(activity) {
902935 } ) ;
903936 } else {
904937 this . setHelpString ( [
905- _ ( "The Found turtle block will return true if the specified turtle can be found." ) ,
938+ _ (
939+ "The Found turtle block will return true if the specified turtle can be found."
940+ ) ,
906941 "documentation" ,
907942 ""
908943 ] ) ;
@@ -1062,12 +1097,16 @@ function setupEnsembleBlocks(activity) {
10621097 fillColor = getMunsellColor ( 0 , 50 , 100 ) ;
10631098 strokeColor = getMunsellColor ( 0 , 70 , 80 ) ;
10641099 }
1065- const artwork = TURTLESVG
1066- . replace ( / f i l l _ c o l o r / g, fillColor )
1067- . replace ( / s t r o k e _ c o l o r / g, strokeColor ) ;
1100+ const artwork = TURTLESVG . replace ( / f i l l _ c o l o r / g, fillColor ) . replace (
1101+ / s t r o k e _ c o l o r / g,
1102+ strokeColor
1103+ ) ;
10681104
10691105 // eslint-disable-next-line no-undef
1070- tur . doTurtleShell ( 55 , "data:image/svg+xml;base64," + window . btoa ( base64Encode ( artwork ) ) ) ;
1106+ tur . doTurtleShell (
1107+ 55 ,
1108+ "data:image/svg+xml;base64," + window . btoa ( base64Encode ( artwork ) )
1109+ ) ;
10711110
10721111 // Restore the heading.
10731112 if ( heading != 0 ) {
@@ -1076,7 +1115,6 @@ function setupEnsembleBlocks(activity) {
10761115 }
10771116 }
10781117
1079-
10801118 class TurtleNameBlock extends ValueBlock {
10811119 constructor ( ) {
10821120 if ( _THIS_IS_MUSIC_BLOCKS_ ) {
@@ -1335,4 +1373,8 @@ function setupEnsembleBlocks(activity) {
13351373 ] ;
13361374
13371375 blockClasses . forEach ( setupBlock ) ;
1338- }
1376+ }
1377+
1378+ if ( typeof module !== "undefined" && module . exports ) {
1379+ module . exports = { setupEnsembleBlocks, getTargetTurtle } ;
1380+ }
0 commit comments