-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconcentricrectangles.lua
78 lines (74 loc) · 3.68 KB
/
concentricrectangles.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
-- The function get_name() should return a single string that is the name of the puzzle.
--
function get_name()
return "CONCENTRIC RECTANGLES(MED)"
--or IMAGE TEST PATTERN N
end
-- The function get_description() should return an array of strings, where each string is
-- a line of description for the puzzle. The text you return from get_description() will
-- be automatically formatted and wrapped to fit inside the puzzle information box.
--
function get_description()
return { "FILL THE IMAGE BUFFER WITH THE SPECIFIED TARGET TEST PATTERN" }
end
-- The function get_streams() should return an array of streams. Each stream is described
-- by an array with exactly four values: a STREAM_* value, a name, a position, and an array
-- of integer values between -999 and 999 inclusive.
--
-- STREAM_INPUT: An input stream containing up to 39 numerical values.
-- STREAM_OUTPUT: An output stream containing up to 39 numerical values.
-- STREAM_IMAGE: An image output stream, containing exactly 30*18 numerical values between 0
-- and 4, representing the full set of "pixels" for the target image.
--
-- NOTE: Arrays in Lua are implemented as tables (dictionaries) with integer keys that start
-- at 1 by convention. The sample code below creates an input array of 39 random values
-- and an output array that doubles all of the input values.
--
-- NOTE: To generate random values you should use math.random(). However, you SHOULD NOT seed
-- the random number generator with a new seed value, as that is how TIS-100 ensures that
-- the first test run is consistent for all users, and thus something that allows for the
-- comparison of cycle scores.
--
-- NOTE: Position values for streams should be between 0 and 3, which correspond to the far
-- left and far right of the TIS-100 segment grid. Input streams will be automatically
-- placed on the top, while output and image streams will be placed on the bottom.
--
function get_streams()
output = {
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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
end
-- The function get_layout() should return an array of exactly 12 TILE_* values, which
-- describe the layout and type of tiles found in the puzzle.
--
-- TILE_COMPUTE: A basic execution node (node type T21).
-- TILE_MEMORY: A stack memory node (node type T30).
-- TILE_DAMAGED: A damaged execution node, which acts as an obstacle.
--
function get_layout()
return {
TILE_COMPUTE, TILE_COMPUTE, TILE_COMPUTE, TILE_COMPUTE,
TILE_COMPUTE, TILE_COMPUTE, TILE_COMPUTE, TILE_COMPUTE,
TILE_COMPUTE, TILE_COMPUTE, TILE_COMPUTE, TILE_COMPUTE,
}
end