This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StringTakeUntil[str_, delim_] := | |
If[StringMatchQ[str, delim ~~ ___] || StringLength[str] == 0, "", | |
StringTake[str, 1] <> StringTakeUntil[StringDrop[str, 1], delim]]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(*ASCIIrange = { " ","` ",". "," .","..",".:",":.","::",":#","##","#@","x@","o@","@@","@X","XX"};*) | |
(*ASCIIrange = { " "," ",".","..",".:","::",":i","io","ex","pq","Xq","AG","ZY","VW"};*) | |
(* Produces the best results by randomizing letters using a held random choice call *) | |
ASCIIrange = {" ", Hold[RandomChoice[{" ", " `"}]], ". ", "..", | |
Hold[RandomChoice[{".:", ":."}]], | |
Hold[RandomChoice[{"::", ";:", ":;", ";;"}]], | |
Hold[RandomChoice[{":x", "x:"}]], | |
Hold[RandomChoice[{"io", "ae", "oc"}]], | |
Hold[RandomChoice[{"yj", "tp", "qw"}]], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Main method to call to get an integer. | |
// It will block until an integer followed by a non-digit delimiter is read from the serial input stream. | |
int getInt() { | |
return getInt(0); | |
} | |
// Recursive helper method. | |
// @param sum - an accumulator that "builds" the next number, character by character. | |
int getInt(int sum) { | |
// Read a single character from the serial input stream. |
NewerOlder