kopia lustrzana https://github.com/backface/turtlestitch
added hyperdyadic MIN and MAX primitives reachable via "relabel"
rodzic
9871df7a36
commit
5b004c105e
|
@ -7,6 +7,9 @@
|
|||
* **Notable Fixes:**
|
||||
* keep internal linked-list organization intact for hyperblocks
|
||||
|
||||
### 2020-12-01
|
||||
* threads, objects: added hyperdyadic MIN and MAX primitives reachable via "relabel"
|
||||
|
||||
### 2020-11-30
|
||||
* threads: keep internal linked-list organization intact for hyperblocks
|
||||
* update libraries
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
<script src="src/symbols.js?version=2020-10-07"></script>
|
||||
<script src="src/widgets.js?version=2020-10-06"></script>
|
||||
<script src="src/blocks.js?version=2020-11-26"></script>
|
||||
<script src="src/threads.js?version=2020-11-30"></script>
|
||||
<script src="src/objects.js?version=2020-11-27"></script>
|
||||
<script src="src/threads.js?version=2020-12-01"></script>
|
||||
<script src="src/objects.js?version=2020-12-01"></script>
|
||||
<script src="src/gui.js?version=2020-11-23"></script>
|
||||
<script src="src/paint.js?version=2020-05-17"></script>
|
||||
<script src="src/lists.js?version=2020-07-01"></script>
|
||||
|
|
|
@ -84,7 +84,7 @@ BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, BooleanSlotMorph,
|
|||
localize, TableMorph, TableFrameMorph, normalizeCanvas, VectorPaintEditorMorph,
|
||||
AlignmentMorph, Process, WorldMap, copyCanvas, useBlurredShadows*/
|
||||
|
||||
modules.objects = '2020-November-27';
|
||||
modules.objects = '2020-December-01';
|
||||
|
||||
var SpriteMorph;
|
||||
var StageMorph;
|
||||
|
@ -1106,6 +1106,16 @@ SpriteMorph.prototype.initBlocks = function () {
|
|||
category: 'operators',
|
||||
spec: '%n mod %n'
|
||||
},
|
||||
reportMin: {
|
||||
type: 'reporter',
|
||||
category: 'operators',
|
||||
spec: '%n min %n'
|
||||
},
|
||||
reportMax: {
|
||||
type: 'reporter',
|
||||
category: 'operators',
|
||||
spec: '%n max %n'
|
||||
},
|
||||
reportRandom: {
|
||||
type: 'reporter',
|
||||
category: 'operators',
|
||||
|
@ -1629,17 +1639,21 @@ SpriteMorph.prototype.blockAlternatives = {
|
|||
|
||||
// operators:
|
||||
reportSum: ['reportDifference', 'reportProduct', 'reportQuotient',
|
||||
'reportPower', 'reportModulus'],
|
||||
'reportPower', 'reportModulus', 'reportMin', 'reportMax'],
|
||||
reportDifference: ['reportSum', 'reportProduct', 'reportQuotient',
|
||||
'reportPower', 'reportModulus'],
|
||||
'reportPower', 'reportModulus', 'reportMin', 'reportMax'],
|
||||
reportProduct: ['reportDifference', 'reportSum', 'reportQuotient',
|
||||
'reportPower', 'reportModulus'],
|
||||
'reportPower', 'reportModulus', 'reportMin', 'reportMax'],
|
||||
reportQuotient: ['reportDifference', 'reportProduct', 'reportSum',
|
||||
'reportPower', 'reportModulus'],
|
||||
'reportPower', 'reportModulus', 'reportMin', 'reportMax'],
|
||||
reportPower: ['reportDifference', 'reportProduct', 'reportSum',
|
||||
'reportQuotient', 'reportModulus'],
|
||||
'reportQuotient', 'reportModulus', 'reportMin', 'reportMax'],
|
||||
reportModulus: ['reportDifference', 'reportProduct', 'reportSum',
|
||||
'reportQuotient', 'reportPower'],
|
||||
'reportQuotient', 'reportPower', 'reportMin', 'reportMax'],
|
||||
reportMin: ['reportSum', 'reportDifference', 'reportProduct',
|
||||
'reportQuotient', 'reportPower', 'reportModulus', 'reportMax'],
|
||||
reportMax: ['reportSum', 'reportDifference', 'reportProduct',
|
||||
'reportQuotient', 'reportPower', 'reportModulus', 'reportMin'],
|
||||
reportLessThan: ['reportEquals', 'reportGreaterThan'],
|
||||
reportEquals: ['reportLessThan', 'reportGreaterThan'],
|
||||
reportGreaterThan: ['reportEquals', 'reportLessThan'],
|
||||
|
|
|
@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, Map,
|
|||
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK,
|
||||
TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/
|
||||
|
||||
modules.threads = '2020-November-30';
|
||||
modules.threads = '2020-December-01';
|
||||
|
||||
var ThreadManager;
|
||||
var Process;
|
||||
|
@ -3696,16 +3696,6 @@ Process.prototype.reportBasicPower = function (a, b) {
|
|||
return Math.pow(+a, +b);
|
||||
};
|
||||
|
||||
Process.prototype.reportModulus = function (a, b) {
|
||||
return this.hyperDyadic(this.reportBasicModulus, a, b);
|
||||
};
|
||||
|
||||
Process.prototype.reportBasicModulus = function (a, b) {
|
||||
var x = +a,
|
||||
y = +b;
|
||||
return ((x % y) + y) % y;
|
||||
};
|
||||
|
||||
Process.prototype.reportRandom = function (a, b) {
|
||||
return this.hyperDyadic(this.reportBasicRandom, a, b);
|
||||
};
|
||||
|
@ -3719,6 +3709,34 @@ Process.prototype.reportBasicRandom = function (min, max) {
|
|||
return Math.floor(Math.random() * (ceil - floor + 1)) + floor;
|
||||
};
|
||||
|
||||
// Process math primtives - arithmetic hyperdyadic
|
||||
|
||||
Process.prototype.reportModulus = function (a, b) {
|
||||
return this.hyperDyadic(this.reportBasicModulus, a, b);
|
||||
};
|
||||
|
||||
Process.prototype.reportBasicModulus = function (a, b) {
|
||||
var x = +a,
|
||||
y = +b;
|
||||
return ((x % y) + y) % y;
|
||||
};
|
||||
|
||||
Process.prototype.reportMin = function (a, b) {
|
||||
return this.hyperDyadic(this.reportBasicMin, a, b);
|
||||
};
|
||||
|
||||
Process.prototype.reportBasicMin = function (a, b) {
|
||||
return Math.min(+a, +b);
|
||||
};
|
||||
|
||||
Process.prototype.reportMax = function (a, b) {
|
||||
return this.hyperDyadic(this.reportBasicMax, a, b);
|
||||
};
|
||||
|
||||
Process.prototype.reportBasicMax = function (a, b) {
|
||||
return Math.max(+a, +b);
|
||||
};
|
||||
|
||||
// Process logic primitives - hyper-diadic / monadic where applicable
|
||||
|
||||
Process.prototype.reportLessThan = function (a, b) {
|
||||
|
|
Ładowanie…
Reference in New Issue