diff options
author | Julien Dessaux | 2021-10-22 18:45:54 +0200 |
---|---|---|
committer | Julien Dessaux | 2021-10-22 18:45:54 +0200 |
commit | 9321586129b0019057df9b975e46335e4a118e1d (patch) | |
tree | e953a623769270c13e2efedbdf4230dd26bb7337 | |
parent | Fixed readme entry about code coverage (diff) | |
download | nimfunge98-9321586129b0019057df9b975e46335e4a118e1d.tar.gz nimfunge98-9321586129b0019057df9b975e46335e4a118e1d.tar.bz2 nimfunge98-9321586129b0019057df9b975e46335e4a118e1d.zip |
Simplified some stack stack code
-rw-r--r-- | src/pointer.nim | 6 | ||||
-rw-r--r-- | src/stackStack.nim | 4 | ||||
-rw-r--r-- | tests/stackStack.nim | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/pointer.nim b/src/pointer.nim index 219fa12..ae11ce8 100644 --- a/src/pointer.nim +++ b/src/pointer.nim @@ -201,7 +201,7 @@ proc Eval(p: var Pointer, f: var Field, c: int): (bool, ref int) = let n = p.ss[].Pop() let now = now() let (x, y, lx, ly) = f.GetSize() - let (height, heights) = p.ss[].GetHeights() + let heights = p.ss[].GetHeights() # 20 for key, value in envPairs(): case key @@ -229,10 +229,10 @@ proc Eval(p: var Pointer, f: var Field, c: int): (bool, ref int) = for j in countdown(p.argv[i].len-1, 0): p.ss[].Push(int(p.argv[i][j])) # 18 - for i in 0..<height: + for i in 0..<heights.len: p.ss[].Push(heights[i]) # 17 - p.ss[].Push(height) + p.ss[].Push(heights.len) # 16 p.ss[].Push(now.hour * 256 * 256 + now.minute * 256 + now.second) # 15 diff --git a/src/stackStack.nim b/src/stackStack.nim index b2bf29f..4445b1a 100644 --- a/src/stackStack.nim +++ b/src/stackStack.nim @@ -74,8 +74,8 @@ func Under*(ss: var StackStack): bool = soss[].Push(ss.Pop()) return false -func GetHeights*(ss: StackStack): (int, seq[int]) = - return (ss.height, ss.head[].GetHeights) +func GetHeights*(ss: StackStack): seq[int] = + return ss.head[].GetHeights func YCommandPick*(ss: var StackStack, n, h: int) = ss.head[].YCommandPick(n, h) diff --git a/tests/stackStack.nim b/tests/stackStack.nim index 8ff3e62..e00a624 100644 --- a/tests/stackStack.nim +++ b/tests/stackStack.nim @@ -148,4 +148,4 @@ suite "StackStack": check empty[].Pop() == 6 test "GetHeights": var empty = NewStackStack() - check empty[].GetHeights == (1, @[0]) + check empty[].GetHeights == @[0] |