refactored system calls to random number to bypass hyper

pull/95/head
jmoenig 2020-05-04 17:18:24 +02:00
rodzic 428a856567
commit 5d30c7fd36
1 zmienionych plików z 8 dodań i 8 usunięć

Wyświetl plik

@ -1773,7 +1773,7 @@ Process.prototype.doInsertInList = function (element, index, list) {
return null; return null;
} }
if (this.inputOption(index) === 'any') { if (this.inputOption(index) === 'any') {
idx = this.reportRandom(1, list.length() + 1); idx = this.reportBasicRandom(1, list.length() + 1);
} }
if (this.inputOption(index) === 'last') { if (this.inputOption(index) === 'last') {
idx = list.length() + 1; idx = list.length() + 1;
@ -1791,7 +1791,7 @@ Process.prototype.doReplaceInList = function (index, list, element) {
return null; return null;
} }
if (this.inputOption(index) === 'any') { if (this.inputOption(index) === 'any') {
idx = this.reportRandom(1, list.length()); idx = this.reportBasicRandom(1, list.length());
} }
if (this.inputOption(index) === 'last') { if (this.inputOption(index) === 'last') {
idx = list.length(); idx = list.length();
@ -1806,7 +1806,7 @@ Process.prototype.reportListItem = function (index, list) {
return ''; return '';
} }
if (this.inputOption(index) === 'any') { if (this.inputOption(index) === 'any') {
idx = this.reportRandom(1, list.length()); idx = this.reportBasicRandom(1, list.length());
} }
if (this.inputOption(index) === 'last') { if (this.inputOption(index) === 'last') {
idx = list.length(); idx = list.length();
@ -3794,7 +3794,7 @@ Process.prototype.reportBasicLetter = function (idx, string) {
str = isNil(string) ? '' : string.toString(); str = isNil(string) ? '' : string.toString();
if (this.inputOption(idx) === 'any') { if (this.inputOption(idx) === 'any') {
idx = this.reportRandom(1, str.length); idx = this.reportBasicRandom(1, str.length);
} }
if (this.inputOption(idx) === 'last') { if (this.inputOption(idx) === 'last') {
idx = str.length; idx = str.length;
@ -4117,7 +4117,7 @@ Process.prototype.setHeading = function (direction) {
if (thisObj) { if (thisObj) {
if (this.inputOption(direction) === 'random') { if (this.inputOption(direction) === 'random') {
direction = this.reportRandom(1, 36000) / 100; direction = this.reportBasicRandom(1, 36000) / 100;
} }
thisObj.setHeading(direction); thisObj.setHeading(direction);
} }
@ -4133,7 +4133,7 @@ Process.prototype.doFaceTowards = function (name) {
} else if (this.inputOption(name) === 'mouse-pointer') { } else if (this.inputOption(name) === 'mouse-pointer') {
thisObj.faceToXY(this.reportMouseX(), this.reportMouseY()); thisObj.faceToXY(this.reportMouseX(), this.reportMouseY());
} else if (this.inputOption(name) === 'random position') { } else if (this.inputOption(name) === 'random position') {
thisObj.setHeading(this.reportRandom(1, 36000) / 100); thisObj.setHeading(this.reportBasicRandom(1, 36000) / 100);
} else { } else {
if (name instanceof List) { if (name instanceof List) {
thisObj.faceToXY( thisObj.faceToXY(
@ -4167,8 +4167,8 @@ Process.prototype.doGotoObject = function (name) {
stage = thisObj.parentThatIsA(StageMorph); stage = thisObj.parentThatIsA(StageMorph);
if (stage) { if (stage) {
thisObj.setCenter(new Point( thisObj.setCenter(new Point(
this.reportRandom(stage.left(), stage.right()), this.reportBasicRandom(stage.left(), stage.right()),
this.reportRandom(stage.top(), stage.bottom()) this.reportBasicRandom(stage.top(), stage.bottom())
)); ));
} }
} else { } else {