I embrace semicolons myself and it's more readable too. But the automatic semicolon insertion just might be useful in code golfing scenarios? In this example:
return
something;
will be converted into:
import PIL | |
from PIL import Image | |
from PIL import ImageGrab | |
import os | |
while(True): | |
while(True): | |
imageName=input("Enter filename: ") | |
if(os.path.isfile(imageName)): #File exists? | |
image=Image.open(imageName) | |
break |
{ | |
"Drum machines":[ | |
{"name":"Roland TR-606 Drumatix","description":"A programmable analog synthesis drum machine."}, | |
{"name":"Roland TR-707 Rhythm Composer","description":"A programmable digital sample-based drum machine."}, | |
{"name":"Roland TR-808 Rhythm Composer","description":"An analog subtractive synthesis drum machine."}, | |
{"name":"Roland TR-909 Rhythm Composer","description":"A drum machine with samples alongside analog sounds."}, | |
{"name":"Korg Volca Beats","description":"An analog drum machine."}, | |
{"name":"Akai MPC60","description":"An electronic sampler."}, | |
{"name":"Pearl Fightman Electronic Training Drum","description":"An analog FM drum synth module."} | |
], |
// title: Perlin Noise | |
// author: Anastasia Dunbar | |
// script: js | |
var width=240,height=136; | |
function mix(a,b,t){return(t*(b-a))+a;} | |
function mod(a,b){return((a%b)+b)%b;} | |
function fract(x){return x-Math.floor(x);} | |
function clamp(a,b,c){return Math.min(Math.max(a,b),c);} | |
function dot(a,b){for(var s=0,i=0;i<a.length;i++){s+=a[i]*b[i];}return s;} | |
function sign(x){return x>0?1:x<0?-1:0;} |
process.stdin.resume(); //Keep process from terminating. | |
const readline=require("readline"), | |
rl=readline.createInterface({ | |
input:process.stdin, | |
output:process.stdout | |
}); | |
function question(string){ | |
return new Promise(resolve=> | |
rl.question(string+"\n",answer=>resolve(answer)) | |
); |
var alphabet=[ | |
{letter:"a",consonant:false}, | |
{letter:"b",consonant:true}, | |
{letter:"c",consonant:true}, | |
{letter:"d",consonant:true}, | |
{letter:"e",consonant:false}, | |
{letter:"f",consonant:true}, | |
{letter:"g",consonant:true}, | |
{letter:"h",consonant:true}, | |
{letter:"i",consonant:false}, |
//1-(The Mighty Sand Yak) | |
for(;;){var e=this.findNearest(this.findEnemies());if(this.distanceTo(e)<10){this.moveXY(this.pos.x+10,this.pos.y);}} | |
//2-(Oasis) | |
for(;;){var e=this.findNearest(this.findEnemies());if(e&&this.distanceTo(e)<10){this.moveXY(this.pos.x-10,this.pos.y);}else{this.moveXY(this.pos.x+10,this.pos.y);}} | |
//3-(Basin Stampede) | |
for(;;){var e=this.findNearest(this.findEnemies());var X=this.pos.x+5;var Y=17;if(e){if(e.pos.y>this.pos.y){Y-=10;}else if(e.pos.y<this.pos.y){Y+=10;}}this.moveXY(X,Y);} | |
//4-(Sarven Road) | |
for(;;){var e=this.findNearest(this.findEnemies());if(e){this.attack(e);}else{this.moveXY(this.pos.x+7,this.pos.y+9);}} | |
//5-(Crossroads) | |
var x=this.pos.x,y=this.pos.y;for(;;){var e=this.findNearestEnemy();if(e){if(e.pos.x<this.pos.x){this.buildXY("fire-trap",x-15,y);}else if(e.pos.x>this.pos.x){this.buildXY("fire-trap",x+15,y);}else if(e.pos.y<this.pos.y){this.buildXY("fire-trap",x,y-15);}else if(e.pos.y>this.pos.y){this.buildXY("fire-trap",x,y+15);}}this.moveXY(x,y);} |
const LOWPASS=0,HIGHPASS=1,BANDPASS=2; | |
class Filter{ | |
constructor(mode){ | |
this.cutoff=.99; | |
this.resonance=0; | |
this.mode=mode; | |
this.b0=0;this.b1=0;this.b2=0;this.b3=0; | |
this.feedbackAmount=0; | |
this.cutoffMod=0; |
function mod(a,b){return((a%b)+b)%b;} | |
class Timer{ | |
constructor(callback,delay,tickBy=1,...parameters){ | |
this.callback=callback; | |
this.duration=delay; | |
this.timer=delay; | |
this.tickBy=tickBy; | |
this.parameters=parameters; | |
} | |
tick(){ |
function dsp(time){ | |
var master=Math.sin(Math.PI*2*440*time)*Math.exp(-3*time); | |
return master; | |
} | |
var audioContext=new AudioContext(), | |
bufferSize=2048, //256,512,1024,2048,4096,8192,16384 | |
node=audioContext.createScriptProcessor(bufferSize,0,2), //bufferSize,inputChannels,outputChannels | |
time=0; | |
node.onaudioprocess=event=>{ | |
var L=event.outputBuffer.getChannelData(0), |