From 75de43b44c86aac32e041ee84e1f57218d7cf065 Mon Sep 17 00:00:00 2001 From: Nicola Pisanti Date: Thu, 24 Jan 2019 01:42:35 +0100 Subject: [PATCH 1/2] changes V to match orca-js behavior try to divide commits --- sim.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sim.c b/sim.c index 088ec43..471ab2f 100644 --- a/sim.c +++ b/sim.c @@ -1,6 +1,6 @@ +#include "sim.h" #include "gbuffer.h" #include "mark.h" -#include "sim.h" //////// Utilities @@ -706,13 +706,15 @@ BEGIN_OPERATOR(variable) LOWERCASE_REQUIRES_BANG; PORT(0, -1, IN | PARAM); PORT(0, 1, IN | PARAM); - PORT(1, 0, OUT); Glyph left = PEEK(0, -1); Glyph right = PEEK(0, 1); - if (right == '.') + if (right == '.') { + PORT(1, 0, OUT); return; + } if (left == '.') { // Read + PORT(1, 0, OUT); Usz var_idx = safe_index_of(right); Glyph result = extra_params->vars_slots[var_idx]; if (result == '.') From 762337b0f6064391186499f82c6088607b7a75d5 Mon Sep 17 00:00:00 2001 From: Nicola Pisanti Date: Thu, 24 Jan 2019 15:05:06 +0100 Subject: [PATCH 2/2] changes R to max exclusive to match orca-js behavior --- sim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sim.c b/sim.c index 471ab2f..812c570 100644 --- a/sim.c +++ b/sim.c @@ -651,7 +651,7 @@ BEGIN_OPERATOR(random) } Usz key = y * width + x; key = hash32_shift_mult((y * width + x) ^ (Tick_number << UINT32_C(16))); - Usz val = key % (max + 1 - min) + min; + Usz val = key % (max - min) + min; POKE(1, 0, glyph_of(val)); END_OPERATOR