//objectSynonyms = ["object","obj","ob","o","json"]; //I have no plans to implement these.
trueSynonyms=["true","t","1","yes"];
falseSynonyms=["false","f","0","no"];
defaultStringTypeValues=["element","color"];
defaultNumberTypeValues=["x","y","temp","start"];
functionrgbStringToUnvalidatedObject(string){
string=string.split(",");
varred=parseFloat(string[0].substring(4));
vargreen=parseFloat(string[1]);
varblue=parseFloat(string[2].slice(0,-1));
return{r:red,g:green,b:blue};
}
functionfunniPrompt(){
varinputText=prompt("Enter command");
// replace spaces with underscores
inputAsArray=inputText.split(" ");
varfirstItem=inputAsArray[0];
switch(firstItem){
case"set":
//alert("To do");
if(inputAsArray.length<4){
alert("Usage: set [property] [element] [value] <type> \nArguments are typed without framing characters. \nThe element can be \"all\" to set the property for every pixel. \nNote: Strings can't have spaces because spaces are the separator used in the parsing split(). \nArguments in [brackets] are required and ones in <angle brackets> are optional.");
break;
};
varproperty=inputAsArray[1];
//console.log("Property gotten: " + property);
varinputElement=inputAsArray[2];
//console.log("Element gotten: " + inputElement);
varvalue=inputAsArray[3];
//console.log("Value gotten: " + value);
vartype=null;//dummy type for [value]-based assumption
//console.log("Element is a match: " + inputElement + ", " + pixelMap[i][j].element)
pixelMap[i][j][property]=value;
};
};
};
};
break;
case"test":
alert("pong");
console.log("qwertyuiopasdfghjklzxcvbnm");
break;
case"fill":
if(inputAsArray.length<3){
alert("Usage: fill [overwrite (should be a bool)] [element] <additional elements>. \nArguments in [brackets] are required and ones in <angle brackets> are optional.");
break;
};
vardoOverwrite=inputAsArray[1];
varelementList=inputAsArray.slice(2);
//console.log(elementList);
for(i=0;i<elementList.length;i++){
varelementInConsideration=elementList[i]
varoriginalElement=elementInConsideration;//also for error display
alert("Usage: count [element] \nDon't include the brackets. \nNote: The element name can't have a space in it because spaces are the separator used in the parsing split(). \nArguments in [brackets] are required.");
break;
};
varinputElement=inputAsArray[1];
//console.log("Element gotten: " + inputElement);
varoriginalInput=inputElement;//for error display
inputElement=mostSimilarElement(inputElement);
if(!elements[inputElement]){
alert("Element "+originalInput+" does not exist!");