all stats

olus2000's stats

guessed the most

namecorrect guessesgames togetherratio
seshoumara890.889
essaie470.571
kotnen480.500
GNU Radio Shows240.500
taswelll5110.455
olive260.333
LyricLy11330.333
kimapr5160.312
Palaiologos4140.286
yui140.250
luatic4160.250
Dolphy290.222
IFcoltransG290.222
Olivia4190.211
soup girl2120.167
moshikoi2140.143
JJRubes170.143
razetime0150.000

were guessed the most by

namecorrect guessesgames togetherratio
LyricLy25310.806
Dolphy690.667
kotnen470.571
essaie470.571
soup girl6110.545
taswelll6110.545
olive360.500
razetime7150.467
kimapr7160.438
luatic7160.438
IFcoltransG380.375
moshikoi5140.357
yui140.250
GNU Radio Shows140.250
Olivia4180.222
Palaiologos2120.167
JJRubes170.143
seshoumara090.000

entries

round #64

submitted at
0 likes

guesses
comments 0

post a comment


dir look-and-say
authors.txt ASCII text
1
Aleksander "olus2000" Sabak
look-and-say-docs.factor ASCII text
 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
! Copyright (C) 2024 Aleksander Sabak.
! See https://factorcode.org/license.txt for BSD license.
USING: help.markup help.syntax kernel lists sequences strings ;
IN: look-and-say

HELP: <look-and-say>
{ $values
    { "seed" string }
    { "list" list }
}
{ $description "Creates a lazy linked list representing a " { $link look-and-say } " sequence starting from a given seed to be used with the " { $vocab-link "lists" } " vocabulary." }
;

HELP: look-and-say
{ $class-description "An infinite linked list starting from " { $slot "car" } " an continuing in " { $slot "cdr" } " which is constructed lazily if not present." $nl
"Implements " { $link "lists-protocol" } "." }
;

HELP: next-look-and-say
{ $values
    { "string" string }
    { "string'" string }
}
{ $description "Calculates the next value in a look-and-say sequence: for each run of identical elements in " { $snippet "string" } " the resulting " { $snippet "string'" } " will contain the length of that run and that element." }
{ $examples
    { $example "USING: look-and-say prettyprint ;"
        "\"1\" next-look-and-say ."
        "11"
    }
    { $example "USING: look-and-say prettyprint ;"
        "\"11\" next-look-and-say ."
        "21"
    }
    { $example "USING: look-and-say prettyprint ;"
        "\"111221\" next-look-and-say ."
        "312211"
    }
    { $example "USING: look-and-say prettyprint ;"
        "\"AAAAAABBBCCCCCD\" next-look-and-say ."
        "6A3B5C1D"
    }
}
;

ARTICLE: "look-and-say" "The look-and-say sequence"
"The " { $vocab-link "look-and-say" } " vocabulary implements the " { $url "https://oeis.org/A005150" "look-and-say" } " sequence. Its first element is 1 (thought the vocabulary allows arbitrary strings as seeds) and generates following elements by \"describing\" previous elements:"
{ $list
  "1 is one 1, so the second element is 11"
  "11 is two 1s, so the third element is 21"
  "21 is one 2 and one 1, so the fourth element is 1211"
  "1211 is one 1, one 2, and two 1s, so the fifth element is 111221"
  "111221 is three 1s, two 2s and one 1, so the sixth element is 312211"
  "and so on..."
}
"The only digits that appear in the sequence seeded with 1 are 1, 2, and 3." $nl
"This vocabulary represents elements of the sequence as strings, since their string representations are what matters to the definition of the sequence."
;

ABOUT: "look-and-say"
look-and-say.factor ASCII text
 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
! Copyright (C) 2024 Aleksander Sabak.
! See https://factorcode.org/license.txt for BSD license.
USING: accessors kernel lists make math math.parser sequences ;
IN: look-and-say


: next-look-and-say ( string -- string' )
  dup empty? [ [ unclip-slice 1 spin [
    2dup = [ drop [ 1 + ] dip ]
    [ spin number>string % , 1 swap ] if
  ] each swap number>string % , ] "" make ] unless ;


TUPLE: look-and-say car cdr ;

: <look-and-say> ( seed -- list ) f look-and-say boa ;


INSTANCE: look-and-say list

M: look-and-say nil? drop f ;

M: look-and-say car car>> ;

M: look-and-say cdr [ cdr>> ]
  [ dup car>> next-look-and-say
    <look-and-say> [ swap cdr<< ] keep ] ?unless ;

round #61

submitted at
0 likes

guesses
comments 0

post a comment


new 5.txt ASCII text, with CRLF line terminators
 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
from random import choice

#.PRS

prefernece = [".P", "P.", ".R", "R.", "PR", "RP", "RS", "SR"]


def neighbours(board, x, y):
    if x > 0:
        yield "L", board[y][x] + board[y][x-1]
    if y > 0:
        yield "U", board[y][x] + board[y-1][x]
    if x < len(board[0]) - 1:
        yield "R", board[y][x] + board[y][x+1]
    if y < len(board) - 1:
        yield "D", board[y][x] + board[y+1][x]


def move(board, x, y):
    best, rank = None, -1
    for dir, pair in neighbours(board, x, y):
        if pair in prefernece and (i := prefernece.index(pair)) > rank:
            best, rank = dir, i
    return "I" + best if best else "M" + choice("UDLR")
    
    
if __name__ == "__main__":
    board = []
    while (l := input()):
        board.append(l)
    print(move(board, int(input()), int(input())), end="")

round #59

submitted at
3 likes

guesses
comments 2
LyricLy

what language is this


olus2000 *known at the time as [author of #2]

green


post a comment


test2.prog data

round #58

submitted at
1 like

guesses
comments 2
olus

olus



post a comment


entry.fs ASCII text
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
( Code by olus2000 )


create char-buf 1 chars allot


: next-char? ( -- ? )
  char-buf 1 stdin read-file drop ;

: get-char ( -- c )
  char-buf 1 stdin read-file 2drop
  char-buf c@ ;


1 value dict-size
0 value dict


: d@ ( addr -- n )
  0 swap dict-size 0 +do
    dup i + c@ i 8 * lshift rot + swap
  loop drop ;


: d! ( n addr -- )
  dup dict-size + swap +do
    256 /mod swap i c!
  loop drop ;


: d-emit ( n -- )
  dict-size 0 +do
    256 /mod swap emit
  loop drop ;


: d-read ( -- n )
  0 dict-size 0 +do
    next-char? drop char-buf c@ i 8 * lshift +
  loop ;


: d, ( n -- )
  dict-size 0 +do
    256 /mod swap c,
  loop drop ;


( Decoding )


: decoder-cell ( -- size ) dict-size 1+ chars ;

: decoder-entry>addr ( entry -- addr ) decoder-cell * dict + ;

: parent ( entry -- addr ) decoder-entry>addr ;

: decoder-char ( entry -- addr ) decoder-entry>addr dict-size chars + ;


: reset-d-dict ( -- )
  dict here - decoder-cell + allot
  0 0 parent d!
  0 0 decoder-char c! ;


: d-dict-size ( -- n )
  here dict - decoder-cell / ;


: emit-char ( entry -- )
  char-buf c@ emit
  d-dict-size decoder-cell allot
  char-buf c@ over decoder-char c!
  parent d! ;


: traverse-decoder ( -- entry )
  here d-read tuck begin dup while
    dup decoder-char c@ c,
    parent d@
  repeat drop
  here over 1- over 1- -do
    i c@ emit
  1 -loop - allot ;


: decode-lz ( -- )
  get-char to dict-size
  here to dict reset-d-dict
  0 begin next-char? while
    emit-char traverse-decoder
    d-dict-size 1 dict-size 8 * lshift >=
    if reset-d-dict drop 0 then
  repeat drop ;


( Encoding )


: encoder-cell ( -- size ) dict-size 2* 1+ chars ;

: encoder-entry>addr ( entry -- addr ) encoder-cell * dict + ;

: sibling ( entry -- addr ) encoder-entry>addr ;

: child ( entry -- addr ) encoder-entry>addr dict-size chars + ;

: encoder-char ( entry -- addr ) encoder-entry>addr dict-size 2* chars + ;


: reset-e-dict ( -- )
  dict here - encoder-cell + allot
  0 0 sibling d!
  0 0 child d!
  0 0 encoder-char c! ;


: e-dict-size ( -- n )
  here dict - encoder-cell / ;


: append-char ( entry -- )
  char-buf c@ emit
  e-dict-size encoder-cell allot
  over child d@ over sibling d!
  0 over child d!
  char-buf c@ over encoder-char c!
  swap child d! ;


: next-entry? ( entry -- entry ? )
  dup child d@
  begin dup while
    dup encoder-char c@
    char-buf c@ <> while
    sibling d@
  repeat nip true else drop false then ;


: traverse-encoder ( -- entry ? )
  0 begin
    next-char? while
    next-entry? 0=
  until true else false then 
  over d-emit ;


: encode-lz ( n -- )
  dup to dict-size emit next-char? if
    here to dict reset-e-dict
    0 begin
      append-char traverse-encoder
      e-dict-size 1 dict-size 8 * lshift >=
      if reset-e-dict nip 0 swap then
    0= until drop
  then ;


: help ( -- )
  ." Usage: gforth entry.fs (-h | -d | -e n)" cr
  cr
  ." Options:" cr
  cr
  ."         -h" cr
  ."                 Print this help." cr
  cr
  ."         -d" cr
  ."                 Decode the stream passed from standard input." cr
  ."                 Dictionary size is encoded in the data." cr
  cr
  ."         -e n" cr
  ."                 Encode the stream passed from standard input." cr
  ."                 n denotes dictionary address size in bytes." cr ;


: entry ( -- )
  argc @ 1 <= if ." Not enough arguments." cr cr help else
    next-arg case
      2dup s" -d" str= true of 2drop decode-lz endof drop
      2dup s" -h" str= true of 2drop help      endof drop
      2dup s" -e" str= true of 2drop
        next-arg dup 0= if
          2drop ." Encoding requires dictionary size." cr cr help
        else
          s>unumber? if
            drop encode-lz
          else
            2drop ." Encoding requires dictionary size." cr cr help
          then
        then
      endof drop ." Invalid option: " type cr cr help 0 endcase
  then ;


entry bye
specs.lz data

round #57

submitted at
0 likes

guesses
comments 1
olus2000 *known at the time as [author of #1]

The provided entry is written in Malbolge code.


post a comment


ai ASCII text
1
(=<;:9]76ZG9876543210/.-,+*)('&%$#"!~}|{z987Z5t3E

round #56

submitted at
0 likes

guesses
comments 3
olus2000 *known at the time as [author of #12]

There exist certain input methods that establish different inputs. You can simulate them for varying input tests or introduce real input into the interpreter.


cdr sa

thank you olus2000 (UID: 339009650592710656)


olus

language by olus2000 code by olus2000


post a comment


entry.prick ASCII text, with very long lines (46062)
 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
79
80
Code by olus2000 (UID: 339009650592710656)
Takes: length of input in cell 0 and input in following cells
Returns: length of output in cell 0 and output in following cells
Runs on the reference implementation.
: comment


over >aux
rot drop swap dup rot
: parse-(


rot drop aux> rot rot
: parse-)


rot drop swap dup rot ++ $ 1 [ dup ++ @ 42 != |
    swap drop swap drop aux@ aux@ rot
    1 >aux 0 @ [ aux@ |
        1 [ dup @ 40 != over @ 92 != * over @ 41 != * over @ 124 != * | ++ ]
        1 [ dup @ 40  != 1 != | 0 0 @ [ 1 [ over @ 41 != 1 != | -- ] 1 [ over @ 40 != 1 != | ++ ] dup | 1 [ over @ 92 != 1 != | swap ++ swap ] swap ++ swap ] drop ++ ]
        1 [ dup @ 92  != 1 != | ++ ++ ]
        1 [ dup @ 41  != 1 != | aux> aux> drop >aux ++ 1 [ dup 42 != 1 != | -- aux> -- >aux ] 1 [ aux@ | swap drop swap drop aux> aux@ swap >aux dup rot ] ]
        1 [ dup @ 124 != 1 != | aux> -- >aux ]
    ] aux> drop
]
: parse-[


rot drop
>aux dup ++ aux> ++
over over @ swap !
: parse-\


1 0 @ [ 1 [ over @ 41 != 1 != | -- ] 1 [ over @ 40 != 1 != | ++ ] dup | 1 [ over @ 92 != 1 != | swap ++ swap ] swap ++ swap ] drop --
: parse-|


swap drop swap dup rot
: parse-*


rot drop
>aux dup ++ aux>
over over @ swap !
: parse-c


1
dup [ over @ 40  != 1 != | drop parse-( 0 ]
dup [ over @ 41  != 1 != | drop parse-) 0 ]
dup [ over @ 91  != 1 != | drop parse-[ 0 ]
dup [ over @ 92  != 1 != | drop parse-\ 0 ]
dup [ over @ 124 != 1 != | drop parse-| 0 ]
dup [ over @ 42  != 1 != | drop parse-* 0 ]
    [               1    |      parse-c   ]
++
: parse-char


102 124 111 111 42
5 dup 0 ! dup >aux [ 1 | aux@ ! aux> -- >aux ] aux> drop
: _input


92 91 92 93 40 91 93 102 100 115 124 113 91 93 42 119 101 41 40 114 116 91 93 121 104 124 108 115 91 93 59 92 41 41 42
35 dup 0 ! dup >aux [ 1 | aux@ ! aux> -- >aux ] aux> drop
: input


117 115 42 92 92 68 120 49 52 91 93 74 124 92 59 55 42 117 91 93 124 92 59 91 93 99 92 92 99 124 99 91 93 118 120 42 82 90 118 124 92 96 42 91 93 85 92 96 42 124 92 36 122 42 91 93 92 42 88 81 69 92 125 92 42 124 92 46 84 42 92 91 92 94 42 83 106 91 93 106 124 40 77 103 41 42 77 42 92 58 42 92 42 92 39 92 33 112 91 93 112 124 77 42 91 93 55 122 53 55 124 91 93 92 126 92 64 66 82 92 126 124 48 97 42 51 76 108 52 88 92 45 124 85 74 91 93 92 92 124 40 92 96 91 93 70 55 48 70 124 92 125 42 68 66 88 117 42 91 93 90 42 124 91 93 78 88 84 42 67 92 125 42 78 124 74 42 75 116 73 53 124 91 93 124 92 123 91 93 92 123 124 91 93 118 42 124 92 64 42 91 93 124 92 91 42 92 41 56 101 42 84 92 37 86 42 68 91 93 124 50 72 92 60 98 91 93 90 90 124 91 93 40 72 42 117 92 125 42 72 42 121 112 91 93 66 66 124 49 42 92 124 42 91 93 40 65 100 74 92 38 92 40 99 41 92 41 92 63 113 40 65 100 74 92 38 92 40 99 41 124 92 39 91 93 114 124 115 42 92 95 91 93 101 101 124 110 91 93 83 124 91 93 92 60 92 60 124 51 82 91 93 82 124 56 42 108 121 42 111 92 33 42 86 92 61 124 101 92 47 98 91 93 41 41 91 93 68 68 124 40 92 60 55 41 67 65 91 93 40 91 93 124 70 91 93 104 42 124 55 91 93 124 91 93 113 71 40 97 91 93 85 97 124 92 126 42 90 92 93 98 79 42 91 93 85 82 85 124 92 38 115 118 117 76 40 102 83 42 92 39 101 118 81 124 92 36 71 42 91 93 78 67 82 42 98 42 71 42 124 117 121 91 93 73 121 124 91 93 124 109 88 91 93 92 124 92 124 124 65 82 91 93 50 42 65 115 122 42 92 35 50 42 41 68 124 92 93 42 91 93 124 52 42 91 93 122 98 52 42 124 78 91 93 124 91 93 86 92 63 81 107 42 86 124 91 93 92 62 87 103 120 42 92 33 109 92 62 41 42 92 33 103 113 124 50 91 93 121 124 92 47 92 33 124 40 92 58 91 93 72 66 109 42 92 36 92 58 124 100 91 93 124 75 110 109 91 93 92 38 42 92 62 109 124 82 92 125 42 91 93 107 42 92 38 79 97 42 92 125 42 124 114 117 88 91 93 110 42 88 124 92 35 114 91 93 97 108 42 97 124 91 93 103 92 43 92 45 103 124 91 93 124 92 46 92 37 108 91 93 69 102 42 108 124 101 42 91 93 113 92 35 42 92 42 101 101 42 124 92 63 42 80 116 91 93 92 96 92 41 116 124 91 93 104 42 104 42 124 124 92 62 92 59 50 42 82 107 42 92 92 104 91 93 104 124 100 92 123 92 46 42 103 71 91 93 69 42 71 41 42 92 62 108 42 91 93 124 91 93 124 92 45 92 41 112 91 93 84 42 92 91 92 96 84 42 124 91 93 124 92 59 91 93 92 61 92 59 41 124 82 91 93 92 42 92 42 124 119 65 90 109 68 55 91 93 55 124 92 47 91 93 92 62 92 42 42 72 86 40 80 42 117 92 61 91 93 92 47 65 65 42 74 92 61 124 79 82 92 35 42 88 90 42 110 42 91 93 71 71 124 110 42 52 92 126 42 92 95 97 91 93 40 72 91 93 124 91 93 124 106 91 93 101 84 106 124 92 40 77 81 42 92 92 92 62 42 91 93 53 124 92 61 92 126 103 42 49 124 88 92 39 80 117 42 92 34 120 91 93 79 79 124 98 92 92 91 93 110 83 110 124 91 93 70 92 96 92 35 70 124 68 91 93 118 49 92 34 92 47 68 124 55 119 49 83 42 104 91 93 120 104 124 113 119 91 93 117 42 109 86 117 42 124 107 122 92 94 91 93 92 63 90 92 94 41 97 124 110 116 91 93 92 124 42 116 124 92 125 88 92 40 76 42 76 91 93 124 92 40 97 117 92 35 42 32 42 75 91 93 124 92 39 42 91 93 124 92 33 66 42 91 93 92 38 124 83 97 49 91 93 92 60 92 60 124 91 93 122 42 124 92 63 92 96 73 42 118 92 60 92 43 98 42 41 42 92 95 92 62 124 92 47 42 91 93 72 119 72 124 122 100 91 93 71 100 124 92 123 92 63 114 71 92 95 91 93 51 78 51 124 92 96 91 93 85 42 92 96 124 82 91 93 92 45 92 126 42 92 126 68 82 124 100 42 32 92 60 91 93 124 66 92 96 92 34 91 93 92 45 108 92 39 69 92 45 124 91 93 40 67 88 85 111 42 85 69 49 124 92 34 118 91 93 118 124 91 93 124 68 84 77 42 91 93 41 88 84 40 67 88 85 111 42 85 69 49 124 92 34 118 91 93 118 124 91 93 124 68 84 77 42 91 93 41 124 91 93 86 42 92 34 42 86 42 124 107 91 93 92 126 92 91 92 126 124 92 37 85 42 91 93 85 42 124 80 57 71 92 96 91 93 57 76 92 91 92 96 124 92 61 92 60 42 91 93 92 33 92 38 92 123 42 92 60 42 124 99 42 109 42 91 93 67 109 42 124 91 93 92 62 114 85 70 92 45 92 62 124 117 91 93 68 92 91 92 93 68 107 52 117 124 92 35 53 78 76 74 42 92 46 42 91 93 92 46 42 124 116 91 93 92 33 42 106 92 125 105 42 92 124 40 98 91 93 92 96 92 96 124 92 47 83 57 92 45 74 74 41 116 124 92 92 56 91 93 56 124 89 92 61 86 86 108 102 91 93 124 92 45 91 93 49 122 92 45 124 74 91 93 90 116 42 74 124 99 92 43 42 92 93 42 91 93 110 42 72 100 92 93 42 124 105 78 112 92 124 54 42 50 91 93 40 108 92 45 91 93 92 45 124 40 91 93 122 42 124 92 126 98 124 91 93 92 64 73 80 42 92 38 85 87 121 92 64 124 92 124 91 93 50 124 92 61 118 119 87 42 91 93 92 34 68 75 92 34 41 42 91 93 54 92 126 68 40 91 93 122 42 124 92 126 98 124 91 93 92 64 73 80 42 92 38 85 87 121 92 64 124 92 124 91 93 50 124 92 61 118 119 87 42 91 93 92 34 68 75 92 34 41 42 124 91 93 124 99 32 42 92 91 75 91 93 75 124 91 93 124 91 93 124 51 91 93 124 52 42 91 93 92 94 42 124 122 42 83 42 40 92 33 97 40 32 92 36 80 41 91 93 69 124 81 92 64 116 92 59 42 92 125 92 37 81 75 124 92 58 85 89 72 92 37 91 93 71 41 106 92 40 124 92 61 91 93 124 92 61 81 92 37 91 93 101 101 124 85 92 33 92 42 91 93 48 92 42 124 92 94 92 47 91 93 92 96 42 75 42 92 47 124 87 98 92 36 92 58 91 93 107 105 107 124 92 59 42 91 93 76 92 59 42 41 42 40 108 92 45 91 93 92 45 124 40 91 93 122 42 124 92 126 98 124 91 93 92 64 73 80 42 92 38 85 87 121 92 64 124 92 124 91 93 50 124 92 61 118 119 87 42 91 93 92 34 68 75 92 34 41 42 91 93 54 92 126 68 40 91 93 122 42 124 92 126 98 124 91 93 92 64 73 80 42 92 38 85 87 121 92 64 124 92 124 91 93 50 124 92 61 118 119 87 42 91 93 92 34 68 75 92 34 41 42 124 91 93 124 99 32 42 92 91 75 91 93 75 124 91 93 124 91 93 124 51 91 93 124 52 42 91 93 92 94 42 124 122 42 83 42 40 92 33 97 40 32 92 36 80 41 91 93 69 124 81 92 64 116 92 59 42 92 125 92 37 81 75 124 92 58 85 89 72 92 37 91 93 71 41 106 92 40 124 92 61 91 93 124 92 61 81 92 37 91 93 101 101 124 85 92 33 92 42 91 93 48 92 42 124 92 94 92 47 91 93 92 96 42 75 42 92 47 124 87 98 92 36 92 58 91 93 107 105 107 124 92 59 42 91 93 76 92 59 42 41 42 124 92 92 108 118 105 74 40 105 124 111 92 92 91 93 40 53 91 93 124 91 93 92 40 92 40 124 92 43 105 74 42 73 100 124 91 93 124 91 93 124 91 93 124 91 93 104 120 52 86 42 92 58 104 124 91 93 124 82 120 115 109 52 91 93 71 101 71 124 91 93 77 92 63 120 122 77 124 92 126 42 99 91 93 92 94 51 92 92 99 124 51 109 91 93 124 91 93 122 51 80 119 42 72 122 41 41 119 69 91 93 124 92 39 91 93 92 61 92 33 54 92 61 124 92 93 77 42 107 69 68 91 93 88 68 124 118 92 95 91 93 105 92 33 40 91 93 99 42 124 91 93 124 92 95 91 93 92 59 92 59 124 91 93 124 92 37 91 93 92 37 124 49 124 114 48 86 91 93 92 35 40 84 42 82 42 55 51 124 92 36 120 81 87 98 119 92 43 91 93 82 124 51 92 47 42 76 91 93 122 76 124 92 43 91 93 92 59 92 59 41 89 42 86 124 80 65 92 126 92 59 83 116 91 93 92 33 41 105 124 92 60 102 87 91 93 75 92 94 92 44 87 124 92 96 92 35 79 78 91 93 92 38 102 106 92 38 124 92 91 122 92 63 82 91 93 69 69 124 92 125 92 39 92 96 42 92 123 92 63 32 119 42 91 93 107 124 83 91 93 92 63 40 103 91 93 73 80 75 92 33 42 103 124 92 40 92 41 51 56 49 32 82 92 40 42 91 93 124 92 60 91 93 92 60 124 74 91 93 92 40 92 36 92 40 124 121 82 74 42 99 92 34 92 62 55 92 38 41 121 83 124 91 93 85 42 117 92 92 89 92 40 85 42 124 103 92 62 32 42 91 93 70 85 106 70 124 87 84 81 104 91 93 67 104 124 92 46 75 42 79 91 93 120 79 42 120 124 114 108 92 124 42 91 93 52 52 124 98 92 59 92 39 42 91 93 103 103 124 32 54 77 92 126 92 61 42 91 93 92 125 92 123 42 92 125 124 118 98 91 93 99 42 124 118 98 92 125 79 40 100 82 89 92 91 119 72 42 91 93 40 92 58 42 77 40 99 99 87 41 92 41 42 91 93 122 88 122 124 91 93 124 91 93 124 77 91 93 92 35 116 50 92 61 69 101 77 124 92 39 52 88 92 59 42 88 91 93 88 124 92 42 76 41 124 82 42 124 40 91 93 124 69 91 93 92 47 42 109 69 124 84 42 92 64 91 93 92 64 124 92 34 124 92 41 92 125 91 93 92 125 124 105 40 92 35 92 34 42 48 91 93 119 80 42 110 119 124 101 89 57 48 42 108 42 81 42 91 93 92 36 42 124 91 93 124 73 42 76 42 108 124 109 40 91 93 68 124 112 66 92 61 69 91 93 78 42 124 113 92 46 98 42 114 92 47 91 93 116 40 91 93 89 42 110 55 111 81 89 42 124 118 111 40 92 47 92 95 42 92 95 77 92 64 42 124 112 50 42 74 112 91 93 112 124 92 46 42 74 121 42 91 93 71 92 64 71 124 92 63 32 71 42 91 93 65 92 35 71 42 124 116 91 93 92 92 77 116 41 49 42 91 93 92 40 92 58 108 42 92 40 124 105 42 92 33 41 92 47 124 91 93 124 92 44 42 122 42 92 125 91 93 124 79 92 94 42 92 40 92 58 124 91 93 82 82 124 52 42 91 93 78 42 121 42 78 42 124 82 42 104 91 93 98 42 92 124 79 50 88 104 124 49 91 93 124 71 112 81 91 93 98 73 76 98 41 42 91 93 40 91 93 68 124 112 66 92 61 69 91 93 78 42 124 113 92 46 98 42 114 92 47 91 93 116 40 91 93 89 42 110 55 111 81 89 42 124 118 111 40 92 47 92 95 42 92 95 77 92 64 42 124 112 50 42 74 112 91 93 112 124 92 46 42 74 121 42 91 93 71 92 64 71 124 92 63 32 71 42 91 93 65 92 35 71 42 124 116 91 93 92 92 77 116 41 49 42 91 93 92 40 92 58 108 42 92 40 124 105 42 92 33 41 92 47 124 91 93 124 92 44 42 122 42 92 125 91 93 124 79 92 94 42 92 40 92 58 124 91 93 82 82 124 52 42 91 93 78 42 121 42 78 42 124 82 42 104 91 93 98 42 92 124 79 50 88 104 124 49 91 93 124 71 112 81 91 93 98 73 76 98 41 42 124 91 93 92 62 42 108 83 42 54 92 94 42 74 92 62 42 124 91 93 54 124 92 124 92 125 111 92 45 101 115 42 91 93 112 112 124 92 37 91 93 56 101 92 40 100 92 63 92 37 124 72 42 55 92 40 42 113 117 42 91 93 117 42 124 77 42 92 125 91 93 41 89 42 75 42 91 93 40 90 114 91 93 40 92 35 91 93 92 60 42 97 118 92 35 124 92 124 40 86 111 98 42 74 91 93 103 42 117 74 124 56 92 126 91 93 92 44 92 44 124 92 58 91 93 92 58 124 91 93 112 92 42 77 42 88 92 125 108 42 92 35 112 124 92 92 91 93 124 91 93 124 91 93 114 57 42 112 67 86 114 124 50 91 93 92 33 42 75 67 42 81 108 42 50 124 69 57 91 93 92 64 115 77 92 64 124 92 92 124 91 93 106 124 122 42 88 92 123 42 99 91 93 124 106 91 93 40 69 55 78 92 62 88 92 45 42 53 56 124 91 93 124 86 108 91 93 89 49 42 92 44 92 35 42 108 124 92 94 49 32 108 92 58 113 91 93 113 124 65 42 91 93 87 87 124 70 52 92 124 116 100 51 91 93 51 41 42 82 40 115 42 92 47 86 73 120 42 119 91 93 92 35 119 124 91 93 92 38 72 92 96 77 42 105 114 81 92 38 124 91 93 57 103 66 57 124 91 93 83 42 114 92 124 83 42 124 107 70 91 93 70 70 124 124 79 91 93 101 82 42 97 92 92 101 124 91 93 124 91 93 124 92 96 91 93 41 40 69 55 78 92 62 88 92 45 42 53 56 124 91 93 124 86 108 91 93 89 49 42 92 44 92 35 42 108 124 92 94 49 32 108 92 58 113 91 93 113 124 65 42 91 93 87 87 124 70 52 92 124 116 100 51 91 93 51 41 42 124 73 114 92 62 91 93 53 53 53 41 68 91 93 124 73 91 93 70 86 42 71 73 124 55 71 87 118 92 64 57 91 93 124 87 105 42 84 89 91 93 92 47 89 124 82 107 92 123 42 91 93 92 93 42 92 93 42 124 114 87 42 92 39 42 54 48 91 93 86 79 86 124 55 102 91 93 105 105 124 89 91 93 92 60 89 124 92 47 57 106 83 82 120 124 92 44 113 91 93 124 105 72 91 93 124 92 62 42 54 54 91 93 82 82 124 91 93 92 43 42 99 53 82 120 42 92 43 42 124 92 62 67 91 93 124 92 60 53 92 62 81 92 91 42 92 39 42 91 93 92 39 42 41 108 42 92 61 92 124 42 40 91 93 124 118 42 65 118 91 93 92 36 100 118 124 70 92 46 91 93 53 124 113 40 83 92 34 42 91 93 78 77 85 92 34 42 124 68 42 50 92 47 92 59 42 87 91 93 124 55 42 92 61 92 62 88 124 92 123 42 91 93 114 42 92 46 42 92 44 115 40 91 93 111 74 111 124 54 107 75 92 33 42 92 64 91 93 104 124 92 62 92 91 92 59 91 93 117 52 117 124 40 92 126 84 92 96 66 92 58 42 124 91 93 85 42 124 50 92 94 42 56 92 42 67 91 93 92 36 92 36 124 76 83 105 55 42 92 126 57 42 99 91 93 115 124 103 92 95 115 42 101 42 92 126 91 93 72 72 124 91 93 124 91 93 124 91 93 90 90 124 69 42 91 93 84 40 71 91 93 87 71 124 91 93 51 124 91 93 40 56 42 92 60 91 93 124 55 107 92 44 72 91 93 124 92 125 91 93 52 42 52 42 124 91 93 92 95 97 92 95 124 91 93 70 124 81 42 103 92 92 114 91 93 118 67 76 114 124 100 91 93 76 42 104 69 102 100 124 103 105 89 92 38 91 93 107 92 38 124 70 57 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 91 93 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 124 87 91 93 83 116 42 72 92 33 92 93 53 87 124 92 60 106 124 92 95 92 62 91 93 56 70 92 62 124 91 93 124 91 93 72 42 41 40 56 42 92 60 91 93 124 55 107 92 44 72 91 93 124 92 125 91 93 52 42 52 42 124 91 93 92 95 97 92 95 124 91 93 70 124 81 42 103 92 92 114 91 93 118 67 76 114 124 100 91 93 76 42 104 69 102 100 124 103 105 89 92 38 91 93 107 92 38 124 70 57 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 91 93 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 124 87 91 93 83 116 42 72 92 33 92 93 53 87 124 92 60 106 124 92 95 92 62 91 93 56 70 92 62 124 91 93 124 91 93 72 42 41 124 109 92 124 91 93 49 48 49 124 79 91 93 79 124 92 62 92 94 104 32 92 126 42 109 92 123 91 93 124 51 42 91 93 79 92 91 79 124 91 93 124 92 60 42 81 42 54 92 124 92 38 91 93 106 42 92 64 106 42 124 57 48 92 58 86 91 93 92 63 92 45 92 125 92 63 124 92 64 68 122 52 92 44 42 55 42 100 92 93 91 93 124 91 93 114 84 42 92 92 54 114 124 109 91 93 92 36 83 92 46 121 109 124 120 57 42 111 92 43 92 93 92 62 124 92 42 91 93 124 67 42 91 93 41 69 42 124 40 81 106 116 124 103 76 101 66 90 91 93 108 108 124 91 93 99 124 115 72 42 54 91 93 111 42 41 91 93 107 92 60 92 40 42 107 107 124 108 42 91 93 108 42 41 98 42 119 91 93 92 44 92 43 92 92 92 44 124 92 58 66 91 93 81 42 57 81 42 124 92 42 105 42 109 107 91 93 124 53 91 93 112 92 35 92 58 71 112 124 92 36 91 93 57 118 84 40 55 42 90 121 92 94 67 99 92 95 42 91 93 124 92 45 108 91 93 92 44 124 48 92 61 92 38 91 93 92 38 124 55 42 40 40 92 43 56 42 104 92 93 71 42 92 93 42 53 42 88 124 109 92 125 42 84 42 86 42 91 93 81 84 42 86 42 41 119 73 92 123 91 93 82 67 92 96 42 92 123 124 91 93 79 92 37 81 52 92 47 79 124 74 42 40 91 93 124 71 42 120 92 123 103 41 91 93 114 124 79 69 42 92 33 69 42 41 91 93 67 92 41 67 124 92 58 91 93 120 120 124 91 93 124 114 105 92 91 77 92 124 92 95 91 93 92 35 92 35 124 91 93 86 124 91 93 92 59 124 92 63 104 91 93 124 97 92 93 110 42 89 42 40 91 93 124 124 115 42 87 108 54 42 55 91 93 124 111 42 92 42 42 92 63 91 93 92 46 92 60 69 42 67 92 46 124 56 91 93 92 64 92 61 56 41 92 58 91 93 65 124 103 92 44 52 92 59 73 117 42 49 124 112 91 93 85 66 92 60 42 92 91 85 41 42 121 57 124 83 42 122 92 42 91 93 107 124 118 40 32 92 37 42 117 104 92 126 109 42 92 96 91 93 111 124 92 62 79 92 47 42 92 124 103 42 41 42 92 38 51 41 114 42 124 91 93 92 46 124 92 39 87 92 34 42 91 93 92 36 40 92 92 105 103 49 91 93 122 49 124 91 93 105 42 105 42 124 91 93 92 47 92 47 124 92 91 54 42 91 93 118 119 50 104 42 54 42 124 113 42 110 92 92 91 93 92 92 124 91 93 92 35 124 86 91 93 71 42 107 42 122 87 75 42 71 42 124 92 47 106 42 40 111 116 56 124 76 42 91 93 90 42 92 34 53 76 42 124 91 93 124 91 93 124 90 42 91 93 72 124 101 92 62 92 124 48 42 91 93 57 42 124 91 93 41 68 92 43 92 96 92 35 124 92 125 52 69 114 42 100 92 35 42 91 93 92 125 42 124 97 42 91 93 124 104 42 89 92 46 122 91 93 56 42 92 91 104 56 42 41 92 36 92 34 42 124 97 117 77 42 91 93 77 42 124 91 93 124 79 91 93 92 64 92 33 79 41 115 91 93 115 124 91 93 124 92 60 91 93 92 91 92 93 92 46 50 92 60 124 111 91 93 73 73 124 86 92 33 91 93 92 94 92 42 114 79 92 33 124 122 91 93 92 33 92 37 40 90 115 124 92 36 40 48 74 73 92 60 42 92 92 42 91 93 92 62 40 72 99 88 42 52 92 46 42 124 68 91 93 48 100 48 124 92 46 79 66 107 101 76 91 93 84 84 124 92 63 86 91 93 99 84 92 124 88 86 99 41 92 92 42 124 100 41 122 91 93 56 42 102 56 42 124 80 92 94 91 93 103 54 108 42 92 125 71 42 92 94 124 89 42 112 92 96 92 41 91 93 77 86 77 124 90 91 93 73 73 124 91 93 92 44 92 44 124 91 93 51 92 60 42 92 61 42 92 92 51 124 91 93 104 92 38 97 86 42 104 124 91 93 119 124 57 91 93 67 92 60 98 92 40 66 42 67 124 92 46 92 95 91 93 117 49 117 124 92 45 92 59 121 42 92 96 92 95 91 93 92 91 92 95 124 92 37 92 42 92 44 92 125 88 92 34 91 93 124 73 91 93 73 41 122 124 53 114 42 91 93 71 109 42 108 92 38 88 114 42 124 91 93 114 124 92 96 42 92 126 103 91 93 103 124 70 92 62 78 92 96 80 81 92 46 124 114 40 92 40 104 79 120 41 68 91 93 124 79 92 39 42 91 93 92 62 75 117 92 62 124 67 42 92 47 42 99 92 41 48 42 78 91 93 78 41 114 124 91 93 124 92 64 82 92 59 40 114 75 91 93 57 42 92 59 40 82 92 94 115 91 93 92 44 124 51 49 124 91 93 124 92 39 92 37 92 126 91 93 92 35 42 69 92 126 124 56 42 91 93 66 92 46 92 61 56 42 124 91 93 124 92 46 92 61 91 93 124 91 93 124 91 93 105 92 36 78 92 58 92 94 75 105 124 92 124 91 93 124 40 48 84 101 92 60 52 82 112 92 125 41 92 92 74 91 93 74 124 91 93 41 97 75 124 77 107 91 93 92 43 42 92 94 42 76 107 124 100 85 42 92 125 54 42 76 76 92 33 124 92 44 117 52 68 79 54 42 91 93 75 124 91 93 92 39 124 92 46 48 92 64 92 124 53 106 91 93 124 100 42 119 92 41 92 47 53 98 92 34 50 91 93 124 92 62 92 59 91 93 52 52 124 92 45 92 125 82 42 88 85 91 93 117 124 113 91 93 113 124 120 57 91 93 92 35 83 73 42 92 63 92 35 124 81 92 58 92 34 77 91 93 117 42 41 80 42 91 93 80 42 124 92 62 91 93 92 123 92 42 106 92 62 124 69 91 93 114 114 124 92 60 78 92 92 92 63 91 93 121 124 90 92 37 42 91 93 121 92 46 92 37 42 124 105 92 34 42 92 38 48 91 93 124 92 42 108 81 42 124 52 42 91 93 75 42 68 49 75 42 124 92 125 85 42 91 93 85 42 124 92 125 84 92 61 42 87 92 64 55 116 42 91 93 116 42 124 91 93 92 41 124 113 92 35 75 91 93 92 44 40 100 92 61 107 83 107 92 126 81 41 101 92 37 75 41 40 90 114 91 93 40 92 35 91 93 92 60 42 97 118 92 35 124 92 124 40 86 111 98 42 74 91 93 103 42 117 74 124 56 92 126 91 93 92 44 92 44 124 92 58 91 93 92 58 124 91 93 112 92 42 77 42 88 92 125 108 42 92 35 112 124 92 92 91 93 124 91 93 124 91 93 114 57 42 112 67 86 114 124 50 91 93 92 33 42 75 67 42 81 108 42 50 124 69 57 91 93 92 64 115 77 92 64 124 92 92 124 91 93 106 124 122 42 88 92 123 42 99 91 93 124 106 91 93 40 69 55 78 92 62 88 92 45 42 53 56 124 91 93 124 86 108 91 93 89 49 42 92 44 92 35 42 108 124 92 94 49 32 108 92 58 113 91 93 113 124 65 42 91 93 87 87 124 70 52 92 124 116 100 51 91 93 51 41 42 82 40 115 42 92 47 86 73 120 42 119 91 93 92 35 119 124 91 93 92 38 72 92 96 77 42 105 114 81 92 38 124 91 93 57 103 66 57 124 91 93 83 42 114 92 124 83 42 124 107 70 91 93 70 70 124 124 79 91 93 101 82 42 97 92 92 101 124 91 93 124 91 93 124 92 96 91 93 41 40 69 55 78 92 62 88 92 45 42 53 56 124 91 93 124 86 108 91 93 89 49 42 92 44 92 35 42 108 124 92 94 49 32 108 92 58 113 91 93 113 124 65 42 91 93 87 87 124 70 52 92 124 116 100 51 91 93 51 41 42 124 73 114 92 62 91 93 53 53 53 41 68 91 93 124 73 91 93 70 86 42 71 73 124 55 71 87 118 92 64 57 91 93 124 87 105 42 84 89 91 93 92 47 89 124 82 107 92 123 42 91 93 92 93 42 92 93 42 124 114 87 42 92 39 42 54 48 91 93 86 79 86 124 55 102 91 93 105 105 124 89 91 93 92 60 89 124 92 47 57 106 83 82 120 124 92 44 113 91 93 124 105 72 91 93 124 92 62 42 54 54 91 93 82 82 124 91 93 92 43 42 99 53 82 120 42 92 43 42 124 92 62 67 91 93 124 92 60 53 92 62 81 92 91 42 92 39 42 91 93 92 39 42 41 108 42 92 61 92 124 42 40 91 93 124 118 42 65 118 91 93 92 36 100 118 124 70 92 46 91 93 53 124 113 40 83 92 34 42 91 93 78 77 85 92 34 42 124 68 42 50 92 47 92 59 42 87 91 93 124 55 42 92 61 92 62 88 124 92 123 42 91 93 114 42 92 46 42 92 44 115 40 91 93 111 74 111 124 54 107 75 92 33 42 92 64 91 93 104 124 92 62 92 91 92 59 91 93 117 52 117 124 40 92 126 84 92 96 66 92 58 42 124 91 93 85 42 124 50 92 94 42 56 92 42 67 91 93 92 36 92 36 124 76 83 105 55 42 92 126 57 42 99 91 93 115 124 103 92 95 115 42 101 42 92 126 91 93 72 72 124 91 93 124 91 93 124 91 93 90 90 124 69 42 91 93 84 40 71 91 93 87 71 124 91 93 51 124 91 93 40 56 42 92 60 91 93 124 55 107 92 44 72 91 93 124 92 125 91 93 52 42 52 42 124 91 93 92 95 97 92 95 124 91 93 70 124 81 42 103 92 92 114 91 93 118 67 76 114 124 100 91 93 76 42 104 69 102 100 124 103 105 89 92 38 91 93 107 92 38 124 70 57 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 91 93 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 124 87 91 93 83 116 42 72 92 33 92 93 53 87 124 92 60 106 124 92 95 92 62 91 93 56 70 92 62 124 91 93 124 91 93 72 42 41 40 56 42 92 60 91 93 124 55 107 92 44 72 91 93 124 92 125 91 93 52 42 52 42 124 91 93 92 95 97 92 95 124 91 93 70 124 81 42 103 92 92 114 91 93 118 67 76 114 124 100 91 93 76 42 104 69 102 100 124 103 105 89 92 38 91 93 107 92 38 124 70 57 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 91 93 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 124 87 91 93 83 116 42 72 92 33 92 93 53 87 124 92 60 106 124 92 95 92 62 91 93 56 70 92 62 124 91 93 124 91 93 72 42 41 124 109 92 124 91 93 49 48 49 124 79 91 93 79 124 92 62 92 94 104 32 92 126 42 109 92 123 91 93 124 51 42 91 93 79 92 91 79 124 91 93 124 92 60 42 81 42 54 92 124 92 38 91 93 106 42 92 64 106 42 124 57 48 92 58 86 91 93 92 63 92 45 92 125 92 63 124 92 64 68 122 52 92 44 42 55 42 100 92 93 91 93 124 91 93 114 84 42 92 92 54 114 124 109 91 93 92 36 83 92 46 121 109 124 120 57 42 111 92 43 92 93 92 62 124 92 42 91 93 124 67 42 91 93 41 69 42 124 40 81 106 116 124 103 76 101 66 90 91 93 108 108 124 91 93 99 124 115 72 42 54 91 93 111 42 41 91 93 107 92 60 92 40 42 107 107 124 108 42 91 93 108 42 41 98 42 119 91 93 92 44 92 43 92 92 92 44 124 92 58 66 91 93 81 42 57 81 42 124 92 42 105 42 109 107 91 93 124 53 91 93 112 92 35 92 58 71 112 124 92 36 91 93 57 118 84 40 55 42 90 121 92 94 67 99 92 95 42 91 93 124 92 45 108 91 93 92 44 124 48 92 61 92 38 91 93 92 38 124 55 42 40 40 92 43 56 42 104 92 93 71 42 92 93 42 53 42 88 124 109 92 125 42 84 42 86 42 91 93 81 84 42 86 42 41 119 73 92 123 91 93 82 67 92 96 42 92 123 124 91 93 79 92 37 81 52 92 47 79 124 74 42 40 91 93 124 71 42 120 92 123 103 41 91 93 114 124 79 69 42 92 33 69 42 41 91 93 67 92 41 67 124 92 58 91 93 120 120 124 91 93 124 114 105 92 91 77 92 124 92 95 91 93 92 35 92 35 124 91 93 86 124 91 93 92 59 124 92 63 104 91 93 124 97 92 93 110 42 89 42 40 91 93 124 124 115 42 87 108 54 42 55 91 93 124 111 42 92 42 42 92 63 91 93 92 46 92 60 69 42 67 92 46 124 56 91 93 92 64 92 61 56 41 92 58 91 93 65 124 103 92 44 52 92 59 73 117 42 49 124 112 91 93 85 66 92 60 42 92 91 85 41 42 121 57 124 83 42 122 92 42 91 93 107 124 118 40 32 92 37 42 117 104 92 126 109 42 92 96 91 93 111 124 92 62 79 92 47 42 92 124 103 42 41 42 92 38 51 41 114 42 124 91 93 92 46 124 92 39 87 92 34 42 91 93 92 36 40 92 92 105 103 49 91 93 122 49 124 91 93 105 42 105 42 124 91 93 92 47 92 47 124 92 91 54 42 91 93 118 119 50 104 42 54 42 124 113 42 110 92 92 91 93 92 92 124 91 93 92 35 124 86 91 93 71 42 107 42 122 87 75 42 71 42 124 92 47 106 42 40 111 116 56 124 76 42 91 93 90 42 92 34 53 76 42 124 91 93 124 91 93 124 90 42 91 93 72 124 101 92 62 92 124 48 42 91 93 57 42 124 91 93 41 68 92 43 92 96 92 35 124 92 125 52 69 114 42 100 92 35 42 91 93 92 125 42 124 97 42 91 93 124 104 42 89 92 46 122 91 93 56 42 92 91 104 56 42 41 92 36 92 34 42 124 97 117 77 42 91 93 77 42 124 91 93 124 79 91 93 92 64 92 33 79 41 115 91 93 115 124 91 93 124 92 60 91 93 92 91 92 93 92 46 50 92 60 124 111 91 93 73 73 124 86 92 33 91 93 92 94 92 42 114 79 92 33 124 122 91 93 92 33 92 37 40 90 115 124 92 36 40 48 74 73 92 60 42 92 92 42 91 93 92 62 40 72 99 88 42 52 92 46 42 124 68 91 93 48 100 48 124 92 46 79 66 107 101 76 91 93 84 84 124 92 63 86 91 93 99 84 92 124 88 86 99 41 92 92 42 124 100 41 122 91 93 56 42 102 56 42 124 80 92 94 91 93 103 54 108 42 92 125 71 42 92 94 124 89 42 112 92 96 92 41 91 93 77 86 77 124 90 91 93 73 73 124 91 93 92 44 92 44 124 91 93 51 92 60 42 92 61 42 92 92 51 124 91 93 104 92 38 97 86 42 104 124 91 93 119 124 57 91 93 67 92 60 98 92 40 66 42 67 124 92 46 92 95 91 93 117 49 117 124 92 45 92 59 121 42 92 96 92 95 91 93 92 91 92 95 124 92 37 92 42 92 44 92 125 88 92 34 91 93 124 73 91 93 73 41 122 124 53 114 42 91 93 71 109 42 108 92 38 88 114 42 124 91 93 114 124 92 96 42 92 126 103 91 93 103 124 70 92 62 78 92 96 80 81 92 46 124 114 40 92 40 104 79 120 41 68 91 93 124 79 92 39 42 91 93 92 62 75 117 92 62 124 67 42 92 47 42 99 92 41 48 42 78 91 93 78 41 114 124 91 93 124 92 64 82 92 59 40 114 75 91 93 57 42 92 59 40 82 92 94 115 91 93 92 44 124 51 49 124 91 93 124 92 39 92 37 92 126 91 93 92 35 42 69 92 126 124 56 42 91 93 66 92 46 92 61 56 42 124 91 93 124 92 46 92 61 91 93 124 91 93 124 91 93 105 92 36 78 92 58 92 94 75 105 124 92 124 91 93 124 40 48 84 101 92 60 52 82 112 92 125 41 92 92 74 91 93 74 124 91 93 41 97 75 124 77 107 91 93 92 43 42 92 94 42 76 107 124 100 85 42 92 125 54 42 76 76 92 33 124 92 44 117 52 68 79 54 42 91 93 75 124 91 93 92 39 124 92 46 48 92 64 92 124 53 106 91 93 124 100 42 119 92 41 92 47 53 98 92 34 50 91 93 124 92 62 92 59 91 93 52 52 124 92 45 92 125 82 42 88 85 91 93 117 124 113 91 93 113 124 120 57 91 93 92 35 83 73 42 92 63 92 35 124 81 92 58 92 34 77 91 93 117 42 41 80 42 91 93 80 42 124 92 62 91 93 92 123 92 42 106 92 62 124 69 91 93 114 114 124 92 60 78 92 92 92 63 91 93 121 124 90 92 37 42 91 93 121 92 46 92 37 42 124 105 92 34 42 92 38 48 91 93 124 92 42 108 81 42 124 52 42 91 93 75 42 68 49 75 42 124 92 125 85 42 91 93 85 42 124 92 125 84 92 61 42 87 92 64 55 116 42 91 93 116 42 124 91 93 92 41 124 113 92 35 75 91 93 92 44 40 100 92 61 107 83 107 92 126 81 41 101 92 37 75 41 41 92 63 116 42 92 35 91 93 77 124 91 93 124 91 93 124 48 92 45 91 93 41 42 91 93 40 86 88 90 42 92 126 91 93 92 58 42 83 92 58 42 124 91 93 124 92 93 92 33 69 92 96 124 40 55 91 93 65 89 42 92 43 98 42 92 62 42 92 124 65 124 104 91 93 124 108 89 42 73 92 38 92 94 124 91 93 66 124 92 44 91 93 106 92 44 124 115 104 32 42 81 91 93 110 124 92 34 70 91 93 124 92 125 42 91 93 109 92 45 92 91 92 35 118 109 124 92 36 83 92 64 73 49 42 91 93 56 42 49 42 41 91 93 40 55 91 93 65 89 42 92 43 98 42 92 62 42 92 124 65 124 104 91 93 124 108 89 42 73 92 38 92 94 124 91 93 66 124 92 44 91 93 106 92 44 124 115 104 32 42 81 91 93 110 124 92 34 70 91 93 124 92 125 42 91 93 109 92 45 92 91 92 35 118 109 124 92 36 83 92 64 73 49 42 91 93 56 42 49 42 41 124 97 122 91 93 97 122 124 114 91 93 50 67 114 124 70 85 91 93 108 42 82 104 42 108 42 124 91 93 103 48 92 123 88 113 42 103 124 91 93 76 80 92 42 50 71 42 76 124 55 92 91 54 91 93 120 92 91 54 124 92 61 92 63 92 64 91 93 92 40 92 33 92 62 42 92 40 124 85 92 93 42 91 93 92 93 42 124 88 91 93 124 89 42 79 92 42 42 78 91 93 124 76 92 44 50 42 118 109 91 93 71 90 109 124 78 92 38 92 59 92 47 42 119 91 93 92 59 92 59 41 40 100 82 89 92 91 119 72 42 91 93 40 92 58 42 77 40 99 99 87 41 92 41 42 91 93 122 88 122 124 91 93 124 91 93 124 77 91 93 92 35 116 50 92 61 69 101 77 124 92 39 52 88 92 59 42 88 91 93 88 124 92 42 76 41 124 82 42 124 40 91 93 124 69 91 93 92 47 42 109 69 124 84 42 92 64 91 93 92 64 124 92 34 124 92 41 92 125 91 93 92 125 124 105 40 92 35 92 34 42 48 91 93 119 80 42 110 119 124 101 89 57 48 42 108 42 81 42 91 93 92 36 42 124 91 93 124 73 42 76 42 108 124 109 40 91 93 68 124 112 66 92 61 69 91 93 78 42 124 113 92 46 98 42 114 92 47 91 93 116 40 91 93 89 42 110 55 111 81 89 42 124 118 111 40 92 47 92 95 42 92 95 77 92 64 42 124 112 50 42 74 112 91 93 112 124 92 46 42 74 121 42 91 93 71 92 64 71 124 92 63 32 71 42 91 93 65 92 35 71 42 124 116 91 93 92 92 77 116 41 49 42 91 93 92 40 92 58 108 42 92 40 124 105 42 92 33 41 92 47 124 91 93 124 92 44 42 122 42 92 125 91 93 124 79 92 94 42 92 40 92 58 124 91 93 82 82 124 52 42 91 93 78 42 121 42 78 42 124 82 42 104 91 93 98 42 92 124 79 50 88 104 124 49 91 93 124 71 112 81 91 93 98 73 76 98 41 42 91 93 40 91 93 68 124 112 66 92 61 69 91 93 78 42 124 113 92 46 98 42 114 92 47 91 93 116 40 91 93 89 42 110 55 111 81 89 42 124 118 111 40 92 47 92 95 42 92 95 77 92 64 42 124 112 50 42 74 112 91 93 112 124 92 46 42 74 121 42 91 93 71 92 64 71 124 92 63 32 71 42 91 93 65 92 35 71 42 124 116 91 93 92 92 77 116 41 49 42 91 93 92 40 92 58 108 42 92 40 124 105 42 92 33 41 92 47 124 91 93 124 92 44 42 122 42 92 125 91 93 124 79 92 94 42 92 40 92 58 124 91 93 82 82 124 52 42 91 93 78 42 121 42 78 42 124 82 42 104 91 93 98 42 92 124 79 50 88 104 124 49 91 93 124 71 112 81 91 93 98 73 76 98 41 42 124 91 93 92 62 42 108 83 42 54 92 94 42 74 92 62 42 124 91 93 54 124 92 124 92 125 111 92 45 101 115 42 91 93 112 112 124 92 37 91 93 56 101 92 40 100 92 63 92 37 124 72 42 55 92 40 42 113 117 42 91 93 117 42 124 77 42 92 125 91 93 41 89 42 75 42 91 93 40 90 114 91 93 40 92 35 91 93 92 60 42 97 118 92 35 124 92 124 40 86 111 98 42 74 91 93 103 42 117 74 124 56 92 126 91 93 92 44 92 44 124 92 58 91 93 92 58 124 91 93 112 92 42 77 42 88 92 125 108 42 92 35 112 124 92 92 91 93 124 91 93 124 91 93 114 57 42 112 67 86 114 124 50 91 93 92 33 42 75 67 42 81 108 42 50 124 69 57 91 93 92 64 115 77 92 64 124 92 92 124 91 93 106 124 122 42 88 92 123 42 99 91 93 124 106 91 93 40 69 55 78 92 62 88 92 45 42 53 56 124 91 93 124 86 108 91 93 89 49 42 92 44 92 35 42 108 124 92 94 49 32 108 92 58 113 91 93 113 124 65 42 91 93 87 87 124 70 52 92 124 116 100 51 91 93 51 41 42 82 40 115 42 92 47 86 73 120 42 119 91 93 92 35 119 124 91 93 92 38 72 92 96 77 42 105 114 81 92 38 124 91 93 57 103 66 57 124 91 93 83 42 114 92 124 83 42 124 107 70 91 93 70 70 124 124 79 91 93 101 82 42 97 92 92 101 124 91 93 124 91 93 124 92 96 91 93 41 40 69 55 78 92 62 88 92 45 42 53 56 124 91 93 124 86 108 91 93 89 49 42 92 44 92 35 42 108 124 92 94 49 32 108 92 58 113 91 93 113 124 65 42 91 93 87 87 124 70 52 92 124 116 100 51 91 93 51 41 42 124 73 114 92 62 91 93 53 53 53 41 68 91 93 124 73 91 93 70 86 42 71 73 124 55 71 87 118 92 64 57 91 93 124 87 105 42 84 89 91 93 92 47 89 124 82 107 92 123 42 91 93 92 93 42 92 93 42 124 114 87 42 92 39 42 54 48 91 93 86 79 86 124 55 102 91 93 105 105 124 89 91 93 92 60 89 124 92 47 57 106 83 82 120 124 92 44 113 91 93 124 105 72 91 93 124 92 62 42 54 54 91 93 82 82 124 91 93 92 43 42 99 53 82 120 42 92 43 42 124 92 62 67 91 93 124 92 60 53 92 62 81 92 91 42 92 39 42 91 93 92 39 42 41 108 42 92 61 92 124 42 40 91 93 124 118 42 65 118 91 93 92 36 100 118 124 70 92 46 91 93 53 124 113 40 83 92 34 42 91 93 78 77 85 92 34 42 124 68 42 50 92 47 92 59 42 87 91 93 124 55 42 92 61 92 62 88 124 92 123 42 91 93 114 42 92 46 42 92 44 115 40 91 93 111 74 111 124 54 107 75 92 33 42 92 64 91 93 104 124 92 62 92 91 92 59 91 93 117 52 117 124 40 92 126 84 92 96 66 92 58 42 124 91 93 85 42 124 50 92 94 42 56 92 42 67 91 93 92 36 92 36 124 76 83 105 55 42 92 126 57 42 99 91 93 115 124 103 92 95 115 42 101 42 92 126 91 93 72 72 124 91 93 124 91 93 124 91 93 90 90 124 69 42 91 93 84 40 71 91 93 87 71 124 91 93 51 124 91 93 40 56 42 92 60 91 93 124 55 107 92 44 72 91 93 124 92 125 91 93 52 42 52 42 124 91 93 92 95 97 92 95 124 91 93 70 124 81 42 103 92 92 114 91 93 118 67 76 114 124 100 91 93 76 42 104 69 102 100 124 103 105 89 92 38 91 93 107 92 38 124 70 57 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 91 93 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 124 87 91 93 83 116 42 72 92 33 92 93 53 87 124 92 60 106 124 92 95 92 62 91 93 56 70 92 62 124 91 93 124 91 93 72 42 41 40 56 42 92 60 91 93 124 55 107 92 44 72 91 93 124 92 125 91 93 52 42 52 42 124 91 93 92 95 97 92 95 124 91 93 70 124 81 42 103 92 92 114 91 93 118 67 76 114 124 100 91 93 76 42 104 69 102 100 124 103 105 89 92 38 91 93 107 92 38 124 70 57 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 91 93 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 124 87 91 93 83 116 42 72 92 33 92 93 53 87 124 92 60 106 124 92 95 92 62 91 93 56 70 92 62 124 91 93 124 91 93 72 42 41 124 109 92 124 91 93 49 48 49 124 79 91 93 79 124 92 62 92 94 104 32 92 126 42 109 92 123 91 93 124 51 42 91 93 79 92 91 79 124 91 93 124 92 60 42 81 42 54 92 124 92 38 91 93 106 42 92 64 106 42 124 57 48 92 58 86 91 93 92 63 92 45 92 125 92 63 124 92 64 68 122 52 92 44 42 55 42 100 92 93 91 93 124 91 93 114 84 42 92 92 54 114 124 109 91 93 92 36 83 92 46 121 109 124 120 57 42 111 92 43 92 93 92 62 124 92 42 91 93 124 67 42 91 93 41 69 42 124 40 81 106 116 124 103 76 101 66 90 91 93 108 108 124 91 93 99 124 115 72 42 54 91 93 111 42 41 91 93 107 92 60 92 40 42 107 107 124 108 42 91 93 108 42 41 98 42 119 91 93 92 44 92 43 92 92 92 44 124 92 58 66 91 93 81 42 57 81 42 124 92 42 105 42 109 107 91 93 124 53 91 93 112 92 35 92 58 71 112 124 92 36 91 93 57 118 84 40 55 42 90 121 92 94 67 99 92 95 42 91 93 124 92 45 108 91 93 92 44 124 48 92 61 92 38 91 93 92 38 124 55 42 40 40 92 43 56 42 104 92 93 71 42 92 93 42 53 42 88 124 109 92 125 42 84 42 86 42 91 93 81 84 42 86 42 41 119 73 92 123 91 93 82 67 92 96 42 92 123 124 91 93 79 92 37 81 52 92 47 79 124 74 42 40 91 93 124 71 42 120 92 123 103 41 91 93 114 124 79 69 42 92 33 69 42 41 91 93 67 92 41 67 124 92 58 91 93 120 120 124 91 93 124 114 105 92 91 77 92 124 92 95 91 93 92 35 92 35 124 91 93 86 124 91 93 92 59 124 92 63 104 91 93 124 97 92 93 110 42 89 42 40 91 93 124 124 115 42 87 108 54 42 55 91 93 124 111 42 92 42 42 92 63 91 93 92 46 92 60 69 42 67 92 46 124 56 91 93 92 64 92 61 56 41 92 58 91 93 65 124 103 92 44 52 92 59 73 117 42 49 124 112 91 93 85 66 92 60 42 92 91 85 41 42 121 57 124 83 42 122 92 42 91 93 107 124 118 40 32 92 37 42 117 104 92 126 109 42 92 96 91 93 111 124 92 62 79 92 47 42 92 124 103 42 41 42 92 38 51 41 114 42 124 91 93 92 46 124 92 39 87 92 34 42 91 93 92 36 40 92 92 105 103 49 91 93 122 49 124 91 93 105 42 105 42 124 91 93 92 47 92 47 124 92 91 54 42 91 93 118 119 50 104 42 54 42 124 113 42 110 92 92 91 93 92 92 124 91 93 92 35 124 86 91 93 71 42 107 42 122 87 75 42 71 42 124 92 47 106 42 40 111 116 56 124 76 42 91 93 90 42 92 34 53 76 42 124 91 93 124 91 93 124 90 42 91 93 72 124 101 92 62 92 124 48 42 91 93 57 42 124 91 93 41 68 92 43 92 96 92 35 124 92 125 52 69 114 42 100 92 35 42 91 93 92 125 42 124 97 42 91 93 124 104 42 89 92 46 122 91 93 56 42 92 91 104 56 42 41 92 36 92 34 42 124 97 117 77 42 91 93 77 42 124 91 93 124 79 91 93 92 64 92 33 79 41 115 91 93 115 124 91 93 124 92 60 91 93 92 91 92 93 92 46 50 92 60 124 111 91 93 73 73 124 86 92 33 91 93 92 94 92 42 114 79 92 33 124 122 91 93 92 33 92 37 40 90 115 124 92 36 40 48 74 73 92 60 42 92 92 42 91 93 92 62 40 72 99 88 42 52 92 46 42 124 68 91 93 48 100 48 124 92 46 79 66 107 101 76 91 93 84 84 124 92 63 86 91 93 99 84 92 124 88 86 99 41 92 92 42 124 100 41 122 91 93 56 42 102 56 42 124 80 92 94 91 93 103 54 108 42 92 125 71 42 92 94 124 89 42 112 92 96 92 41 91 93 77 86 77 124 90 91 93 73 73 124 91 93 92 44 92 44 124 91 93 51 92 60 42 92 61 42 92 92 51 124 91 93 104 92 38 97 86 42 104 124 91 93 119 124 57 91 93 67 92 60 98 92 40 66 42 67 124 92 46 92 95 91 93 117 49 117 124 92 45 92 59 121 42 92 96 92 95 91 93 92 91 92 95 124 92 37 92 42 92 44 92 125 88 92 34 91 93 124 73 91 93 73 41 122 124 53 114 42 91 93 71 109 42 108 92 38 88 114 42 124 91 93 114 124 92 96 42 92 126 103 91 93 103 124 70 92 62 78 92 96 80 81 92 46 124 114 40 92 40 104 79 120 41 68 91 93 124 79 92 39 42 91 93 92 62 75 117 92 62 124 67 42 92 47 42 99 92 41 48 42 78 91 93 78 41 114 124 91 93 124 92 64 82 92 59 40 114 75 91 93 57 42 92 59 40 82 92 94 115 91 93 92 44 124 51 49 124 91 93 124 92 39 92 37 92 126 91 93 92 35 42 69 92 126 124 56 42 91 93 66 92 46 92 61 56 42 124 91 93 124 92 46 92 61 91 93 124 91 93 124 91 93 105 92 36 78 92 58 92 94 75 105 124 92 124 91 93 124 40 48 84 101 92 60 52 82 112 92 125 41 92 92 74 91 93 74 124 91 93 41 97 75 124 77 107 91 93 92 43 42 92 94 42 76 107 124 100 85 42 92 125 54 42 76 76 92 33 124 92 44 117 52 68 79 54 42 91 93 75 124 91 93 92 39 124 92 46 48 92 64 92 124 53 106 91 93 124 100 42 119 92 41 92 47 53 98 92 34 50 91 93 124 92 62 92 59 91 93 52 52 124 92 45 92 125 82 42 88 85 91 93 117 124 113 91 93 113 124 120 57 91 93 92 35 83 73 42 92 63 92 35 124 81 92 58 92 34 77 91 93 117 42 41 80 42 91 93 80 42 124 92 62 91 93 92 123 92 42 106 92 62 124 69 91 93 114 114 124 92 60 78 92 92 92 63 91 93 121 124 90 92 37 42 91 93 121 92 46 92 37 42 124 105 92 34 42 92 38 48 91 93 124 92 42 108 81 42 124 52 42 91 93 75 42 68 49 75 42 124 92 125 85 42 91 93 85 42 124 92 125 84 92 61 42 87 92 64 55 116 42 91 93 116 42 124 91 93 92 41 124 113 92 35 75 91 93 92 44 40 100 92 61 107 83 107 92 126 81 41 101 92 37 75 41 40 90 114 91 93 40 92 35 91 93 92 60 42 97 118 92 35 124 92 124 40 86 111 98 42 74 91 93 103 42 117 74 124 56 92 126 91 93 92 44 92 44 124 92 58 91 93 92 58 124 91 93 112 92 42 77 42 88 92 125 108 42 92 35 112 124 92 92 91 93 124 91 93 124 91 93 114 57 42 112 67 86 114 124 50 91 93 92 33 42 75 67 42 81 108 42 50 124 69 57 91 93 92 64 115 77 92 64 124 92 92 124 91 93 106 124 122 42 88 92 123 42 99 91 93 124 106 91 93 40 69 55 78 92 62 88 92 45 42 53 56 124 91 93 124 86 108 91 93 89 49 42 92 44 92 35 42 108 124 92 94 49 32 108 92 58 113 91 93 113 124 65 42 91 93 87 87 124 70 52 92 124 116 100 51 91 93 51 41 42 82 40 115 42 92 47 86 73 120 42 119 91 93 92 35 119 124 91 93 92 38 72 92 96 77 42 105 114 81 92 38 124 91 93 57 103 66 57 124 91 93 83 42 114 92 124 83 42 124 107 70 91 93 70 70 124 124 79 91 93 101 82 42 97 92 92 101 124 91 93 124 91 93 124 92 96 91 93 41 40 69 55 78 92 62 88 92 45 42 53 56 124 91 93 124 86 108 91 93 89 49 42 92 44 92 35 42 108 124 92 94 49 32 108 92 58 113 91 93 113 124 65 42 91 93 87 87 124 70 52 92 124 116 100 51 91 93 51 41 42 124 73 114 92 62 91 93 53 53 53 41 68 91 93 124 73 91 93 70 86 42 71 73 124 55 71 87 118 92 64 57 91 93 124 87 105 42 84 89 91 93 92 47 89 124 82 107 92 123 42 91 93 92 93 42 92 93 42 124 114 87 42 92 39 42 54 48 91 93 86 79 86 124 55 102 91 93 105 105 124 89 91 93 92 60 89 124 92 47 57 106 83 82 120 124 92 44 113 91 93 124 105 72 91 93 124 92 62 42 54 54 91 93 82 82 124 91 93 92 43 42 99 53 82 120 42 92 43 42 124 92 62 67 91 93 124 92 60 53 92 62 81 92 91 42 92 39 42 91 93 92 39 42 41 108 42 92 61 92 124 42 40 91 93 124 118 42 65 118 91 93 92 36 100 118 124 70 92 46 91 93 53 124 113 40 83 92 34 42 91 93 78 77 85 92 34 42 124 68 42 50 92 47 92 59 42 87 91 93 124 55 42 92 61 92 62 88 124 92 123 42 91 93 114 42 92 46 42 92 44 115 40 91 93 111 74 111 124 54 107 75 92 33 42 92 64 91 93 104 124 92 62 92 91 92 59 91 93 117 52 117 124 40 92 126 84 92 96 66 92 58 42 124 91 93 85 42 124 50 92 94 42 56 92 42 67 91 93 92 36 92 36 124 76 83 105 55 42 92 126 57 42 99 91 93 115 124 103 92 95 115 42 101 42 92 126 91 93 72 72 124 91 93 124 91 93 124 91 93 90 90 124 69 42 91 93 84 40 71 91 93 87 71 124 91 93 51 124 91 93 40 56 42 92 60 91 93 124 55 107 92 44 72 91 93 124 92 125 91 93 52 42 52 42 124 91 93 92 95 97 92 95 124 91 93 70 124 81 42 103 92 92 114 91 93 118 67 76 114 124 100 91 93 76 42 104 69 102 100 124 103 105 89 92 38 91 93 107 92 38 124 70 57 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 91 93 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 124 87 91 93 83 116 42 72 92 33 92 93 53 87 124 92 60 106 124 92 95 92 62 91 93 56 70 92 62 124 91 93 124 91 93 72 42 41 40 56 42 92 60 91 93 124 55 107 92 44 72 91 93 124 92 125 91 93 52 42 52 42 124 91 93 92 95 97 92 95 124 91 93 70 124 81 42 103 92 92 114 91 93 118 67 76 114 124 100 91 93 76 42 104 69 102 100 124 103 105 89 92 38 91 93 107 92 38 124 70 57 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 91 93 40 99 112 42 91 93 57 112 42 124 91 93 124 97 42 91 93 100 92 58 42 92 47 97 42 124 92 34 42 91 93 81 42 32 92 34 42 124 112 92 124 32 124 91 93 124 121 92 95 91 93 92 94 100 88 51 111 92 95 124 91 93 41 124 87 91 93 83 116 42 72 92 33 92 93 53 87 124 92 60 106 124 92 95 92 62 91 93 56 70 92 62 124 91 93 124 91 93 72 42 41 124 109 92 124 91 93 49 48 49 124 79 91 93 79 124 92 62 92 94 104 32 92 126 42 109 92 123 91 93 124 51 42 91 93 79 92 91 79 124 91 93 124 92 60 42 81 42 54 92 124 92 38 91 93 106 42 92 64 106 42 124 57 48 92 58 86 91 93 92 63 92 45 92 125 92 63 124 92 64 68 122 52 92 44 42 55 42 100 92 93 91 93 124 91 93 114 84 42 92 92 54 114 124 109 91 93 92 36 83 92 46 121 109 124 120 57 42 111 92 43 92 93 92 62 124 92 42 91 93 124 67 42 91 93 41 69 42 124 40 81 106 116 124 103 76 101 66 90 91 93 108 108 124 91 93 99 124 115 72 42 54 91 93 111 42 41 91 93 107 92 60 92 40 42 107 107 124 108 42 91 93 108 42 41 98 42 119 91 93 92 44 92 43 92 92 92 44 124 92 58 66 91 93 81 42 57 81 42 124 92 42 105 42 109 107 91 93 124 53 91 93 112 92 35 92 58 71 112 124 92 36 91 93 57 118 84 40 55 42 90 121 92 94 67 99 92 95 42 91 93 124 92 45 108 91 93 92 44 124 48 92 61 92 38 91 93 92 38 124 55 42 40 40 92 43 56 42 104 92 93 71 42 92 93 42 53 42 88 124 109 92 125 42 84 42 86 42 91 93 81 84 42 86 42 41 119 73 92 123 91 93 82 67 92 96 42 92 123 124 91 93 79 92 37 81 52 92 47 79 124 74 42 40 91 93 124 71 42 120 92 123 103 41 91 93 114 124 79 69 42 92 33 69 42 41 91 93 67 92 41 67 124 92 58 91 93 120 120 124 91 93 124 114 105 92 91 77 92 124 92 95 91 93 92 35 92 35 124 91 93 86 124 91 93 92 59 124 92 63 104 91 93 124 97 92 93 110 42 89 42 40 91 93 124 124 115 42 87 108 54 42 55 91 93 124 111 42 92 42 42 92 63 91 93 92 46 92 60 69 42 67 92 46 124 56 91 93 92 64 92 61 56 41 92 58 91 93 65 124 103 92 44 52 92 59 73 117 42 49 124 112 91 93 85 66 92 60 42 92 91 85 41 42 121 57 124 83 42 122 92 42 91 93 107 124 118 40 32 92 37 42 117 104 92 126 109 42 92 96 91 93 111 124 92 62 79 92 47 42 92 124 103 42 41 42 92 38 51 41 114 42 124 91 93 92 46 124 92 39 87 92 34 42 91 93 92 36 40 92 92 105 103 49 91 93 122 49 124 91 93 105 42 105 42 124 91 93 92 47 92 47 124 92 91 54 42 91 93 118 119 50 104 42 54 42 124 113 42 110 92 92 91 93 92 92 124 91 93 92 35 124 86 91 93 71 42 107 42 122 87 75 42 71 42 124 92 47 106 42 40 111 116 56 124 76 42 91 93 90 42 92 34 53 76 42 124 91 93 124 91 93 124 90 42 91 93 72 124 101 92 62 92 124 48 42 91 93 57 42 124 91 93 41 68 92 43 92 96 92 35 124 92 125 52 69 114 42 100 92 35 42 91 93 92 125 42 124 97 42 91 93 124 104 42 89 92 46 122 91 93 56 42 92 91 104 56 42 41 92 36 92 34 42 124 97 117 77 42 91 93 77 42 124 91 93 124 79 91 93 92 64 92 33 79 41 115 91 93 115 124 91 93 124 92 60 91 93 92 91 92 93 92 46 50 92 60 124 111 91 93 73 73 124 86 92 33 91 93 92 94 92 42 114 79 92 33 124 122 91 93 92 33 92 37 40 90 115 124 92 36 40 48 74 73 92 60 42 92 92 42 91 93 92 62 40 72 99 88 42 52 92 46 42 124 68 91 93 48 100 48 124 92 46 79 66 107 101 76 91 93 84 84 124 92 63 86 91 93 99 84 92 124 88 86 99 41 92 92 42 124 100 41 122 91 93 56 42 102 56 42 124 80 92 94 91 93 103 54 108 42 92 125 71 42 92 94 124 89 42 112 92 96 92 41 91 93 77 86 77 124 90 91 93 73 73 124 91 93 92 44 92 44 124 91 93 51 92 60 42 92 61 42 92 92 51 124 91 93 104 92 38 97 86 42 104 124 91 93 119 124 57 91 93 67 92 60 98 92 40 66 42 67 124 92 46 92 95 91 93 117 49 117 124 92 45 92 59 121 42 92 96 92 95 91 93 92 91 92 95 124 92 37 92 42 92 44 92 125 88 92 34 91 93 124 73 91 93 73 41 122 124 53 114 42 91 93 71 109 42 108 92 38 88 114 42 124 91 93 114 124 92 96 42 92 126 103 91 93 103 124 70 92 62 78 92 96 80 81 92 46 124 114 40 92 40 104 79 120 41 68 91 93 124 79 92 39 42 91 93 92 62 75 117 92 62 124 67 42 92 47 42 99 92 41 48 42 78 91 93 78 41 114 124 91 93 124 92 64 82 92 59 40 114 75 91 93 57 42 92 59 40 82 92 94 115 91 93 92 44 124 51 49 124 91 93 124 92 39 92 37 92 126 91 93 92 35 42 69 92 126 124 56 42 91 93 66 92 46 92 61 56 42 124 91 93 124 92 46 92 61 91 93 124 91 93 124 91 93 105 92 36 78 92 58 92 94 75 105 124 92 124 91 93 124 40 48 84 101 92 60 52 82 112 92 125 41 92 92 74 91 93 74 124 91 93 41 97 75 124 77 107 91 93 92 43 42 92 94 42 76 107 124 100 85 42 92 125 54 42 76 76 92 33 124 92 44 117 52 68 79 54 42 91 93 75 124 91 93 92 39 124 92 46 48 92 64 92 124 53 106 91 93 124 100 42 119 92 41 92 47 53 98 92 34 50 91 93 124 92 62 92 59 91 93 52 52 124 92 45 92 125 82 42 88 85 91 93 117 124 113 91 93 113 124 120 57 91 93 92 35 83 73 42 92 63 92 35 124 81 92 58 92 34 77 91 93 117 42 41 80 42 91 93 80 42 124 92 62 91 93 92 123 92 42 106 92 62 124 69 91 93 114 114 124 92 60 78 92 92 92 63 91 93 121 124 90 92 37 42 91 93 121 92 46 92 37 42 124 105 92 34 42 92 38 48 91 93 124 92 42 108 81 42 124 52 42 91 93 75 42 68 49 75 42 124 92 125 85 42 91 93 85 42 124 92 125 84 92 61 42 87 92 64 55 116 42 91 93 116 42 124 91 93 92 41 124 113 92 35 75 91 93 92 44 40 100 92 61 107 83 107 92 126 81 41 101 92 37 75 41 41 92 63 116 42 92 35 91 93 77 124 91 93 124 91 93 124 48 92 45 91 93 41 42 124 114 119 42 48 115 57 42 92 124 91 93 52 52 124 48 91 93 72 55 70 72 124 68 106 32 75 102 91 93 108 124 92 38 92 62 91 93 50 80 92 62 124 70 42 51 91 93 51
14295 dup 0 ! dup >aux [ 1 | aux@ ! aux> -- >aux ] aux> drop
: _input


input
0 >aux 0 0 1
0 @ [ 0 @ ++ over - | parse-char ]
drop 0 ! drop aux> drop

round #55

submitted at
1 like

guesses
comments 0

post a comment


trax.p8.png PNG image data, 160 x 205, 8-bit/color RGBA, non-interlaced

round #53

submitted at
1 like

guesses
comments 2
jan Tusi

The program can be loaded and executed online at https://www.pico-8-edu.com/


luatic

i sure wonder who this could have been made by


post a comment


cg53.p8.png PNG image data, 160 x 205, 8-bit/color RGBA, non-interlaced

round #52

submitted at
3 likes

guesses
comments 3
jan Anto

ah it seems like these are just guidelines quite amusing considering ive only skimmed through the initial part


jan Anto replying to jan Anto

the gpt seems quite poor at comprehending my intentions


seventeen beekeepers

chat jiptee


post a comment


code.txt ASCII text, with very long lines (1480)
1
... - .- .-. - / .-- .. - .... / .- / ... .. -. --. .-.. . / .----. ----- .----. --..-- / - .... . -. / .-. . .--. . .- - / - .... . / ..-. --- .-.. .-.. --- .-- .. -. --. / ... - . .--. ... / - --- / --. . - / .- / -... .. --. --. . .-. / .- -. -.. / -... .. --. --. . .-. / .--. .-. . ..-. .. -..- / --- ..-. / - .... . / - .... ..- . -....- -- --- .-. ... . / ... . --.- ..- . -. -.-. . ---... / .---- .-.-.- / -.-. --- .--. -.-- / - .... . / .--. .-. . ..-. .. -..- / -.-- --- ..- / .... .- ...- . / .- .-.. .-. . .- -.. -.-- .-.-.- / ..--- .-.-.- / .-..-. .. -. ...- . .-. - .-..-. / - .... . / -.-. --- .--. -.-- ---... / .-. . .--. .-.. .- -.-. . / . .- -.-. .... / .----. ----- .----. / .-- .. - .... / .- / .----. .---- .----. / .- -. -.. / . .- -.-. .... / .----. .---- .----. / .-- .. - .... / .- / .----. ----- .----. .-.-.- / ...-- .-.-.- / .- .--. .--. . -. -.. / - .... . / .. -. ...- . .-. - . -.. / -.-. --- .--. -.-- / - --- / - .... . / --- .-. .. --. .. -. .- .-.. / .--. .-. . ..-. .. -..- .-.-.- / - .... .. ... / .. ... / -.-- --- ..- .-. / -. . .-- --..-- / .-.. --- -. --. . .-. / .--. .-. . ..-. .. -..- .-.-.- / - .... .- - .----. ... / .. - -.-.-- / -.-- --- ..- / -.-. .- -. / -.- . . .--. / .-. . .--. . .- - .. -. --. / - .... . ... . / ... - . .--. ... / ..- -. - .. .-.. / -.-- --- ..- / .... .- ...- . / .- ... / -- .- -. -.-- / . .-.. . -- . -. - ... / --- ..-. / - .... . / ... . --.- ..- . -. -.-. . / .- ... / -.-- --- ..- / -. . . -.. .-.-.-

round #50

submitted at
0 likes

guesses
comments 1
taswelll

works for all ⎕io entry←⊃((125⊥,)/⎕AV⍳⊢)⌽⊣


post a comment


entry.apl Unicode text, UTF-8 text
1
2
3
⍝ Takes corpus on the left and text_so_far on the right.
⍝ Produces the next expected character.
entry(⊣⊃1+(⍴⊣)|((⊢+125×⊣)/⎕AV⍳⊢))

round #49

submitted at
2 likes

guesses
comments 2
ten bees

there are a nonnegative amount of characters in this entry i must say


olus2000 *known at the time as [author of #4]

I certainly exerted some form of effort into it.


post a comment


dir minor-L
dir src
Interpretter.elm ASCII text
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
module Interpretter exposing (..)


import LispParser as LP exposing (AST, Statement)
import Dict exposing (Dict)
import Result


type Value
  = Symbol String
  | Integer Int
  | Quoted Value
  | Cons Value Value
  | Fun Function
  | Null


type alias Environment = Dict String Value


type Function
  = Builtin (Environment -> Value -> Result String Value)
  | Closure Environment Skeleton Value


type alias InterpreterState =
  { defs : Environment
  , macros : Environment
  , result : List (Result String Value)
  }


type Skeleton
  = ConsPattern Skeleton Skeleton
  | Capture String
  | Wildcard


interpret : InterpreterState -> List Statement -> InterpreterState
interpret state stmts = case stmts of
  [] -> state
  LP.MacroDef name ast :: rest ->
    case resolve state.macros ast |> Result.andThen (eval state.defs) of
      Err s ->
        { state
        | result =
          Err ("Error in macro definition " ++ name ++ ":\n" ++ s) ::
          state.result
        }
      Ok expr -> interpret
        { state | macros = Dict.insert name expr state.macros }
        rest
  LP.FunctionDef name ast :: rest ->
    case resolve state.macros ast |> Result.andThen (eval state.defs) of
      Err s ->
        { state
        | result =
          Err ("Error in function definition " ++ name ++ ":\n" ++ s) ::
          state.result
        }
      Ok expr -> interpret
        { state | defs = Dict.insert name expr state.defs }
        rest
  LP.RawExpression ast :: rest -> interpret
    { state
    | result = (resolve state.macros ast
                |> Result.andThen (eval state.defs)) :: state.result
    }
    rest


resolve : Environment -> AST -> Result String Value
resolve macros ast = case ast of
  LP.Variable s -> Ok (Symbol s)
  LP.Integer n -> Ok (Integer n)
  LP.Quoted q -> resolve macros q |> Result.map Quoted
  LP.ConsList (LP.Variable name :: rest) -> case resolveList macros rest of
    Ok args -> case Dict.get name macros of
      Nothing -> Ok (Cons (Symbol name) args)
      Just macro -> call Dict.empty macro args
    Err s -> Err s
  LP.ConsList rest -> resolveList macros rest


resolveList : Environment -> List AST -> Result String Value
resolveList macros l = case l of
  head :: rest -> case resolve macros head of
    Err s -> Err s
    Ok headValue -> case resolveList macros rest of
      Err s -> Err s
      Ok restValue -> Ok (Cons headValue restValue)
  [] -> Ok Null


eval : Environment -> Value -> Result String Value
eval defs val = case val of
  Symbol s -> case Dict.get s defs of
    Just v -> Ok v
    Nothing -> Err ("Unknown symbol: " ++ s)
  Quoted expr -> Ok expr
  Cons carExpr cdrExpr -> case eval defs carExpr of
    Err s -> Err s
    Ok car -> case calllessEval defs cdrExpr of
      Err s -> Err s
      Ok cdr -> call defs car cdr
  _ -> Ok val


calllessEval : Environment -> Value -> Result String Value
calllessEval defs val = case val of
  Cons carExpr cdrExpr -> case eval defs carExpr of
    Err s -> Err s
    Ok car -> case calllessEval defs cdrExpr of
      Err s -> Err s
      Ok cdr -> Ok (Cons car cdr)
  _ -> eval defs val


call : Environment -> Value -> Value -> Result String Value
call defs fun args = case fun of
  Fun func -> case func of
    Builtin f -> f defs args
    Closure env params body -> case assign env params args of
      Just x -> eval x body
      Nothing ->
        Err ("Bad argument shape! Expected:\n" ++ skeletonToString params
             ++ "\nGot:\n" ++ valueToString body ++ "\n")
  _ -> Err ("Attempt to call a value that is not callable:\n"
            ++ valueToString fun)


assign : Environment -> Skeleton -> Value -> Maybe Environment
assign env pattern args = case pattern of
  Wildcard -> Just env
  Capture s -> Just (Dict.insert s args env)
  ConsPattern carPattern cdrPattern ->
    case args of
      Cons car cdr -> assign env carPattern car
        |> Maybe.andThen (\x -> assign x cdrPattern cdr)
      _ -> Nothing


skeletonToString : Skeleton -> String
skeletonToString s =
  case toConsListPattern s of
    Just l -> "(" ++ consListPatternToString l ++ ")"
    Nothing -> case s of
      Wildcard -> "()"
      Capture name -> name
      ConsPattern car cdr ->
        "(. " ++ skeletonToString car ++ " " ++ skeletonToString cdr ++ ")"


toConsListPattern : Skeleton -> Maybe (List Skeleton)
toConsListPattern s = case s of
  Wildcard -> Just []
  ConsPattern car cdr -> case toConsListPattern cdr of
    Nothing -> Nothing
    Just cdrList -> Just (car :: cdrList)
  _ -> Nothing


consListPatternToString : List Skeleton -> String
consListPatternToString l = case l of
  head :: [] -> skeletonToString head
  head :: rest -> skeletonToString head ++ " " ++ consListPatternToString rest
  [] -> ""



valueToString : Value -> String
valueToString v =
  case toConsList v of
    Just l ->  "(" ++ consListToString l ++ ")"
    Nothing -> case v of
      Null -> "()"
      Symbol s -> s
      Cons car cdr ->
        "(. " ++ valueToString car ++ " " ++ valueToString cdr ++ ")"
      Quoted e -> "'" ++ valueToString e
      Integer n -> String.fromInt n
      Fun (Builtin _) -> "~builtin~"
      Fun (Closure _ params _) ->
        "(~closure~ " ++ skeletonToString params ++ ")"


toConsList : Value -> Maybe (List Value)
toConsList s = case s of
  Null -> Just []
  Cons car cdr -> case toConsList cdr of
    Nothing -> Nothing
    Just cdrList -> Just (car :: cdrList)
  _ -> Nothing


consListToString : List Value -> String
consListToString l = case l of
  head :: [] -> valueToString head
  head :: rest -> valueToString head ++ " " ++ consListToString rest
  [] -> ""
Lexer.elm ASCII text
 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
79
module Lexer exposing (..)


import Parser exposing (Parser, (|.), (|=), symbol, succeed, oneOf, variable,
                        sequence, spaces, int, backtrackable)
import Set



-- Tokens:
-- OpenParen    := '('
-- CloseParen   := ')'
-- Quote        := '\''
-- Number       := [ '-' ] ( NonZeroDigit { Digit } | '0' )
-- Identifier   := IdChar { IdChar }
-- Digit        := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
-- NonZeroDigit := Digit \ '0'
-- IdChar       := Any \ Digit \ ')' \ '(' \ '\'' \ Whitespace
-- Whitespace   := '\n' | '\r' | ' '



type Token
  = OpenParen
  | CloseParen
  | Quote
  | Number Int
  | Identifier String


lexer : Parser (List Token)
lexer = sequence
  { start = ""
  , separator = ""
  , end = ""
  , spaces = spaces
  , item = lexToken
  , trailing = Parser.Optional
  } 


lexToken : Parser Token
lexToken = oneOf
  [ succeed OpenParen
    |. symbol "("
  , succeed CloseParen
    |. symbol ")" 
  , succeed Quote
    |. symbol "'" 
  , succeed Number
    |= backtrackable myInt
  , succeed Identifier
    |= myIdentifier
  ]


myIdentifier : Parser String
myIdentifier = variable
  { start = isIdentifierChar
  , inner = isIdentifierChar
  , reserved = Set.empty
  }


isIdentifierChar : Char -> Bool
isIdentifierChar c =
  String.contains (String.fromChar c) "0123456789()' \n\r" |> not
  -- Fuck tabs
  -- ~ John Elm, circa 20.19


myInt : Parser Int
myInt =
  oneOf
    [ succeed negate
        |. symbol "-"
        |= int
    , int
    ]
LispParser.elm ASCII text
 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
module LispParser exposing (..)


import Lexer as L exposing (Token)


-- Syntax:
-- Program    := { Statement }
-- Statement  := MacroDef | FunDef | Expression
-- MacroDef   := 'macro:' Identifier Expression
-- FunDef     := 'fun:' Identifier Expression
-- Expression := Identifier | Number | '\'' Expression | ConsExpr
-- ConsExpr   := '(' { Expression } ')'


type AST
  = Variable String
  | Integer Int
  | Quoted AST
  | ConsList (List AST)


type Statement
  = MacroDef String AST
  | FunctionDef String AST
  | RawExpression AST


parse : List Token -> Result String (List Statement)
parse t = case t of
  [] -> Ok []
  L.Identifier "macro:" :: L.Identifier name :: tokens ->
    case parseExpr tokens of
      Ok (macro, ts) -> case parse ts of
        Ok stmts -> MacroDef name macro :: stmts |> Ok
        Err s -> Err s
      Err s -> Err s
  L.Identifier "fun:" :: L.Identifier name :: tokens ->
    case parseExpr tokens of
      Ok (function, ts) -> case parse ts of
        Ok stmts -> FunctionDef name function :: stmts |> Ok
        Err s -> Err s
      Err s -> Err s
  _ ->
    case parseExpr t of
      Ok (expr, ts) -> case parse ts of
        Ok stmts -> RawExpression expr :: stmts |> Ok
        Err s -> Err s
      Err s -> Err s


parseExpr : List Token -> Result String (AST, List Token)
parseExpr t = case t of
  L.Number x :: ts -> Ok (Integer x, ts)
  L.Identifier s :: ts -> Ok (Variable s, ts)
  L.Quote :: ts -> case parseExpr ts of
    Ok (expr, tokens) -> Ok (Quoted expr, tokens)
    Err s -> Err s
  L.OpenParen :: ts -> case consBuilder ts of
    Ok (asts, tokens) -> Ok (ConsList asts, tokens)
    Err s -> Err s
  L.CloseParen :: ts -> Err "Unexpected ')' encountered!"
  [] -> Err "Unxpected end of text!"


consBuilder : List Token -> Result String (List AST, List Token)
consBuilder t = case t of
  L.CloseParen :: ts -> Ok ([], ts)
  [] -> Err "Unclosed '('!"
  _ -> case parseExpr t of
    Err s -> Err s
    Ok (expr, ts) -> case consBuilder ts of
      Err s -> Err s
      Ok (asts, tokens) -> Ok (expr :: asts, tokens)
Main.elm ASCII text
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
module Main exposing (..)


import Interpretter as I exposing (InterpreterState, Environment, interpret)
import Lexer exposing (lexer)
import Parser as P exposing (DeadEnd, run)
import LispParser exposing (parse)
import Dict
import Std as S exposing (stdDefs, stdMacros)
import File
import File.Select as Select
import Browser
import Browser.Events exposing (onKeyDown)
import Html exposing (Html, text, div, br, button, form, textarea, input)
import Html.Events exposing (onClick, onInput)
import Html.Attributes exposing (value, type_)
import Task exposing (perform)
import Json.Decode as Json exposing (field, string, bool)


-- Main

main = Browser.element
  { init = init
  , update = update
  , view = view
  , subscriptions = always sub
  }


init : () -> ( Model, Cmd Msg )
init _ =
  ( { defs = stdDefs
    , macros = stdMacros
    , results = []
    , input = ""
    }, Cmd.none )


-- Model

type alias Model =
  { defs : Environment
  , macros : Environment
  , results : List String
  , input : String
  }


-- Controller

type Msg
  = Run String Bool
  | UpdateInput String
  | Import
  | ReadFile File.File
  | LoadFile String String



update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
  let
      resultToString r = case r of
        Ok v -> I.valueToString v
        Err s -> s
  in case msg of
    Run code control ->
      if not control || code /= "Enter" then ( model, Cmd.none ) else
        case executor
          { defs = model.defs
          , macros = model.macros
          , result = []
          } model.input of
            Err s ->
              ( { model
                | results = ("> " ++ model.input)
                  :: s
                  :: model.results
                }, Cmd.none )
            Ok state ->
              ( { model
                | defs = state.defs
                , macros = state.macros
                , results = ("> " ++ model.input) ::
                            (List.map resultToString state.result
                             ++ model.results)
                , input = ""
                }, Cmd.none )
    UpdateInput s -> ( { model | input = s }, Cmd.none )
    Import -> ( model, Select.file ["text/*"] ReadFile )
    ReadFile f -> (model, File.toString f |> perform (File.name f |> LoadFile))
    LoadFile name source -> case executor
      { defs = model.defs
      , macros = model.macros
      , result = []
      } source of
        Err s ->
          ( { model
            | results = ("> Importing " ++ name)
              :: s
              :: model.results
            }, Cmd.none )
        Ok state ->
          ( { model
            | defs = state.defs
            , macros = state.macros
            , results = ("> Importing " ++ name)
                        :: (List.map resultToString state.result
                            ++ model.results)
            }, Cmd.none )


-- Subscriptions

sub : Sub Msg
sub = onKeyDown ( Json.map2 Run (field "key" string) (field "ctrlKey" bool) )

-- Code execution

executor : InterpreterState -> String -> Result String InterpreterState
executor state source =
  run lexer source |> Result.mapError deadEndsToString
  |> Result.andThen parse |> Result.map (interpret state)


deadEndsToString : List DeadEnd -> String
deadEndsToString = List.map (\end ->
  "Lexing error on line " ++ String.fromInt end.row
  ++ " column " ++ String.fromInt end.col ++ ":\n" ++
  ( case end.problem of
    P.Expecting s -> "Expected " ++ s ++ ". This should not happen."
    P.ExpectingInt -> "Expected an integer."
    P.ExpectingHex -> "Expected a hex number. This should not happen."
    P.ExpectingOctal -> "Expected an octal number. This should not happen."
    P.ExpectingBinary -> "Expected a binary number. This should not happen."
    P.ExpectingFloat ->
      "Expected a floating point number. This should not happen."
    P.ExpectingNumber -> "Expected a number. This should not happen."
    P.ExpectingVariable -> "Expected an identifier."
    P.ExpectingSymbol s -> "Expected '" ++ s ++ "'."
    P.ExpectingKeyword s -> "Expected '" ++ s ++ "'. This should not happen."
    P.ExpectingEnd -> "Expected end of text. This should not happen."
    P.UnexpectedChar -> "Unexpected character. This should not happen."
    P.Problem s -> "Problem: " ++ s ++ ". This should not happen."
    P.BadRepeat -> "Bad repeat! This should not happen." ) )
  >> String.join "\n\n"


-- View

view : Model -> Html Msg
view model =
  div []
  [ text "Ctrl+Enter to submit. Not styled. "
  , text "For help read the file attached with the source.", br [] []
  , button [ onClick Import ] [ text "Import file" ], br [] []
  , textarea [ value model.input, onInput UpdateInput ] []
  , div [] (List.map (text) model.results |> List.intersperse (br [] []))
  ]
Std.elm ASCII text
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
module Std exposing (..)


import Interpretter as I exposing (Function, Environment, Value, Skeleton)
import Dict


add : Environment -> Value -> Result String Value
add e a =
  let
      adder args = case args of
        I.Cons (I.Integer n) b -> adder b |> Result.map ((+) n)
        I.Null -> Ok 0
        _ -> Err ("'+' expected a list of integers, got "
                  ++ I.valueToString args)
  in adder a |> Result.map I.Integer


sub : Environment -> Value -> Result String Value
sub e args = case args of
  I.Cons (I.Integer a) (I.Cons (I.Integer b) _) -> Ok (I.Integer (a - b))
  I.Cons (I.Integer a) (I.Integer b) -> Ok (I.Integer (a - b))
  I.Cons (I.Integer a) I.Null -> Ok (I.Integer (-a))
  I.Integer a -> Ok (I.Integer (-a))
  _ -> Err ("'-' expected one or two integers, got "
            ++ I.valueToString args)


mul : Environment -> Value -> Result String Value
mul e a =
  let
      muler args = case args of
        I.Cons (I.Integer n) b -> muler b |> Result.map ((*) n)
        I.Null -> Ok 1
        _ -> Err ("'*' expected a list of integers, got "
                  ++ I.valueToString args)
  in muler a |> Result.map I.Integer


div : Environment -> Value -> Result String Value
div e args = case args of
  I.Cons (I.Integer a) (I.Cons (I.Integer b) _) -> Ok (I.Integer (a // b))
  I.Cons (I.Integer a) (I.Integer b) -> Ok (I.Integer (a // b))
  _ -> Err ("'/' expected two integers, got "
            ++ I.valueToString args)


mod : Environment -> Value -> Result String Value
mod e args = case args of
  I.Cons (I.Integer a) (I.Cons (I.Integer b) _) -> Ok (I.Integer (modBy b a))
  I.Cons (I.Integer a) (I.Integer b) -> Ok (I.Integer (modBy b a))
  _ -> Err ("'%' expected two integers, got "
            ++ I.valueToString args)


gt : Environment -> Value -> Result String Value
gt e args = case args of
  I.Cons (I.Integer a) (I.Cons (I.Integer b) _) ->
    if a > b then Ok (I.Integer a)
    else Ok I.Null
  I.Cons (I.Integer a) (I.Integer b) ->
    if a > b then Ok (I.Integer a)
    else Ok I.Null
  _ -> Err ("'>' expected two integers, got "
            ++ I.valueToString args)


eq : Environment -> Value -> Result String Value
eq e args = case args of
  I.Cons a (I.Cons b _) ->
    if a == b then Ok a
    else Ok I.Null
  _ -> Err ("'=' expected two arguments, got "
            ++ I.valueToString args)


lambda : Environment -> Value -> Result String Value
lambda env args =
  let
      skeletonize params = case params of
        I.Null -> Ok I.Wildcard
        I.Symbol s -> Ok (I.Capture s)
        I.Cons car cdr -> case skeletonize car of
          Err s -> Err s
          Ok carPattern -> case skeletonize cdr of
            Err s -> Err s
            Ok cdrPattern -> Ok (I.ConsPattern carPattern cdrPattern)
        _ -> Err ("Argument patterns must consist of symbols, conses and Nulls,"
                  ++ " instead got " ++ I.valueToString params)
  in case args of
    I.Cons params (I.Cons body _) ->
      skeletonize params
      |> Result.map (\x -> I.Fun (I.Closure env x body))
    _ -> Err ("lambda requires an argument pattern and body, instead got"
              ++ I.valueToString args)


cons : Environment -> Value -> Result String Value
cons env args = case args of
  I.Cons a (I.Cons b _) -> Ok (I.Cons a b)
  _ -> Err ("'cons' expected two arguments, got "
            ++ I.valueToString args)


carOp : Environment -> Value -> Result String Value
carOp env args = case args of
  I.Cons (I.Cons x _) _ -> Ok x
  _ -> Err ("'car' expected a cons cell, got "
            ++ I.valueToString args)


cdrOp : Environment -> Value -> Result String Value
cdrOp env args = case args of
  I.Cons (I.Cons _ x) _ -> Ok x
  _ -> Err ("'cdr' expected a cons cell, got "
            ++ I.valueToString args)


quote : Environment -> Value -> Result String Value
quote env args = case args of
  I.Cons x _ -> Ok (I.Quoted x)
  _ -> Err ("'quote' expected an argument, got "
            ++ I.valueToString args)


eval : Environment -> Value -> Result String Value
eval env args = case args of
  I.Cons x _ -> I.eval env x
  _ -> Err ("'eval' expected an argument, got "
            ++ I.valueToString args)


apply : Environment -> Value -> Result String Value
apply env args = case args of
  I.Cons fun params -> I.call env fun params
  _ -> Err ("'apply' expected arguments, got "
            ++ I.valueToString args)


ifNull : Environment -> Value -> Result String Value
ifNull env args = case args of
  I.Cons cond (I.Cons ifTrue (I.Cons ifFalse _)) ->
    if cond == I.Null then I.eval env ifTrue
    else I.eval env ifFalse
  _ -> Err ("'if-null' expected three, got "
            ++ I.valueToString args)


ifInteger : Environment -> Value -> Result String Value
ifInteger env args = case args of
  I.Cons cond (I.Cons ifTrue (I.Cons ifFalse _)) -> case cond of
    I.Integer _ -> I.eval env ifTrue
    _ -> I.eval env ifFalse
  _ -> Err ("'if-integer' expected three, got "
            ++ I.valueToString args)


ifSymbol : Environment -> Value -> Result String Value
ifSymbol env args = case args of
  I.Cons cond (I.Cons ifTrue (I.Cons ifFalse _)) -> case cond of
    I.Symbol _ -> I.eval env ifTrue
    _ -> I.eval env ifFalse
  _ -> Err ("'if-symbol' expected three, got "
            ++ I.valueToString args)


ifQuoted : Environment -> Value -> Result String Value
ifQuoted env args = case args of
  I.Cons cond (I.Cons ifTrue (I.Cons ifFalse _)) -> case cond of
    I.Quoted _ -> I.eval env ifTrue
    _ -> I.eval env ifFalse
  _ -> Err ("'if-quoted' expected three, got "
            ++ I.valueToString args)


ifCons : Environment -> Value -> Result String Value
ifCons env args = case args of
  I.Cons cond (I.Cons ifTrue (I.Cons ifFalse _)) -> case cond of
    I.Cons _ _ -> I.eval env ifTrue
    _ -> I.eval env ifFalse
  _ -> Err ("'if-cons' expected three, got "
            ++ I.valueToString args)


ifFun : Environment -> Value -> Result String Value
ifFun env args = case args of
  I.Cons cond (I.Cons ifTrue (I.Cons ifFalse _)) -> case cond of
    I.Fun _ -> I.eval env ifTrue
    _ -> I.eval env ifFalse
  _ -> Err ("'if-function' expected three, got "
            ++ I.valueToString args)


stdDefs : Environment
stdDefs = Dict.fromList
  [ ("+", I.Fun (I.Builtin add))
  , ("-", I.Fun (I.Builtin sub))
  , ("*", I.Fun (I.Builtin mul))
  , ("/", I.Fun (I.Builtin div))
  , ("%", I.Fun (I.Builtin mod))
  , (">", I.Fun (I.Builtin gt))
  , ("=", I.Fun (I.Builtin eq))
  , (".", I.Fun (I.Builtin cons))
  , ("car", I.Fun (I.Builtin carOp))
  , ("cdr", I.Fun (I.Builtin cdrOp))
  , ("quote", I.Fun (I.Builtin quote))
  , ("lambda", I.Fun (I.Builtin lambda))
  , ("eval", I.Fun (I.Builtin eval))
  , ("apply", I.Fun (I.Builtin apply))
  , ("if-symbol", I.Fun (I.Builtin ifSymbol))
  , ("if-integer", I.Fun (I.Builtin ifInteger))
  , ("if-quote", I.Fun (I.Builtin ifQuoted))
  , ("if-cons", I.Fun (I.Builtin ifCons))
  , ("if-function", I.Fun (I.Builtin ifFun))
  , ("if-null", I.Fun (I.Builtin ifNull))
  ]


stdMacros : Environment
stdMacros = Dict.empty
README.rst ASCII text
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
================================================================================
                                    Minor-L
================================================================================

Minor-L is a minimalist Lisp system made for `code guessing round 49`_. It
consists of several Elm source files that can be imported to use the language in
Elm, as well as the ``Main.elm`` file that joins them together and presents as a
crude web application.

.. _code guessing round 49: https://cg.esolangs.gay/49/


Web interface
=============

Minor-L comes with a crude web interface for running the code and evaluating
expressions. It consists of three sections:


Import button
-------------

This button lets you import source code from a text file on your computer. It
will run all the statements in the file as if they were entered from the text
box and print any errors or values of raw expressions to the feed. Any
definitions included in the file will enter the environment.


Textbox
-------

You can input code to be run here. It can contain any amount of statements, and
will be run when you press ``Ctrl`` + ``Enter`` (tested on Firefox). The code
will be executed up to the first error in definition, and any errors and values
of raw expressions will be reported in the feed.


Feed
----

Output of the executed code will be printed below the textbox. It will include
parsing and lexing errors, values of raw expressions, errors from raw
expressions, and errors from the first erroneous definition in a batch.


Language overview
=================

Minor-L, like most Lisps, has very simple syntax which translates in a
straightforward way to semantics.


Lexemes
-------

There are three kinds of lexemes in Minor-L: symbols, numbers and identifiers.
Whitespace is required only between two numbers or two identifiers to mark the
boundary.

* **Symbols** are single characters among ``'()``. They are used for literal
quoting and cons lists.

* **Numbers** consist of decimal digits, possibly prefixed by a ``-`` sign. They
indicate literal integers.

* **Identifiers** consist of any character that is not a symbol, digit or
whitespace. This means that care must be taken where an identifier is next to a
negative number: a whitespace may be necessary to disambiguate the parsing.


Expressions
-----------

Expressions in Minor-L follow a simple crammar::

  expression  := quoted | cons-list | literal
  quoted      := "'" expression
  cons-list   := "(" { expression } ")"
  literal     := number | identifier

Number and identifier tokens indicate literal integers and symbols.
Parenthesized lists indicate cons-lists of their contents, whith the special
case of empty list meaning the ``Null`` value. Quoted expressions are just that:
quoted expressions.

Minor-L expressions are pure functions of the environment: they don't interact
with anything outside the environment and don't change it. Order of evaluation
inside an expression doesn't matter, but keep in mind that it's eager so beware
of accidental infinite loops.


Program
-------

A program is a series of statemets. These can take one of three forms:

* **Macro definitions** start with the symbol ``macro:`` followed by another
  symbol and an expression. The symbol is then defined as a macro with the body
  being the value of the expression.

* **Function definitions** start with the symbol ``fun:`` followed by another
  symbol and an expression. The symbol is then defined as a function (actually
  any value) with the body being the value of the expression.

* **Raw expressions** are just expressions. They are evaluated and their values
  are reported, but they have no consequence to further evaluation.

All statements are processed in order, and definitions build up the environment
available for further code. Therefore direct recursion is not supported, and
order of evaluation of statements matters.


Evaluation
----------

Minor-L is a homoiconic language, which means that its code can be represented
as data, and any data can be treated as code (which will usually result in an
error). This is what executing each data type does:

* **Integers, Functions and Null** will just return themselves when executed.

* **Quoted expressions** will remove one layer of quoting and return the
  expression.

* **Symbols** will look up a value corresponding to them in the environment and
  return that. It's an error to evaluate an undefined symbol.

* **Cons cells** will evaluate each ``car`` in the list and then apply the first
  element to the rest.

Each main expression in every statement is evaluated once.


Application
-----------

Functions can be applied to arguments. If the function is one one of the
builtins it will do something specific to it. If instead it is a closure defined
in code it will match the argument list to the structure of its argument
pattern, capture values that correspond to symbols in the pattern and evaluate
its body in the environment it closed over extended by the newly captured
values.


Glossary
========

Functions in Minor-L come in two kinds. Builtins are defined in Elm source code,
are more powerful, and have access to the caller's environment. Closures can be
defined in Minor-L code and they close over the environment at the point of
their definition.


Builtins
--------

This is the list of builtin functions in Minor-L. They are defined in the
``Std.elm`` file.

``lambda`` : (*pattern* *body*)
  Captures the environment and returns a new closure with some argument
  *pattern* and some *body*. These values should usually be quoted.

``eval`` : (*expression*)
  Evaluates *expression*.

``apply`` : (*function* *arguments*)
  Applies *function* to *arguments*. Can be useful when the function requires
  unusual shape of arguments.

``.`` : (*car* *cdr*)
  Constructs a cons cell with some *car* and some *cdr*.

``car`` : (*cons*)
  Gets the car of a cons cell.

``cdr`` : (*cons*)
  Gets the cdr of a cons cell.

``quote`` : (*value*)
  Returns the value quoted.

``+`` : (*n...*)
  Returns the sum of its arguments. Errors if they are not all integers.

``-`` : (*n*) | (*a* *b*)
  Returns *n* negated or *b* subtracted from *a*.

``*`` : (*n...*)
  Returns the product of its arguments. Errors if they are not all integers.

``/`` : (*a* *b*)
  Returns *a* divided by *b*.

``%`` : (*a* *b*)
  Returns a value congruent to *a* modulo *b*.

``>`` : (*a* *b*)
  Returns *a* if *a* is greater than *b*, otherwise ``Null``.

``=`` : (*a* *b*)
  Returns *a* if *a* is the same as *b*, otherwise ``Null``.

``if-symbol`` : (*value* *if-yes* *if-no*)
  If *value* is a symbol evaluate *if-yes*, otherwise evaluate *if-no*. The
  latter two should usually be quoted expressions.

  Variants for other types: ``if-integer``, ``if-quote``, ``if-cons``,
  ``if-function`` and ``if-null`` work in a similar way.


Closures
--------

The language itself doesn't provide any more functions than the builtins, but
there's a ``core.mil`` file provided with some convenient functions and macros.

``id`` : (*x*)
  Returns *x*.

``dup`` : (*x*)
  Returns (*x* *x*).

``factorial`` : (*n*)
  Calculates the factorial of *n*.

``map`` : (*f* *list*)
  Applies function *f* to each element of *list*.

``foldl`` : (*f*:(*acc* *next*) *id* *list*)
  Folds the *list* from the left using *f*, providing the running result as
  *acc* and subsequent elements of *list* as *next*, with the initial running
  result *id*.

``foldr`` : (*f*:(*prev* *acc*) *id* *list*)
  Folds the *list* from the right using *f*, providing the running result as
  *acc* and subsequent elements of *list* as *next*, with the initial running
  result *id*.

``reverse`` : (*list*)
  Reverses the list.

``last`` : (*list*)
  Returns the last element of a non-empty list. Linear in terms of list length.

``but-last`` : (*list*)
  Cuts off the last element of the list. Linear in terms of list lenght.

``and`` : (*x...*)
  Returns ``0`` if none of the arguments are ``Null``, or ``Null`` if any are.

``or`` : (*x...*)
  Returns the last argument that is not ``Null``, or ``Null`` if there are none.

``traverse-tree`` : (*mapper* *reducer* *tree*)
  Traverses the cons *tree* running *mapper* on each leaf and *reducer* on each
  pair of branches.

``map-tree`` : (*mapper* *tree*)
  Runs *mapper* on each leaf of the *tree*. A special case of ``traverse-tree``
  with *reducer* equal to ``.``.

``reduce-tree`` : (*reducer* *tree*)
  Runs *reducer* on each pair of branches of *tree*. A special case of
  ``traverse-tree`` with *mapper* equal to ``id``.


Macros
------

The language itself doesn't provide any macros, but there's a ``core.mil`` file
provided with some convenient functions and macros.

``def`` : (*args* *body*)
  Quotes *args* and *body* and passes them to ``lambda``.

``def*`` : (*args* *body*)
  Like ``def`` but rearranges *args* such that the last argument captures all
  additional arguments.

``rec`` : (*self* *args* *body*)
  Defines a recursive function taking *args* and with *body* that uses *self*
  symbol for recursive calls.

``if`` : (*cond* *if-true* *if-false*)
  Rearranges branches and quotes them such that if *cond* evaluates to ``Null``
  then *if-false* is executed, and *if-true* is executed otherwise.

``let`` : ((*symbol* *value*)... *body*)
  Makes *body* evaluate in an environment where each given *value* is bound to
  its corresponding *symbol*. These bindings are also used in evaluating *value*
  expressions. *body* shouldn't be quoted.
core.mil ASCII text
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
macro: def
(lambda '(args body)
        '(. lambda (. (quote args) (. (quote body) ()))))


fun: id (def (x) x)


macro: if
(def (cond if-false if-true)
     (. if-null (. cond (. (quote if-true) (. (quote if-false) ())))))


fun: dup (def (x) (. x (. x ())))


macro: rec
(def (self args body)
   (. (. lambda (. ''(_rec)
      (. (quote (dup (. lambda (. ''(__rec)
        (. (quote (. '_rec (. (. lambda (. (quote args) (. (quote (. '(__rec __rec) args)) ())))
        ()))) ()))))) ())))
      (. (. lambda (. (quote (. self ())) (. (quote (. lambda (. (quote args) (.
      (quote body) ())))) ()))) ())))


fun: factorial
(rec factorial (x)
  (if (> x 1)
    (* x (factorial (- x 1)))
    1))


fun: map
(rec map (f list)
  (if-cons list
    '(. (f (car list)) (map f (cdr list)))
    '()))

fun: foldl
(rec foldl (f id list)
  (if-cons list
    '(foldl f (f id (car list)) (cdr list))
    'id))

fun: foldr
(rec foldr (f id list)
  (if-cons list
    '(f (car list) (foldr f id (cdr list)))
    'id))


fun: reverse (def (list) (foldl (def (l x) (. x l)) () list))

fun: last (def (list) (car (reverse list)))

fun: but-last (def (list) (reverse (cdr (reverse list))))


fun: traverse-tree
(rec traverse-tree (mapper reducer tree)
  (if-cons tree
    '(reducer
      (traverse-tree mapper reducer (car tree))
      (traverse-tree mapper reducer (cdr tree)))
    '(mapper tree)))

fun: map-tree (def (mapper tree) (traverse-tree mapper . tree))

fun: reduce-tree (def (reducer tree) (traverse-tree id reducer tree))


macro: def*
(def (args body)
  (. lambda
    (. (quote (foldr . (last args) (but-last args)))
      (. (quote body) ()))))


macro: let
(def args
  (foldr
    (def ((sym val) body)
      (. (. lambda (. (quote (. sym ())) (. (quote body) ())))
        (. val ())))
    (last args)
    (but-last args)))


fun: and
(def args
  (foldl
    (def (prev next) (if next prev next))
    0 args))

fun: or
(def args
  (foldl
    (def (prev next) (if next next prev))
    () args))
elm.json JSON text data
 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
{
    "type": "application",
    "source-directories": [
        "src"
    ],
    "elm-version": "0.19.1",
    "dependencies": {
        "direct": {
            "elm/browser": "1.0.2",
            "elm/core": "1.0.5",
            "elm/file": "1.0.5",
            "elm/html": "1.0.0",
            "elm/json": "1.1.3",
            "elm/parser": "1.1.0"
        },
        "indirect": {
            "elm/bytes": "1.0.8",
            "elm/time": "1.0.0",
            "elm/url": "1.0.0",
            "elm/virtual-dom": "1.0.3"
        }
    },
    "test-dependencies": {
        "direct": {},
        "indirect": {}
    }
}
index.html ASCII text

round #47

submitted at
1 like

guesses
comments 0

post a comment


entry.tfl ASCII text
1
2
3
4
5
DZ|SD|E|CDD
r3_iEi|fiChtrf(fhi)t
l2_ZE|Z_Z|SxSylxy|_EE|E_Z|C_xC_ylxy
m2yx[1Zy|Ex](lxy)
^1xrCE(rmE(r[2naC(Cn(rmE(r[2Chta[1ZC(Cht)a|Ea](lhn)|aECEa]Ea)))a]Ex))

round #46

submitted at
1 like

guesses
comments 0

post a comment


main.ua Unicode text, UTF-8 text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# uiua version 0.0.22
# Function set modeled as a rank-2 array of scalars
Ded ← =⊡1△∶≡'⧻⊝.
Nxt ← ▽≡(/×/<⬚'¯∞↙2)./⊂⊠⊂⇡
Entry ← |1 ⊙';;⍥(⎋=0⧻.Nxt∶⊙,(;|⎋1⊏⊚)/↥.Ded⊠⊏,,)∞[[]]∶⬚0⊡1△.

△.Entry ["asdfgh"
         "awdrgy"
         "qwerty"
         "asergh"
         "asefgh"]
△.Entry ["a"]
△.Entry ["asdf" "asdf"]
△.Entry []

round #44

submitted at
1 like

guesses
comments 0

post a comment


entry.prick ASCII text
 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
API:
	input on stack from top:
	target,
	length N,
	N ascii-encoded characters from "0123456789+-*/"
	return value on top of stack after termination

memory layout:
	0: target
	1: length of input N
	2: best fit
	3: addr of permutation counting
	4: maximum amount of eval steps
	5-N+4: permutation of input
	N+5-2N+4: permutation counting

method:
	go through permutations of input interpretting them
	update the best fit on every possible intermediate value
	backtrack on stack/value underflow or division error
	permutations are generated using a bad version of heaps algorithm
	pruning is done based on stack size and arguments, all operations fail if the bigger argument is on top
	has very bad complexity if given too many digits and bad complexity overall
	will not execute the example in reasonable time

interpreter:
	asumes all the featured discussed on the wiki:
		builtin functions
		second stack
		number words
	unknown words are noops
	first two you can add to any interpreter using the code on the wiki

: comment


0 @	: target	1 @ : length
2	: best	3 @	: perm	4 @	: steps
5	: input

48	: '0'	43	: '+'	45	: '-'	42	: '*'	47	: '/'

>aux * aux> -- 1	: handle_mul

>aux + aux> -- 1	: handle_add

>aux - aux> -- 1	: handle_sub

-- >aux 1 over 1 [ | drop over over / dup >aux * - 1 swap 1
	[ | drop aux> drop aux> -- 0 0 0 ] [ 1 | aux> aux> 1 ] 0 0
] [ 1 | drop aux> 0 ]	: handle_div

1 over 1 [ '-' - | drop drop handle_div 0 0 0 ]
over over [ '+' - | drop drop handle_sub 0 0 0 ]
over over [ '*' - | drop drop handle_add 0 0 0 ]
[ | handle_mul 0 ]	: handle_operator

target over - over target - + target best @ - best @ target - + swap - 1 [ | best ! 0 0 ] drop	: is_best

best @ 0 input -- >aux 1 steps [ | aux> ++ dup >aux @
	1 over 1 [ '/' - | drop '0' - swap >aux over over swap - aux@ * 1 swap 1
    	[ | drop drop aux> 0 0 0 ] [ 1 | aux> ++ 1 ] 0 0
    ]
	[ 1 | >aux >aux over over - aux> swap over -- * aux> swap dup 1 [ | drop handle_operator 0 swap 0 ] swap drop ]
	>aux over is_best aux>
] ++ [ 1 | drop ] aux>	: eval

perm over - dup dup 2 / 2 * - 1
[ | swap ++ dup @ >aux swap 2 - [ 1 | dup ++ swap over @ swap ! ] aux> swap ! 0 0 0 ]
drop drop	: skip_after

dup >aux ++ input -
[ 1 perm aux@ - dup 2 / 2 * - [ 1 | drop perm -- @ aux@ dup @ perm -- ! ! 0 ]
	[ 1 | aux@ @ perm aux@ length + @ - -- dup @ aux@ ! ! ]
	aux@ length + dup @ ++ dup rot ! ++ perm aux@ - - | 0 aux@ length + ! aux> -- >aux
] aux>	: next_state

eval dup skip_after next_state	: step

1 dup rot [ 1 | >aux aux@ * aux> ++ ] drop	: factorial

0 5 target - 1 [ | drop 9 0 ]	: worst_fit

1 input >aux length [ 1 | 2 + aux> dup ++ >aux @ '/' - 1 [ | 2 - 0 ] ] aux> drop dup length - -	: calculate_steps


0 ! dup 1 ! dup 5 + 3 !

input swap [ 1 | >aux aux@ ! aux> ++ ] drop

calculate_steps 4 !

worst_fit best !

input length factorial [ 4 - | step ]

best @

round #43

submitted at
4 likes

guesses
comments 1
olus2000

It's a lexaloffle post now, with an embeddable cart and stuff!


post a comment


TIO.txt ASCII text, with very long lines (1081)
1
2
Try It Online:
https://pico-8-edu.com/?c=AHB4YQYaAwDrwX4wefP9V58dnf0SySNkz-AEYXN79QZN9gwPEN5-w1F33XVRf0ybDhxW3XRXEdzVJkkb31UVQV0U1Um7a8HOzsAzDM0kD1C9wGEjg91Uv9AHa1Nj4drCQhQ-QNQU1dxMO74ydt-clg2OawobLCYrZogTR4wlo2NR_BLXpVbwyytUQ0sDD9FqBgQ7AyNS4sryZnGgG12wxtZEPxPF1dRasjUcLzTPsxY4xtATzTs5QmtgdmeqFRTHnr1fyR5zI2USjsTnjfo_z_LLG31tq_ep6pHttZmpCcWhfiHYUhcYWGjGHI-GESuOX5DnwZ6jNM2TiproCr_Rrvg5oSt_OH66Qo7SFT8W0pmkEVQJZ0ZHX6Pb6tdHF2eybCMWU38mmu49dFnilYlkvG03bkgH6jsVAxQTipXtdWMckY-V04POv1Ykg2cq9yXpxogv0lQw0PcpJAZmlhY3mpl2e37MA5ojaxvZkA_akZG4mgyLYmIiSRaSGcuuVE0SmUGjZF8NLvZGF28kckG6BvmOYbXDdA7LQ6f0hoUFzNAtzO-pz6wHbVUNjly5f0YYDi2kS004oCIyX1xh-lzQLsyktTPGAu_K0OwFt95hggP6sEsmFjTppbKyObCtb1PtHNEtHRBuh_N3bK2aTsC_vr5gf2NoZKGuZ4aadFEewhTrAweEO4U8pJZgo4CnpS1hONRMF9PFhqaJX-enHZE7XnuOP6qsqhzvyPFHlA2rjlc8e6Nv6mZhb6_feJE3OaIbjSebrXBlQWe_gZyPqpmwXKMSE6jEGk5pvnO6cUrh2jCkUrgXpoJtBYKsX0pFEIKlBUVd_UVviKZXQz7mEJ31gYBRHUs2rATW0mKzV3FDVzZN18wK9rpK_uApth7DGkb0l0Q71WaHcCdg3SNhMDUUJUMbReiqAzbKqHF9AtesbFRV0rgegSlWoyuGVtpbdARGjNgWSZ8uKtnDOvvVgH69REKS5ATLr3JEpHLPQ6SvVu_YT22-Q1bStjukW7E_tC8A&g=w-w-w-w1HQHw-w2Xw-w3Xw-w2HQH
cg43.p8.png PNG image data, 160 x 205, 8-bit/color RGBA, non-interlaced

round #42

submitted at
0 likes

guesses
comments 0

post a comment


2048.lua ASCII text
 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
l=(function()end)w=(function(st)for i=1,(16)do(l)()if(st[i]==
2              *              2              *              2
* 2*256)then(l ) (5)return(12 ) end(l)(6)end l ()return(l)( 1
) end)l("B")o= ( function(s)l ( )for i=1,(16 ) do(l)()if(l) (
) or(not(s[i]) ) then;return( l (false));end ( l)({5,})if(i %
4 ~=0)and(s[i+ 1 -1]==s[i+2-1 ] )then(l)("D" ) return(l)("c "
) elseif(s[i+1 - 1]==s[i+2+2] ) then(l)(9+10 ) return(((l)( )
) )end(l)()end l ()return(556 ) end)function a (s)n=(94627* 0
) +math.random ( 16)if(s[n]or l ())then(a)(s ) else(s)[n]=( 0
*              2              +              0              +
math.random(4)//4*2+2)end(l)()return(s)end(l)()f=(function(s,
m              )              l              (              1
) if(m=="w"and 4 )then(l)()t= { }for x=0,(3. ) do(l)(21)for y
= 0,(3)do(t)[4 * x+y+1]=s[4*y + x+1]end(l)(0 ) end(l)("smig "
) return(t)end l ()if(m==("s" ) )then(l)("s" ) return(f((f( (
s ),"w")),"d") ) elseif((((m) ) =="d"))then( l )()t=({})for x
= 1,(16)do(t)[ x ]=s[17-x]end ; l("2")return ( t)end;return (
( table.move(s , 1,16,1,{}))) ; end)function b (c);l()local x
, s={}l(69)for i =1,(4)do;if( c [i])then;if( c [i]==s)then( l
)              (              -              4              )
table.insert(x,s*2)s=l()else;table.insert(x,s)s=(c[i])end;end
;              l              (              -              1
) end;l("upi") ; table.insert ( x,s)return(x ) end;function g
( s)l("d!")for i =1,16,(4)do; ; table.move(b ( table.move(s ,
i ,i+3,1,{})), 1 ,4,i,s)end(l ) ()return((s) ) end;function d
( _,s)if(o((s) ) )then(l)(426 ) io.write(j,e , "lost!\n")l( 4
) return;end;l ( )if(w(s)and{ } )then(l)()io . write(j,e,p) ;
; return;end;m = ""while(not( ( l()or(m:find ( ("[wasd]"))) )
) )do;l(5)m=io . read(15+-14) : lower()end;t = f(g(f(s,m)), m
)              l              (              9              )
for i=1,(16)do;if(t[i]~=s[i])then;return(a(t))end;end;return(
s              )              ,              6              ,
1 end;j="You"; p ="won!\n"e=" " q=function() ; l();A(r);l(- 2
) return(u(a(a ( {}))))end;l( ) v=(function( ) return(d),l( )
, (q())end);u= ( function(s); ; for x=1,16,( 4 )do;A(z);for y
= 0,(3)do;if(s [ x+y]and(s[x+ y ]//(100)>-0) ) then;l(32)A( B
: format(s[x+y ] //100))else; A ("|",e,e)end ; end;A("|\n") ;
; for y=0,3 do ; if(s[x+y+-0] ) then;l(g)A(B : format(s[x+y ]
% 100))else;;A ( "|",e,e)end; ; end;A("|\n") ; end;l("dummy "
)              A              (              z              )
return(s)end)r="Move by inputting WASD\n"z="+--+--+--+--+\n"e



=" "B="|%2d"A=(io.write)entry=function()for i in v() do;u(i);
end                                                       end

round #41

submitted at
1 like

guesses
comments 0

post a comment


dir FALSE
FALSE-docs.factor Unicode text, UTF-8 text, with very long lines (343)
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
! Copyright (C) 2023 Aleksander Sabak.
! See https://factorcode.org/license.txt for BSD license.
USING: assocs help.markup help.markup.private help.syntax kernel sequences strings urls ;
IN: FALSE

HELP: <FALSE-state>
{ $values
    { "stack" sequence } { "dictionary" assoc }
    { "state" FALSE-state }
}
{ $description "Creates a new FALSE state with clones of " { $snippet "stack" } " and " { $snippet "dictionary" } " as the initial stack and initial variable dictionary respectively." }
{ $see-also <empty-FALSE-state> with-FALSE } ;

HELP: <empty-FALSE-state>
{ $values
    { "state" FALSE-state }
}
{ $description "Creates a new, empty FALSE state. It has no bound variables and an empty stack." }
{ $see-also <FALSE-state> with-FALSE } ;

HELP: FALSE-state
{ $class-description "The class of tuples holding states of FALSE execution to be operated on by compiled FALSE programs. Implements " { $link "sequence-protocol" } " for access to stack and " { $link "assocs-protocol" } " for access to variables." }
{ $see-also <FALSE-state> <empty-FALSE-state> } ;

HELP: FALSE[
{ $syntax "FALSE[ 0 0[ß^$$47>\\58\\>&][48-\\10*+]#%[$1>][$1-]#[\\$0=~][*]#%.]" }
{ $description "Syntax for a FALSE program. It will run on a " { $link FALSE-state } " object. Syntax and semantics of FALSE language are explained in " { $link "FALSE" } "." }
{ $errors "Throws an error when the unsupported " { $snippet "`" } " command is encountered." }
{ $examples
  { $example
    "USING: kernel accessors FALSE prettyprint ;"
    "{ 2 1 3 7 } { } <FALSE-state>
    FALSE[ +-*] call stack>> ."
    "V{ -18 }"
  }
  { $example
    "USING: FALSE prettyprint ;"
    "\"Hello\" FALSE[ \\1+] with-FALSE ."
    "\"Helom\""
  }
}
{ $see-also with-FALSE } ;

HELP: scan-FALSE
{ $values
    { "quote" { $quotation ( state -- state' ) } }
}
{ $description "Reads a FALSE program from parser input until a closing " { $snippet "[" } " and compiles into a quotation to run on a " { $link FALSE-state } "." }
{ $errors "Throws an error when the unsupported " { $snippet "`" } " command is encountered." }
{ $see-also POSTPONE: FALSE[ } ;

HELP: unsupported-FALSE-command
{ $values
    { "command" object }
}
{ $description "Throws an " { $link unsupported-FALSE-command } " error." }
{ $error-description "Thrown during FALSE compilation if the " { $snippet "`" } " command is encountered." } ;

HELP: with-FALSE
{ $values
    { "seq" sequence } { "q" { $quotation ( ..A state -- ..B state' ) } }
    { "seq'" sequence }
}
{ $description "Wrapper around quotations transforming FALSE state. Creates a new " { $link FALSE-state } " instance with " { $snippet "seq" } " as its initial stack, runs " { $snippet "q" } " on it and extracts the final stack into a new sequence of the same type as " { $snippet "seq" } "." }
{ $examples
  { $example
    "USING: FALSE prettyprint ;"
    "{ 2 1 3 7 } FALSE[ +-*] with-FALSE ."
    "{ -18 }"
  }
  { $example
    "USING: FALSE prettyprint ;"
    "\"Hello\" FALSE[ \\1+] with-FALSE ."
    "\"Helom\""
  }
}
{ $see-also <FALSE-state> <empty-FALSE-state> }
;

ARTICLE: "FALSE" "FALSE language"
{ { $url URL"https://esolangs.org/wiki/FALSE" "FALSE" } " is a stack-based esoteric language designed by " { $url URL"https://strlen.com/" "Wouter van Oortmerssen" } " in 1993, with the goal of creating a powerful and obfuscated language with as small a compiler as possible." }

{ $heading "Overview of FALSE" }
FALSE has a simple concatenative syntax where each character is one command, apart from numbers which can span multiple characters. It operates on a stack but it can also store values in 26 variables named { $snippet "a" } through { $snippet "z" } . It works with three types of values:
{ $list
  { "Signed integers, for which literals are strings of digits or " { $snippet "'" } " followed by a character" }
  { "Variable references, for which literals are their names" }
  { "Quotations, for which literals are programs enclosed in " { $snippet "[...]" } }
}
It provides a set of builtin operators:
{ $table 
  { { $snippet "$" } { $snippet ( x -- x x ) } "Duplicates top of the stack" }
  { { $snippet "%" } { $snippet ( x -- ) } "Drop top of the stack" }
  { { $snippet "\\" } { $snippet ( x y -- y x ) } "Swaps top two elements on the stack" }
  { { $snippet "@" } { $snippet ( x y z -- y z x ) } "Pulls the third element from the stack to the top" }
  { { $snippet "ø" } { $snippet ( x n*x n -- x n*x x ) } "Replaces a number from top of the stack with an element that deep into the stack" }
  { { $snippet "O" } { $snippet ( x n*x n -- x n*x x ) } "Nonstandard, same as ø" }
  { { $snippet "+" } { $snippet ( x y -- z ) } "Adds top two numbers on the stack" }
  { { $snippet "-" } { $snippet ( x y -- z ) } "Subtracts top from second on the stack" }
  { { $snippet "*" } { $snippet ( x y -- z ) } "Multiplies top two numbers on the stack" }
  { { $snippet "/" } { $snippet ( x y -- z ) } "Divides second on the stack by top" }
  { { $snippet "_" } { $snippet ( x -- y ) } "Negates top of the stack" }
  { { $snippet "&" } { $snippet ( x y -- z ) } { "Performs a bitwise " { $snippet "and" } " on top two values o the stack" } }
  { { $snippet "|" } { $snippet ( x y -- z ) } { "Performs a bitwise " { $snippet "or" } " on top two values o the stack" } }
  { { $snippet "~" } { $snippet ( x -- y ) } "Performs a bitwise negation on top of the stack" }
  { { $snippet ">" } { $snippet ( x y -- z ) } "Pushes -1 if second on the stack is greater than top, otherwise pushes 0" }
  { { $snippet "=" } { $snippet ( x y -- z ) } "Pushes -1 if top two on the stack are equal, otherwise pushes 0" }
  { { $snippet "!" } { $snippet ( quot -- ) } "Executes top of stack" }
  { { $snippet "?" } { $snippet ( ? quot -- ) } "Executes top of stack if second on stack is non-zero" }
  { { $snippet "#" } { $snippet ( pred body -- ) } { "Executes " { $snippet "pred" } ", pops its return value, and loops calling " { $snippet "body" } ", " { $snippet "pred" } " and popping until the value popped is zero" } }
  { { $snippet ";" } { $snippet ( ref -- x ) } "Fetch from a variable reference" }
  { { $snippet ";" } { $snippet ( x ref -- ) } "Store into a variable reference" }
  { { $snippet "^" } { $snippet ( -- x ) } "Fetch a character from input stream, or -1 if input stream is exhausted" }
  { { $snippet "," } { $snippet ( x -- ) } "Print a character with a given code to the output stream" }
  { { $snippet "." } { $snippet ( x -- ) } "Print a number to the output stream" }
  { { $snippet "ß" } { $snippet ( -- ) } "Flush the input/output stream" }
  { { $snippet "B" } { $snippet ( -- ) } "Nonstandard, same as ß" }
  { { $snippet "`" } { $snippet ( -- * ) } "Unsupported" }
}
It also has two additional syntax constuctions:
{ $list
  { { $snippet "\"...\"" } " - print string enclosed in quotation marks" }
  { { $snippet "{...}" } " - ignore anything in curly braces" }
}

{ $heading "Vocabulary" }
The { $vocab-link "FALSE" } vocabulary provides a FALSE to Factor compiler in two words:
{ $subsections scan-FALSE POSTPONE: FALSE[ }
These offer a way to parse FALSE into quotations that take and return a FALSE state object. State objects can be constructed from a sequence which will form the initial stack and an assoc which will define initial variable bindings. The vocabulary also includes a wrapper word for using a FALSE quotation as a function transforming a sequence:
{ $subsections FALSE-state with-FALSE }

{ $heading "Implementation specific features" }
This FALSE to Factor compiler differs from the standard in several ways:
{ $list
  { "It doesn't support the " { $snippet "`" } " command" }
  { "It supports " { $snippet "O" } " and " { $snippet "B" } " commands as aliases to " { $snippet "ø" } " and " { $snippet "ß" } " respectively" }
  { "Any character not recognised as a FALSE command can be used as a variable reference, and variable references are stored as numbers on the stack which allows any number to be a variable reference as well" }
}

;

ABOUT: "FALSE"
FALSE-tests.factor Unicode text, UTF-8 text
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
! Copyright (C) 2023 Aleksander Sabak.
! See https://factorcode.org/license.txt for BSD license.
USING: io.streams.string kernel tools.test FALSE FALSE.private ;
IN: FALSE.tests


! scan-FALSE is not tested because testing with a custom lexer
! is too much effort


{ { } } [
    { } [ ] with-FALSE
] unit-test


{ 1 1 } FALSE[ [asd'f{fsd"}"as{fdsaf"[-+*]\]]
must-infer-as


{ "AA" } [
    "A" FALSE[ $] with-FALSE
] unit-test


{ "BA" } [
    "AB" FALSE[ \] with-FALSE
] unit-test


{ "A" } [
    "AB" FALSE[ %] with-FALSE
] unit-test


{ "BCA" } [
    "ABC" FALSE[ @] with-FALSE
] unit-test


{ { 2 1 3 7 2 } } [
    { 2 1 3 7 3 } FALSE[ O] with-FALSE
] unit-test


{ { 2 1 3 7 2 } } [
    { 2 1 3 7 3 } FALSE[ ø] with-FALSE
] unit-test


{ "Hello" } [
    "" FALSE[ 'H'e'l'l'o] with-FALSE
] unit-test


{ { 213 7 } } [
    { } FALSE[ 213 7] with-FALSE
] unit-test


{ { 220 } } [
    { } FALSE[ 213 7+] with-FALSE
] unit-test


{ { 206 } } [
    { } FALSE[ 213 7-] with-FALSE
] unit-test


{ { -2137 } } [
    { } FALSE[ 2137_] with-FALSE
] unit-test


{ { 1491 } } [
    { } FALSE[ 213 7*] with-FALSE
] unit-test


{ { 30 } } [
    { } FALSE[ 213 7/] with-FALSE
] unit-test


{ { 1 } } [
    { } FALSE[ 5 3&] with-FALSE
] unit-test


{ { 7 } } [
    { } FALSE[ 5 3|] with-FALSE
] unit-test


{ { -6 } } [
    { } FALSE[ 5~] with-FALSE
] unit-test


{ { -1 } } [
    { } FALSE[ 5 5=] with-FALSE
] unit-test


{ { 0 } } [
    { } FALSE[ 5 6=] with-FALSE
] unit-test


{ { 0 } } [
    { } FALSE[ 5 6>] with-FALSE
] unit-test


{ { 0 } } [
    { } FALSE[ 5 5>] with-FALSE
] unit-test


{ { -1 } } [
    { } FALSE[ 5 4>] with-FALSE
] unit-test


{ { [ ] } } [
    { } FALSE[ []] with-FALSE
] unit-test


{ { 1 } } [
    { } FALSE[ [1]!] with-FALSE
] unit-test


{ { 1 } } [
    { } FALSE[ 1_[1]?] with-FALSE
] unit-test


{ { } } [
    { } FALSE[ 0[1]?] with-FALSE
] unit-test


{ { } } [
    { } FALSE[ [0][7]#] with-FALSE
] unit-test


{ { 6 } } [
    { } FALSE[ 0 1[][6\]#] with-FALSE
] unit-test


{ { 6 5 4 3 2 1 0 } } [
    { } FALSE[ 7[1-$][$]#] with-FALSE
] unit-test


{ { } } [
    { } FALSE[ {1 2 3}] with-FALSE
] unit-test


{ { [ ] } } [
    { } FALSE[ [{]}]] with-FALSE
] unit-test


{ { } "Hello" } [
    [ { } FALSE[ "Hello"] with-FALSE ] with-string-writer
] unit-test


{ "" } [
    [ FALSE[ "Hello"] ] with-string-writer nip
] unit-test


{ { } "{" } [
    [ { } FALSE[ "{"] with-FALSE ] with-string-writer
] unit-test


{ { } "1" } [
    [ { } FALSE[ {"}"1"] with-FALSE ] with-string-writer
] unit-test


{ { } "]" } [
    [ { } FALSE[ ["]"]!] with-FALSE ] with-string-writer
] unit-test


{ "" "Hello" } [
    [ "olleH" FALSE[ ,,,,,] with-FALSE ] with-string-writer
] unit-test


{ { } "2137" } [
    [ { 2137 } FALSE[ .] with-FALSE ] with-string-writer
] unit-test


{ { 2 1 3 7 } } [
    { 2 1 3 7 } FALSE[ B] with-FALSE
] unit-test


{ { 2 1 3 7 } } [
    { 2 1 3 7 } FALSE[ ß] with-FALSE
] unit-test


{ "Hello" } [
    "Hello" [ "" FALSE[ ^^^^^] with-FALSE ] with-string-reader
] unit-test


{ T{ FALSE-state } } [
    <empty-FALSE-state>
] unit-test


{ T{ FALSE-state } } [
    { } { } <FALSE-state>
] unit-test


{
    T{ FALSE-state
        { stack V{ 97 98 99 } }
        { dictionary H{ { 97 98 } { 99 100 } } }
    }
} [
    "abc" { "ab" "cd" } <FALSE-state>
] unit-test


{ T{ FALSE-state { stack V{ 0 55 } } } } [
    <empty-FALSE-state> FALSE[ 2 1+3\-'7] call
] unit-test


{
    T{ FALSE-state
        { dictionary H{ { 97 3 } { 98 2 } { 99 1 } } }
    }
} [
    { 1 2 3 } { } <FALSE-state> FALSE[ a:b:c:] call
] unit-test


{
    T{ FALSE-state
        { stack V{ 1 2 3 } }
        { dictionary H{ { 97 1 } { 98 2 } { 99 3 } } }
    }
} [
    { } { { CHAR: a 1 } { CHAR: b 2 } { CHAR: c 3 } }
    <FALSE-state> FALSE[ a;b;c;] call
] unit-test


{
    T{ FALSE-state
        { stack V{ 3 2 1 } }
        { dictionary H{ { 97 3 } { 98 2 } { 99 1 } } }
    }
} [
    { 1 2 3 } { } <FALSE-state> FALSE[ a:b:c:a;b;c;] call
] unit-test


{
    T{ FALSE-state
        { stack V{ 16 49 } }
        { dictionary H{ { 97 [ ($) (*) ] } } }
    }
} [
    <empty-FALSE-state> FALSE[ [$*]a:4a;!7a;!] call
] unit-test


{
    { 15 }
    "12345678910111213141516171819202122233524578helloworld"
} [
    [ { } FALSE[ {tests by luatic made for cg41}1 .
    1 1 + .
    4 1 - .
    2 2 * .
    10 2 / .
    6 _ _ .
    4 3 | .
    8 63 & .
    1 _ ~ 9 + .
    10 a : a ; .
    5 $ 1 + + .
    12 42 % .
    42 13 \ % .
    14 42 42 @ . % %
    15 42 42 2O . % %
    42 42 = ["16"]?
    42 41 > ["17"]?
    42 41_ > ["18"]?
    42_ 41 > ["FAIL"]?
    42_ 41_ > ["FAIL"]?
    41_ 42_ > ["19"]?
    ["20"]!
    [["2"]!["1"]!]![[]]%
    0 ["FAIL"]?
    42 ["22"]?
    '2,'3,[$ 1 > [1- $ f;! \ 1- f;! +]?]f:
    33 f;!.'h,"elloworld"] with-FALSE ] with-string-writer
] long-unit-test


{ { 97 -1 } } [
    "a" [ { } FALSE[ ^^] with-FALSE ] with-string-reader
] unit-test
FALSE.factor Unicode text, UTF-8 text
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
! Copyright (C) 2023 Aleksander Sabak.
! See https://factorcode.org/license.txt for BSD license.
USING: accessors ascii assocs combinators continuations delegate
delegate.protocols hashtables io kernel lexer math math.parser
namespaces quotations sequences unicode vectors ;
IN: FALSE


ERROR: unsupported-FALSE-command command ;


DEFER: scan-FALSE


<PRIVATE


: peek-char ( -- char|f )
  lexer get dup still-parsing?
  [ dup still-parsing-line?
    [ [ column>> ] [ line-text>> ] bi nth ]
    [ drop CHAR: \n ] if ] [ drop f ] if ;

: consume-char ( -- )
  lexer get dup still-parsing-line?
  [ [ 1 + ] change-column drop ] [ next-line ] if ;

: scan-char ( -- char|f ) peek-char dup [ consume-char ] when ;


: (scan-FALSE-number) ( digit -- number )
  CHAR: 0 - [ peek-char dup ascii:digit? ]
  [ consume-char CHAR: 0 - swap 10 * + ] while drop ;


: (;) ( state -- state )
  dup pop over at* [ drop 0 ] unless suffix! ;

: (:) ( state -- state )
  dup [ pop ] [ pop ] bi swap pick set-at ;

: ($) ( state -- state ) dup last suffix! ;

: (%) ( state -- state ) dup pop* ;

: (\) ( state -- state )
  dup [ pop ] [ pop ] bi [ suffix! ] dip suffix! ;

: (@) ( state -- state )
  dup [ pop ] [ pop ] [ pop ] tri
  [ swap [ suffix! ] dip suffix! ] dip suffix! ;

: (O) ( state -- state )
  dup dup [ length ] [ pop ] bi - 2 - swap nth suffix! ;

: (+) ( state -- state ) dup [ pop ] [ pop ] bi + suffix! ;

: (-) ( state -- state ) dup [ pop ] [ pop ] bi swap - suffix! ;

: (*) ( state -- state ) dup [ pop ] [ pop ] bi * suffix! ;

: (/) ( state -- state )
  dup [ pop ] [ pop ] bi swap /i suffix! ;

: (_) ( state -- state ) dup pop neg suffix! ;

: (&) ( state -- state ) dup [ pop ] [ pop ] bi bitand suffix! ;

: (|) ( state -- state ) dup [ pop ] [ pop ] bi bitor suffix! ;

: (~) ( state -- state ) dup pop bitnot suffix! ;

: (=) ( state -- state )
  dup [ pop ] [ pop ] bi = [ -1 ] [ 0 ] if suffix! ;

: (>) ( state -- state )
  dup [ pop ] [ pop ] bi < [ -1 ] [ 0 ] if suffix! ;

: (!) ( state -- state ) dup pop call( state -- state ) ;

: (?) ( state -- state )
  dup [ pop ] [ pop ] bi 0 =
  [ drop ] [ call( state -- state ) ] if ;

: (#) ( state -- state )
  dup [ pop [ call( state -- state ) ] curry ]
  [ pop [ call( state -- state ) dup pop 0 = ] curry ] bi
  swap until ;

: (^) ( state -- state ) read1 -1 or suffix! ;

: (,) ( state -- state ) dup pop write1 ;

: (.) ( state -- state ) dup pop number>string write ;

ALIAS: (B) flush


CONSTANT: FALSE-dictionary
  H{
    { CHAR: ; (;) }
    { CHAR: : (:) }
    { CHAR: $ ($) }
    { CHAR: % (%) }
    { CHAR: \ (\) }
    { CHAR: @ (@) }
    { CHAR: O (O) }
    { CHAR: ø (O) }
    { CHAR: + (+) }
    { CHAR: - (-) }
    { CHAR: * (*) }
    { CHAR: / (/) }
    { CHAR: _ (_) }
    { CHAR: & (&) }
    { CHAR: | (|) }
    { CHAR: ~ (~) }
    { CHAR: = (=) }
    { CHAR: > (>) }
    { CHAR: ! (!) }
    { CHAR: ? (?) }
    { CHAR: # (#) }
    { CHAR: ^ (^) }
    { CHAR: , (,) }
    { CHAR: . (.) }
    { CHAR: B (B) }
    { CHAR: ß (B) }
  }


CONSTANT: FALSE-sigils
  H{
    { CHAR: {
      [ [ scan-char
          { { CHAR: } [ f ] }
            { f [ \ } throw-unexpected-eof ] }
            [ drop t ] } case ] loop ] }
    { CHAR: "
      [ V{ } clone
        [ scan-char
          { { CHAR: " [ f ] }
            { f [ \ " throw-unexpected-eof ] }
            [ suffix! t ] } case ] loop suffix!
        \ write suffix! ] }
    { CHAR: ' [ scan-char suffix! \ suffix! suffix! ] }
    { CHAR: [ [ scan-FALSE suffix! \ suffix! suffix! ] }
    { CHAR: ` [ CHAR: ` unsupported-FALSE-command ] }
  }


PRIVATE>


! FALSE state

TUPLE: FALSE-state { stack vector } { dictionary hashtable } ;

: <FALSE-state> ( stack dictionary -- state )
  [ V{ } clone-like ] [ H{ } assoc-clone-like ] bi*
  FALSE-state boa ;

CONSULT: assoc-protocol FALSE-state dictionary>> ;

CONSULT: sequence-protocol FALSE-state stack>> ;

M: FALSE-state like drop { } <FALSE-state> ;

M: FALSE-state new-sequence
  state>> new-sequence { } <FALSE-state> ;

M: FALSE-state new-resizable
  state>> new-resizable { } <FALSE-state> ;

M: FALSE-state new-assoc
  dictionary>> new-assoc { } swap <FALSE-state> ;

M: FALSE-state assoc-like
  dictionary>> assoc-like { } swap <FALSE-state> ;

INSTANCE: FALSE-state sequence

INSTANCE: FALSE-state assoc

: <empty-FALSE-state> ( -- state ) { } { } <FALSE-state> ;


: with-FALSE
  ( ..A seq q: ( ..A state -- ..B state' ) -- ..B seq' )
  swap [ H{ } <FALSE-state> swap call stack>> ] keep
  clone-like ; inline


: scan-FALSE ( -- quote )
  V{ } clone
  [ scan-char dup CHAR: ] = ]
  [ { { [ FALSE-dictionary ?at ] [ suffix! ] }
      { [ FALSE-sigils ?at ] [ call( x -- x ) ] }
      { [ dup ascii:digit? ]
        [ (scan-FALSE-number) suffix! \ suffix! suffix! ] }
      { [ dup unicode:blank? ] [ drop ] }
      [ suffix! \ suffix! suffix! ] } cond ] until
  drop >quotation ;


SYNTAX: FALSE[ scan-FALSE suffix! ;
authors.txt ASCII text
1
Aleksander Sabak
summary.txt ASCII text
1
A FALSE to Factor compiler.
tags.txt ASCII text
1
2
3
languages
parsing
syntax

round #40

submitted at
0 likes

guesses
comments 0

post a comment


solution.py ASCII text
 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
# // Code by SoundOfSpouting#6980 (UID: 151149148639330304)

# load weights and biases
from base64 import b64decode

net = eval(b64decode(b'KGdsb2JhbHMoKS5fX3NldGl0ZW1fXygiciIsX19pbXBvcnRfXygicmFuZG9tIikucmFuZG9tKSxsYW1iZGEgeDooZ2xvYmFscygpLl9fc2V0aXRlbV9fKCJzIixbcigpZm9yIGkgaW4gcmFuZ2UoNCldKSxbaS9zdW0ocylmb3IgaSBpbiBzXSlbMV0pWzFd'))

# returns a normalised vector of confidence for each direction
# dont expect high confidence, its pretty bad


# indexes of cells on the board:
# ,----+----+----+----,
# |  0 |  4 |  8 | 12 |
# +----+----+----+----+
# |  1 |  5 |  9 | 13 |
# +----+----+----+----+
# |  2 |  6 | 10 | 14 |
# +----+----+----+----+
# |  3 |  7 | 11 | 15 |
# '----+----+----+----'
# empty cell is encoded as zero in arguments to entry and net
# "move up" means move a tile up to the empty space

directions = ["up", "left", "down", "right"]


# call repeatedly to get a sequence of moves to solve the puzzle
def entry(board):
    zero = board.index(0)
    for score, i in sorted(zip(net(board), [0, 1, 2, 3]), reverse=1):
        # pick most confident legal move
        if i == 0:
            if zero % 4 + 1 > 3:
                continue
        if i == 1:
            if zero + 4 > 15:
                continue
        if i == 2:
            if zero % 4 - 1 < 0:
                continue
        if i == 3:
            if zero - 4 < 0:
                continue
        print("move " + directions[i] + " (confidence: " + str(score) + ")")
        break

round #39

submitted at
1 like

guesses
comments 0

post a comment


brain-flak.tar.bz3 bzip3 compressed data, blocksize 16777216
dir brain-flak
authors.txt ASCII text
1
// Code by SoundOfSpouting#6980 (UID: 151149148639330304)
brain-flak-docs.factor ASCII text, with very long lines (411)
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
! // Code by SoundOfSpouting#6980 (UID: 151149148639330304)
! See http://factorcode.org/license.txt for BSD license.
USING: help.markup help.syntax kernel strings urls ;
IN: brain-flak

HELP: unclosed-brain-flak-expression
{ $values
  { "program" object }
}
{ $description "Throws an " { $link unclosed-brain-flak-expression } " error." }
{ $error-description "Thrown during brain-flak compilation if an opened subexpression doesn't have a closing bracket."
} ;

HELP: mismatched-brain-flak-brackets
{ $values
  { "program" object } { "character" object }
}
{ $description "Throws an " { $link mismatched-brain-flak-brackets } " error." }
{ $error-description "Thrown if a bracket is closed with a bracket that doesn't match." } ;

HELP: leftover-program-after-compilation
{ $values
  { "program" object } { "leftover" object }
}
{ $description "Throws an " { $link leftover-program-after-compilation } " error." }
{ $error-description "Thrown if excessive closing brackets are encountered during compilation." } ;


HELP: b-f"
{ $syntax "b-f\"({}[]){<>()}\"" }
{ $description "Syntax for a brain-flak program. It will take a sequence, run the program with the sequence as the initial active stack, and replace the sequence with the final active stack. Syntax and semantics of brain-flak are explained in" { $link "brain-flak" } .
}
{ $errors "Throws an error when the parsed string is not a correct brain-flak program" }
{ $examples
  { $example
    "USING: brain-flak prettyprint ;"
    "{ 2 1 3 7 } b-f\"({{}})\" ."
    "{ 13 }"
  }
  { $example
    "USING: brain-flak prettyprint ;"
    "{ 1 2 } b-f\"(({}({}))[({}[{}])])\" ."
    "{ 2 1 }"
  }
}
{ $see-also compile-brain-flak } ;

HELP: compile-brain-flak
{ $values
  { "string" string }
  { "quote" { $quotation ( seq -- seq ) } }
}
{ $description
  "Compiles a brain-flak program in" { $snippet "string" } "into a quotation that can be run on a sequence of numbers and will return a sequence of numbers. Syntax and semantics of brain-flak are explained in" { $link "brain-flak" } "."
}
{ $errors "Throws an error when the string is not a correct brain-flak program" }
{ $examples
  { $example
    "USING: brain-flak kernel prettyprint ;"
    "\"({{}})\" compile-brain-flak"
    "{ 2 1 3 7 } swap call( seq -- seq ) ."
    "{ 13 }"
  }
  { $example
    "USING: brain-flak kernel prettyprint ;"
    "\"(({}({}))[({}[{}])])\" compile-brain-flak"
    "{ 1 2 } swap call( seq -- seq ) ."
    "{ 2 1 }"
  }
}
{ $see-also \ b-f" } ;

ARTICLE: "brain-flak" "Introduction to brain-flak"
{ { $url URL"https://esolangs.org/wiki/Brain-Flak" "Brain-flak" } " is a stack-based esoteric language designed by Programming Puzzles and Code-Golf user " { $url URL"https://codegolf.stackexchange.com/users/31716/djmcmayhem" "DjMcMayhem" } } . The name is a cross between "\"brainfuck\"" , which was a big inspiration for the language, and "\"flak-overstow\"" , since the language is confusing and stack-based.

{ $heading "Overview" }
Brain-flak is an expression-based language written only using brackets, which must be balanced. Any other character will be ignored. Its only data type is a signed integer, which in this implementation has unbounded size.
{ $nl }
There are two stacks, one of which is considered the { $strong "active" } stack at each point of the execution. Programs start with the active stack initialised with the input data and inactive stack empty, and return the active stack when finished. Popping from an empty stack yields 0.
{ $nl }
Each expression in brain-flak executes some side-effects on the stacks and evaluates to a number. Concatenation of expressions performs their side-effects from left to right and evaluates to a sum of their evaluations.

{ $heading "Functions" }
There are two types of functions in brain-flak: nilads, that are brackets without any contents, and monads, which are non-empty bracketed subexpressions.
{ $nl }
Nilads:
{ $list
  { { $snippet "()" } " evaluates to 1" }
  { { $snippet "[]" } " evaluates to the height of the active stack" }
  { { $snippet "{}" } " pops the active stack and evaluates to the popped value" }
  { { $snippet "<>" } " swaps active and inactive stack and evaluates to 0" }
}
Recall that concatenating expressions sums their values, so { $snippet "()()()" } will evaluate to 3, and { $snippet "{}()" } will pop from the active stack and evaluate to one more than the popped value.
{ $nl }
Monads:
{ $list
  { { $snippet "(X)" } " evaluates " { $snippet "X" } ", pushes the result on the stack and evaluates to the same value" }
  { { $snippet "[X]" } " evaluates " { $snippet "X" } " and evaluates to its negation" }
  { { $snippet "{X}" } " evaluates " { $snippet "X" } " in a loop as long as top of the active stack is not 0 and evaluates to the sum of all results" }
  { { $snippet "<X>" } " evaluates " { $snippet "X" } ", discards the result and evaluates to zero" }
}
For example program { $snippet "([(()()())])" } will push numbers 3 and -3 to the stack, and program { $snippet "({{}})" } will replace values on the stack until a zero with their sum.

{ $examples "Examples of brain-flak programs can be seen on its " { $url URL"https://github.com/DJMcMayhem/Brain-Flak/wiki/Stack-Operations" "github wiki" } "." }

{ $heading "Vocabulary" }
The { $vocab-link "brain-flak" } vocabulary provides a brain-flak to Factor compiler in two words: { $subsections compile-brain-flak POSTPONE: b-f" } These offer a way to compile brain-flak strings into quotations and embed them directly in code. Programs compiled this way will take a sequence for their initial active stack and return a sequence of the same type representing the "final" active stack.
;

ABOUT: "brain-flak"
brain-flak-tests.factor ASCII text
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
! // Code by SoundOfSpouting#6980 (UID: 151149148639330304)
! See http://factorcode.org/license.txt for BSD license.
USING: accessors brain-flak combinators.short-circuit kernel
    strings tools.test ;
IN: brain-flak.tests


{ { } } [ { } "" compile-brain-flak call ] unit-test

{ { } } [ { } b-f"" ] unit-test

{ { } } [ { } "X" compile-brain-flak call ] unit-test

{ { } } [ { } b-f"X" ] unit-test

{ { } } [ { } "()" compile-brain-flak call ] unit-test

{ { } } [ { } b-f"()" ] unit-test

{ { } } [ { } "[]" compile-brain-flak call ] unit-test

{ { } } [ { } b-f"[]" ] unit-test

{ { } } [ { } "{}" compile-brain-flak call ] unit-test

{ { } } [ { } b-f"{}" ] unit-test

{ { } } [ { } "<>" compile-brain-flak call ] unit-test

{ { } } [ { } b-f"<>" ] unit-test

{ { 1 } } [ { } "(())" compile-brain-flak call ] unit-test

{ { 1 } } [ { } b-f"(())" ] unit-test

{ { 1 } } [ { } "((X))" compile-brain-flak call ] unit-test

{ { 1 } } [ { } b-f"((X))" ] unit-test

{ { 1 } } [ { } "(X()X)" compile-brain-flak call ] unit-test

{ { 1 } } [ { } b-f"(X()X)" ] unit-test

{ { 2 } } [ { } "(()())" compile-brain-flak call ] unit-test

{ { 2 } } [ { } b-f"(()())" ] unit-test

{ { 2 2 } } [ { } "((()()))" compile-brain-flak call ] unit-test

{ { 2 2 } } [ { } b-f"((()()))" ] unit-test

{ { 0 } } [ { } "([])" compile-brain-flak call ] unit-test

{ { 0 } } [ { } b-f"([])" ] unit-test

{ { 1 2 3 3 } } [ { 1 2 3 } "([])" compile-brain-flak call ] unit-test

{ { 1 2 3 3 } } [ { 1 2 3 } b-f"([])" ] unit-test

{ { 1 2 2 3 } } [ { 1 2 } "([])([])" compile-brain-flak call ] unit-test

{ { 1 2 2 3 } } [ { 1 2 } b-f"([])([])" ] unit-test

{ { 0 } } [ { } "({})" compile-brain-flak call ] unit-test

{ { 0 } } [ { } b-f"({})" ] unit-test

{ { 1 2 } } [ { 1 2 } "({})" compile-brain-flak call ] unit-test

{ { 1 2 } } [ { 1 2 } b-f"({})" ] unit-test

{ { 1 } } [ { 1 2 } "{}" compile-brain-flak call ] unit-test

{ { 1 } } [ { 1 2 } b-f"{}" ] unit-test

{ { 0 } } [ { 1 2 } "(<>)" compile-brain-flak call ] unit-test

{ { 0 } } [ { 1 2 } b-f"(<>)" ] unit-test

{ { 1 2 0 } } [ { 1 2 } "(<><>)" compile-brain-flak call ] unit-test

{ { 1 2 0 } } [ { 1 2 } b-f"(<><>)" ] unit-test

{ { 0 } } [ { } "([[]])" compile-brain-flak call ] unit-test

{ { 0 } } [ { } b-f"([[]])" ] unit-test

{ { 1 2 -2 } } [ { 1 2 } "([[]])" compile-brain-flak call ] unit-test

{ { 1 2 -2 } } [ { 1 2 } b-f"([[]])" ] unit-test

{ { 0 } } [ { } "([()]())" compile-brain-flak call ] unit-test

{ { 0 } } [ { } b-f"([()]())" ] unit-test

{ { 0 } } [ { } "({<>})" compile-brain-flak call ] unit-test

{ { 0 } } [ { } b-f"({<>})" ] unit-test

{ { 4 3 2 1 0 6 } } [ { 4 } "({(({})[()])})" compile-brain-flak call ] unit-test

{ { 4 3 2 1 0 6 } } [ { 4 } b-f"({(({})[()])})" ] unit-test

{ { 0 } } [ { } "(<()()()>)" compile-brain-flak call ] unit-test

{ { 0 } } [ { } b-f"(<()()()>)" ] unit-test

{ { 1 0 } } [ { 1 2 } "(<<>({}())>)" compile-brain-flak call ] unit-test

{ { 1 0 } } [ { 1 2 } b-f"(<<>({}())>)" ] unit-test


[ "{" compile-brain-flak call ]
[ { [ unclosed-brain-flak-expression? ]
    [ program>> "{" = ]
  } 1&&
] must-fail-with

[ "{>" compile-brain-flak call ]
[ { [ mismatched-brain-flak-brackets? ]
    [ program>> "{>" = ]
  } 1&&
] must-fail-with

[ "{}>" compile-brain-flak call ]
[ { [ leftover-program-after-compilation? ]
    [ program>> "{}>" = ]
    [ leftover>> >string ">" = ]
  } 1&&
] must-fail-with
brain-flak.factor ASCII text
 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
79
80
81
82
83
84
85
! // Code by SoundOfSpouting#6980 (UID: 151149148639330304)
! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs combinators combinators.short-circuit
    kernel math sequences sets splitting strings.parser vectors
;
IN: brain-flak


<< ALIAS: ' CHAR: >>


ERROR: unclosed-brain-flak-expression program ;
ERROR: mismatched-brain-flak-brackets program ;
ERROR: leftover-program-after-compilation program leftover ;


<PRIVATE

: matches ( a b -- ? )
  { { ' ( ' ) }
    { ' [ ' ] }
    { ' { ' } }
    { ' < ' > }
    { ' ) ' ( }
    { ' ] ' [ }
    { ' } ' { }
    { ' > ' < }
  } at =
;

: glue ( a stack2 stack1 b -- a+b stack2 stack1 ) roll + -rot ;

: (()) ( ret stack2 stack1 -- ret stack2 stack1 ) 1 glue ;

: ([]) ( ret stack2 stack1 -- ret stack2 stack1 ) dup length glue ;

: ({}) ( ret stack2 stack1 -- ret stack2 stack1 ) dup [ pop glue ] unless-empty ;

: (<>) ( ret stack2 stack1 -- ret stack2 stack1 ) swap ;

: ()) ( ret stack2 stack1 quot -- ret stack2 stack1 ) 0 -roll call rot [ suffix! ] keep glue ; inline

: (]) ( ret stack2 stack1 quot -- ret stack2 stack1 ) 0 -roll call rot neg glue ; inline

: (}) ( ret stack2 stack1 quot -- ret stack2 stack1 ) 0 -roll [ dup { [ empty? ] [ last 0 = ] } 1|| ] swap until rot glue ; inline

: (>) ( ret stack2 stack1 quot -- ret stack2 stack1 ) 0 -roll call rot drop ; inline

: compile-bf-subexpr ( vec string-like -- vec string-like )
  [ { { [ dup empty? ] [ f ] }
      { [ dup first ")]}>" in? ] [ f ] }
      { [ "()" ?head-slice ] [ [ \ (()) suffix! ] dip t ] }
      { [ "[]" ?head-slice ] [ [ \ ([]) suffix! ] dip t ] }
      { [ "{}" ?head-slice ] [ [ \ ({}) suffix! ] dip t ] }
      { [ "<>" ?head-slice ] [ [ \ (<>) suffix! ] dip t ] }
      [ 0 <vector> swap [ rest-slice ] [ first ] bi
        [ compile-bf-subexpr [ [ ] clone-like suffix! ] dip
          [ dup empty?
            [ dup seq>> unclosed-brain-flak-expression ]
            [ rest-slice ] if ] [ ?first ] bi
        ] dip
        over matches
        [ over seq>> mismatched-brain-flak-brackets ] unless
        { { ' ) [ [ \ ()) suffix! ] dip ] }
          { ' ] [ [ \ (]) suffix! ] dip ] }
          { ' } [ [ \ (}) suffix! ] dip ] }
          { ' > [ [ \ (>) suffix! ] dip ] }
        } case t
      ]
    } cond
  ] loop
;

PRIVATE>


: compile-brain-flak ( string -- quote )
  [ "()[]{}<>" in? ] filter dup
  V{ dup V{ } clone-like 0 0 <vector> rot } clone
  swap compile-bf-subexpr
  [ overd leftover-program-after-compilation ] unless-empty
  { 2nip swap clone-like } append! [ ] clone-like nip
;

SYNTAX: b-f" parse-string compile-brain-flak append! ;
summary.txt ASCII text
1
A Brain-flak to Factor compiler
tags.txt ASCII text
1
2
3
4
brain-flak
languages
parsing
syntax

round #38

submitted at
2 likes

guesses
comments 0

post a comment


entry.i ASCII text
1
2
3
"// Code by SoundOfSpouting#6980 (UID: 151149148639330304)"
"To ensure compatibility with the limitations of the I language regarding character operations, the entry function expects the expression to be provided as an array of integers representing ASCII-encoded values."
'entry': ((,b32 o -b48 o (0.;B,o(Gb_1) h -.~ h ;.f o.~ (#oi \ =b_16=0 +1))h(] g [oG g [ogo- .f))o ([+1-1 (gH -b1  ,.o  (}H -b1 oG  B.o  }oG+6 o *;+,N,-,N,(/om)B}  ~.o  }H +b1 oG  o ;o;)  ,.o  ([\  #oi h< =0)H +b2).o (\H #oio(%b2)  o  [o#oi*2+1 \ #.fh= og H #.fo(m.r)))w(#>1)ogog)

round #37

submitted at
0 likes

guesses
comments 0

post a comment


entry.fs ASCII text
1
2
3
4
5
6
7
( // Code by SoundOfSpouting#6980 (UID: 151149148639330304)

: DIGIT-SUM ( u -- u )
  DUP IF 0 BASE @ UM/MOD RECURSE + THEN ;

: ENTRY ( u -- u )
  BEGIN DUP BASE @ U< 0= WHILE DIGIT-SUM REPEAT ;

round #35

submitted at
0 likes

guesses
comments 6
olus2000

Try it online at: https://www.lexaloffle.com/bbs/?tid=52273&tkey=n7PADkjhhtLyCzztIg6D

It also has link to source code online


olus2000

haha i just came to a realization


RocketRace

i have the ability to mimic any individual in this manner


olus2000

So bad...


olus2000

You can't mimic me (no capital letter at the start of a sentence)


verified


post a comment


cg_35.p8.png PNG image data, 160 x 205, 8-bit/color RGBA, non-interlaced

round #34

submitted at
0 likes

guesses
comments 0

post a comment


fb.py ASCII text
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
i = 32
while True:
    if i == 0:
        print("Fizz")
        i = 81
    if i == 1:
        print("71")
        i = 72
    if i == 2:
        print("Fizz")
        i = 90
    if i == 3:
        print("31")
        i = 9
    if i == 4:
        print("58")
        i = 14
    if i == 5:
        print("Fizz")
        i = 11
    if i == 6:
        print("Fizz")
        i = 4
    if i == 7:
        print("Fizz")
        i = 23
    if i == 8:
        print("26")
        i = 25
    if i == 9:
        print("32")
        i = 34
    if i == 10:
        print("73")
        i = 26
    if i == 11:
        print("82")
        i = 70
    if i == 12:
        print("Fizz")
        i = 55
    if i == 13:
        print("62")
        i = 66
    if i == 14:
        print("59")
        i = 96
    if i == 15:
        print("FizzBuzz")
        i = 68
    if i == 16:
        print("38")
        i = 30
    if i == 17:
        print("44")
        i = 24
    if i == 18:
        print("28")
        i = 93
    if i == 19:
        print("Fizz")
        i = 83
    if i == 20:
        print("Buzz")
        i = 78
    if i == 21:
        print("46")
        i = 62
    if i == 22:
        print("64")
        i = 84
    if i == 23:
        print("7")
        i = 92
    if i == 24:
        print("FizzBuzz")
        i = 21
    if i == 25:
        print("Fizz")
        i = 18
    if i == 26:
        print("74")
        i = 15
    if i == 27:
        print("11")
        i = 12
    if i == 28:
        print("88")
        i = 75
    if i == 29:
        print("34")
        i = 20
    if i == 30:
        print("Fizz")
        i = 76
    if i == 31:
        print("Fizz")
        i = 28
    if i == 32:
        print("1")
        i = 53
    if i == 33:
        print("Buzz")
        i = 82
    if i == 34:
        print("Fizz")
        i = 29
    if i == 35:
        print("FizzBuzz")
        i = 3
    if i == 36:
        print("Buzz")
        i = 54
    if i == 37:
        print("Buzz")
        i = 80
    if i == 38:
        print("Fizz")
        i = 69
    if i == 39:
        print("86")
        i = 31
    if i == 40:
        print("56")
        i = 6
    if i == 41:
        print("23")
        i = 59
    if i == 42:
        print("Buzz")
        i = 39
    if i == 43:
        print("17")
        i = 0
    if i == 44:
        print("Fizz")
        i = 99
    if i == 45:
        print("61")
        i = 13
    if i == 46:
        print("Fizz")
        i = 58
    if i == 47:
        print("Fizz")
        i = 42
    if i == 48:
        print("53")
        i = 97
    if i == 49:
        print("37")
        i = 16
    if i == 50:
        print("16")
        i = 43
    if i == 51:
        print("41")
        i = 46
    if i == 52:
        print("Fizz")
        i = 37
    if i == 53:
        print("2")
        i = 71
    if i == 54:
        print("Fizz")
        i = 56
    if i == 55:
        print("13")
        i = 91
    if i == 56:
        print("52")
        i = 48
    if i == 57:
        print("Buzz")
        i = 1
    if i == 58:
        print("43")
        i = 17
    if i == 59:
        print("Fizz")
        i = 95
    if i == 60:
        print("Buzz")
        i = 87
    if i == 61:
        print("Fizz")
        i = 77
    if i == 62:
        print("47")
        i = 44
    if i == 63:
        print("98")
        i = 52
    if i == 64:
        print("FizzBuzz")
        i = 88
    if i == 65:
        print("97")
        i = 63
    if i == 66:
        print("Fizz")
        i = 22
    if i == 67:
        print("68")
        i = 94
    if i == 68:
        print("76")
        i = 74
    if i == 69:
        print("94")
        i = 33
    if i == 70:
        print("83")
        i = 47
    if i == 71:
        print("Fizz")
        i = 73
    if i == 72:
        print("Fizz")
        i = 10
    if i == 73:
        print("4")
        i = 85
    if i == 74:
        print("77")
        i = 19
    if i == 75:
        print("89")
        i = 64
    if i == 76:
        print("Buzz")
        i = 51
    if i == 77:
        print("Buzz")
        i = 27
    if i == 78:
        print("Fizz")
        i = 49
    if i == 79:
        print("FizzBuzz")
        i = 50
    if i == 80:
        break
    if i == 81:
        print("19")
        i = 60
    if i == 82:
        print("Fizz")
        i = 65
    if i == 83:
        print("79")
        i = 89
    if i == 84:
        print("Buzz")
        i = 2
    if i == 85:
        print("Buzz")
        i = 7
    if i == 86:
        print("Buzz")
        i = 40
    if i == 87:
        print("Fizz")
        i = 100
    if i == 88:
        print("91")
        i = 98
    if i == 89:
        print("Buzz")
        i = 5
    if i == 90:
        print("67")
        i = 67
    if i == 91:
        print("14")
        i = 79
    if i == 92:
        print("8")
        i = 61
    if i == 93:
        print("29")
        i = 35
    if i == 94:
        print("Fizz")
        i = 57
    if i == 95:
        print("Buzz")
        i = 8
    if i == 96:
        print("FizzBuzz")
        i = 45
    if i == 97:
        print("Fizz")
        i = 86
    if i == 98:
        print("92")
        i = 38
    if i == 99:
        print("49")
        i = 36
    if i == 100:
        print("22")
        i = 41

round #32

submitted at
2 likes

guesses
comments 1
olus2000 *known at the time as [author of #1]

according to wiki this should be .txt instead


post a comment


entry.bf ASCII text
 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+
-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<
+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<
+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+
<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+
<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+<+-+<+-+<+-
+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-
+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-
+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+
-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+
-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+
<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+
<+-+<+-+<+-+-].[[]-][[]<<+-[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]-+-]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+
-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+
-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+
-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+
-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-][-]]][[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-][-]]][[+<+-+<+-+<+-+<+-+<+-+<+-+-][-]]][[+<+-+<+-+<+-+<+-+<+-
+-][-]]][[+<+-+<+-+<+-+<+-+-][-]]][[+<+-+<+-+<+-+-][-]]][[+<+-+<+-+-][-]]][[+<+-+-][-]]][[+-][-]]][[[]-][-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][
[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][
[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][+-[]-],+-+
-[]>-+-[[]>-][[[+<+-]<[+-+-]>][]<<+-+-[]<<+-++-][]>><+-+-]++-[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<
+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+
<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+
<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-
+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-
+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+<+-+<+
-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+
-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<
+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<
+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<
+-+-].[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+
<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+
<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-
+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[[]-][[]<<+-[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]-+-]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-
]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-
]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-
]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-][-]]][[+<+
-+<+-+<+-+<+-+<+-+<+-+<+-+-][-]]][[+<+-+<+-+<+-+<+-+<+-+<+-+-][-]]][[+<+-+<+-+<+-+<+-+<+-+-][-]]][[+<+-+<+-+<+-+<+-+-][-]]][[+<+-+<+-+<+-+-][-]]][[+<+-+<+-+-][-]]][[+<+-+-][-]]][[+-][-]]][[[]-][-]]][[
[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[
[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[
[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][+-[]-],+-+-[]>-+-[[]>-][[[+<+-]<[+-+-]>][]<<+-+-[]<<+-++-][]>><+-+-]++-[]>>[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+
<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+
<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-
+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-
+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+
-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+
-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<
+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<
+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+
<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+
-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[[]-][[]<<+
-[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]-+-]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[
[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[
[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[
[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[
[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-][-]]][[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-][-]]][[+<+-+<+-+<+-+<+-+<+-+<+-+-][-]]][[+<+-+<+-+<+-+<+-+<+-+-][-]]][[+<+-+<+-+<+-+<+-
+-][-]]][[+<+-+<+-+<+-+-][-]]][[+<+-+<+-+-][-]]][[+<+-+-][-]]][[+-][-]]][[[]-][-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-
]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-
]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][[[]-+-]]][+-[]-],+-+-[]>-+-[[]>-][[[+<+-]<[+-+
-]>][]<<+-+-[]<<+-++-][]>><+-+-]++-[[[[[[[[[[[]-+-]][[]-+-][-]][[]-+-][-]][[]-+-][-]][[]-+-][-]][[]-+-][-]][[]-+-][-]][[]-+-][-]][[]-+-][-]][[[]<<+-+-[[]-[[[]-+-]]][[[]>-[-]][[]<<+-++-[[]-+-]][]>><+-+
-[[-]]>>][]>><+-+-]++-][]>><+-+-[+[+-[[[]-+-]][]<<+-[[+]<+-[]<<+-[[[]-+-]][]<<+-[[[[[]-+-]][-]]>][]<<+-+-[[-]]>>][]<<+-+-[]>-]<+-+-[[[]-+-]][[[]-+-]][[[[]-+-]][[]>>+[[[-]]>>]<+-+-[[-]]>][]>>>>[+]<+-<+
-+-[]-[[-]]>][]>>><+-+-[]-[]>-]<+-[[[[]><+-]><+-]><+-[++-[[[]-+-]][>[]-[-]][]>><+-+-]<+-[>[]-[]>-][++-[]-[[[]<<+-+-[[]-[[[[]-+-]][[]-+-][-]]][[[]<<+-++-]<+-[[-]]>>][]>><+-+-]++-]<+-[][[[[[[[[[[[[]-+-]
][-][-]][[]-+-][-]][-][-]][-][-]][-][-]][[]-+-][-]][[]-+-][-]][[]-+-][-]][[[]<<+-]><+-+-[[]>-][[]>><+-+-[]-[][[[-]][[[]-+-]][]>><+-+-][]>>>><+-+-[[]>><+-++-]<+-[[-]]>>][]>><+-+-]++-][]>><+-+-[]<<+-[[[
]<<+-+-[[]-[[]-]][[[]<<+-++-+[[+<+-]<[+-+-]>][]<<+-+-]<+-[][[+<+-]<[+-+-]>][]>><+-+-][]>><+-+-]++-[[[]-+-]][+-[[[[[]-+-]]]<+-+-[]-][][]>><+-+-[[[-]]>>]><+-][]>><+-+-+-[+-[]-][[[[]<<+-+-[[]-][[[[[-]]>>
]><+-]><+-[]<<+-++-][]>><+-+-]++-]<+-][]>><+-+-[[-][[]<<+-]><+-[[[]-+-]][[]<<+-]><+-+[+-[+-[[[[]-+-]]][][]>><+-+-]<+-[]>>[[[]>>+<+-+-+-[[[]<<+-+-[[]-+-[[[[]-+-]]][[]>-][]>><+-+-][[]>><+-+-[>[]-[[[]-+-
]]][[]-[]<<<+-++-][]>><+-+-][]>><+-+-]++-]<+-[[]<<+-+-[[]-+-[[[[]-+-]]][[]>-][]>><+-+-][[]>><+-+-[>[]-[[[]-+-]]][[]-[]<<<+-++-][]>><+-+-][]>><+-+-]++-[]>>+<+-+-+-[[]-[-]][+-[]>><+-+-[]>><+-[[]<<+-+-[[
]-+-[[-]][[]-[[]-+-]][]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]>><+-++-][]>><+-+-][]>><+-+-]++-[>[]-[[]-+-]][[[]<<+-+-[[]-+-[[-]][[]-[[]-+-]][]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]>><+-++-][]>><+-+-][]>><+-+-]
++-][]>><+-+-][]>><+-+-]<+-[[+-[]-]<[+-++-]>><+-[]<<+-+[[]<<+-+-[]>>><+-[]>><+-[[]<<+-+-[[]-+-[[]-[]-[[[]-+-]]][[]>><+-[[]<<+-+-[[]-+-[[]>-[[[]-+-]]][[]-[]>><+-[[-]]>>][]>><+-+-][[]>><+-+-[>[]-[]>-[[[
]-+-]]][[[]<<<+-++-]<+-[[-]]>>][]>><+-+-][]>><+-+-]++-[[-]]>>][]>><+-+-][[]>><+-+-[>>>[]-[[[]-+-]]][[[]<<<+-++-]<+-[[-]]>>][]>><+-+-][]>><+-+-]++-]<+-][[]-[]>-][]>>><+-+-]++-[+-[][[[]>><+-+-[[]-[[[]-+
-]][]<<+-[[-]]>>][[]>>><+-[]>>+<+-+-+-[]>><+-+-[]>><+-[[]<<+-+-[[]-+-[[-]][[]-[[]-+-]][]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]>><+-++-][]>><+-+-][]>><+-+-]++-[>[]-[[]-+-]][[[]<<+-+-[[]-+-[[-]][[]-[[]-+-]]
[]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]>><+-++-][]>><+-+-][]>><+-+-]++-][]>><+-+-[[[]>><+-++-]><+-[[-]]>>][>[]-[>[]-[[]-+-]]<+-][]>><+-+-][]>><+-+-]++-][]>><+-+-]><+-]<+-+[+-[[[-]]>]<+-[]>>[[[]>>+<+-+-+-
[[[]<<+-+-[[]-+-[[[[]-+-]]][[]>-][]>><+-+-][[]>><+-+-[>[]-[[[]-+-]]][[]-[]<<<+-++-][]>><+-+-][]>><+-+-]++-]<+-[[]<<+-+-[[]-+-[[[[]-+-]]][[]>-][]>><+-+-][[]>><+-+-[>[]-[[[]-+-]]][[]-[]<<<+-++-][]>><+-+
-][]>><+-+-]++-[]>>+<+-+-+-[[]-[-]][+-[]>><+-+-[]>><+-[[]<<+-+-[[]-+-[[-]][[]-[[]-+-]][]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]>><+-++-][]>><+-+-][]>><+-+-]++-[>[]-[[]-+-]][[[]<<+-+-[[]-+-[[-]][[]-[[]-+-]]
[]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]>><+-++-][]>><+-+-][]>><+-+-]++-][]>><+-+-][]>><+-+-]<+-[[+-[]-]<[+-++-]>><+-[]<<+-+[[]<<+-+-[]>>><+-[]>><+-[[]<<+-+-[[]-+-[[]-[]-[[[]-+-]]][[]>><+-[[]<<+-+-[[]-+-[
[]>-[[[]-+-]]][[]-[]>><+-[[-]]>>][]>><+-+-][[]>><+-+-[>[]-[]>-[[[]-+-]]][[[]<<<+-++-]<+-[[-]]>>][]>><+-+-][]>><+-+-]++-[[-]]>>][]>><+-+-][[]>><+-+-[>>>[]-[[[]-+-]]][[[]<<<+-++-]<+-[[-]]>>][]>><+-+-][]
>><+-+-]++-]<+-][[]-[]>-][]>>><+-+-]++-[+-[][[[]>><+-+-[[]-[[[]-+-]][]<<+-[[-]]>>][[]>>><+-[]>>+<+-+-+-[]>><+-+-[]>><+-[[]<<+-+-[[]-+-[[-]][[]-[[]-+-]][]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]>><+-++-][]>>
<+-+-][]>><+-+-]++-[>[]-[[]-+-]][[[]<<+-+-[[]-+-[[-]][[]-[[]-+-]][]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]>><+-++-][]>><+-+-][]>><+-+-]++-][]>><+-+-[[[]>><+-++-]><+-[[-]]>>][>[]-[>[]-[[]-+-]]<+-][]>><+-+-]
[]>><+-+-]++-][]>><+-+-]><+-]<+-+[+-+-[[[[]-+-]]][][]>><+-+-[]>>[[[]>>+<+-+-+-[[[]<<+-+-[[]-+-[[[[]-+-]]][[]>-][]>><+-+-][[]>><+-+-[>[]-[[[]-+-]]][[]-[]<<<+-++-][]>><+-+-][]>><+-+-]++-]<+-[[]<<+-+-[[]
-+-[[[[]-+-]]][[]>-][]>><+-+-][[]>><+-+-[>[]-[[[]-+-]]][[]-[]<<<+-++-][]>><+-+-][]>><+-+-]++-[]>>+<+-+-+-[[]-[-]][+-[]>><+-+-[]>><+-[[]<<+-+-[[]-+-[[-]][[]-[[]-+-]][]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]
>><+-++-][]>><+-+-][]>><+-+-]++-[>[]-[[]-+-]][[[]<<+-+-[[]-+-[[-]][[]-[[]-+-]][]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]>><+-++-][]>><+-+-][]>><+-+-]++-][]>><+-+-][]>><+-+-]<+-[[+-[]-]<[+-++-]>><+-[]<<+-+[[
]<<+-+-[]>>><+-[]>><+-[[]<<+-+-[[]-+-[[]-[]-[[[]-+-]]][[]>><+-[[]<<+-+-[[]-+-[[]>-[[[]-+-]]][[]-[]>><+-[[-]]>>][]>><+-+-][[]>><+-+-[>[]-[]>-[[[]-+-]]][[[]<<<+-++-]<+-[[-]]>>][]>><+-+-][]>><+-+-]++-[[-
]]>>][]>><+-+-][[]>><+-+-[>>>[]-[[[]-+-]]][[[]<<<+-++-]<+-[[-]]>>][]>><+-+-][]>><+-+-]++-]<+-][[]-[]>-][]>>><+-+-]++-[+-[][[[]>><+-+-[[]-[[[]-+-]][]<<+-[[-]]>>][[]>>><+-[]>>+<+-+-+-[]>><+-+-[]>><+-[[]
<<+-+-[[]-+-[[-]][[]-[[]-+-]][]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]>><+-++-][]>><+-+-][]>><+-+-]++-[>[]-[[]-+-]][[[]<<+-+-[[]-+-[[-]][[]-[[]-+-]][]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]>><+-++-][]>><+-+-][]
>><+-+-]++-][]>><+-+-[[[]>><+-++-]><+-[[-]]>>][>[]-[>[]-[[]-+-]]<+-][]>><+-+-][]>><+-+-]++-][]>><+-+-]><+-]<+-+[+-[[-]]>[]>>[[[]>>+<+-+-+-[[[]<<+-+-[[]-+-[[[[]-+-]]][[]>-][]>><+-+-][[]>><+-+-[>[]-[[[]
-+-]]][[]-[]<<<+-++-][]>><+-+-][]>><+-+-]++-]<+-[[]<<+-+-[[]-+-[[[[]-+-]]][[]>-][]>><+-+-][[]>><+-+-[>[]-[[[]-+-]]][[]-[]<<<+-++-][]>><+-+-][]>><+-+-]++-[]>>+<+-+-+-[[]-[-]][+-[]>><+-+-[]>><+-[[]<<+-+
-[[]-+-[[-]][[]-[[]-+-]][]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]>><+-++-][]>><+-+-][]>><+-+-]++-[>[]-[[]-+-]][[[]<<+-+-[[]-+-[[-]][[]-[[]-+-]][]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]>><+-++-][]>><+-+-][]>><+-
+-]++-][]>><+-+-][]>><+-+-]<+-[[+-[]-]<[+-++-]>><+-[]<<+-+[[]<<+-+-[]>>><+-[]>><+-[[]<<+-+-[[]-+-[[]-[]-[[[]-+-]]][[]>><+-[[]<<+-+-[[]-+-[[]>-[[[]-+-]]][[]-[]>><+-[[-]]>>][]>><+-+-][[]>><+-+-[>[]-[]>-
[[[]-+-]]][[[]<<<+-++-]<+-[[-]]>>][]>><+-+-][]>><+-+-]++-[[-]]>>][]>><+-+-][[]>><+-+-[>>>[]-[[[]-+-]]][[[]<<<+-++-]<+-[[-]]>>][]>><+-+-][]>><+-+-]++-]<+-][[]-[]>-][]>>><+-+-]++-[+-[][[[]>><+-+-[[]-[[[
]-+-]][]<<+-[[-]]>>][[]>>><+-[]>>+<+-+-+-[]>><+-+-[]>><+-[[]<<+-+-[[]-+-[[-]][[]-[[]-+-]][]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]>><+-++-][]>><+-+-][]>><+-+-]++-[>[]-[[]-+-]][[[]<<+-+-[[]-+-[[-]][[]-[[]-+
-]][]>><+-+-][[]>><+-+-[>[]-[[]-+-]][[]>><+-++-][]>><+-+-][]>><+-+-]++-][]>><+-+-[[[]>><+-++-]><+-[[-]]>>][>[]-[>[]-[[]-+-]]<+-][]>><+-+-][]>><+-+-]++-][]>><+-+-]><+-]<+-[[]-[]>-][+[[[-]]>+[[]>><+-[[]
<<+-+-[>[]-][[[]<<+-+[[]<<+-+-[]>>><+-[]>><+-[[]<<+-+-[[]-+-[[]-[]-[[[]-+-]]][[]>><+-[[]<<+-+-[[]-+-[[]>-[[[]-+-]]][[]-[]>><+-[[-]]>>][]>><+-+-][[]>><+-+-[>[]-[]>-[[[]-+-]]][[[]<<<+-++-]<+-[[-]]>>][]>
><+-+-][]>><+-+-]++-[[-]]>>][]>><+-+-][[]>><+-+-[>>>[]-[[[]-+-]]][[[]<<<+-++-]<+-[[-]]>>][]>><+-+-][]>><+-+-]++-]<+-]><<+-++-][]>><+-+-]++-]<+-]<+-[]<<+-[]<<+-+-[]>>><+-[]>><+-[[]<<+-+-[[]-+-[[]-[]-[[
[]-+-]]][[]>><+-[[]<<+-+-[[]-+-[[]>-[[[]-+-]]][[]-[]>><+-[[-]]>>][]>><+-+-][[]>><+-+-[>[]-[]>-[[[]-+-]]][[[]<<<+-++-]<+-[[-]]>>][]>><+-+-][]>><+-+-]++-[[-]]>>][]>><+-+-][[]>><+-+-[>>>[]-[[[]-+-]]][[[]
<<<+-++-]<+-[[-]]>>][]>><+-+-][]>><+-+-]++-][]>>>>><+-+-]><+-]><+-[]>>><+-++-][]>>><+-+-]++-[[]<<+-+-[[]-][[[]<<+-+-[[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[]-][+-[[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+
<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].][[+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<
+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+<+-+-].[]-][]>><+-+-[]<<+-++-][]>><+-+-]++-[]<<+-++-][]>><+-+-]++-

round #31

submitted at
2 likes

guesses
comments 0

post a comment


entry.cc ASCII text
 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
#include <vector>
#include <unordered_set>


using namespace std;


vector<size_t> entry(vector<unordered_set<size_t>> week) {
    size_t factorial = 1;
    size_t encoded;
    bool flag;
    vector<size_t> guess;
    for (size_t i = 1; i <= week.size(); i++) {
        factorial *= i;
    }
    for (size_t i = 0; i < factorial; i++) {
        guess.clear();
        encoded = i;
        for (size_t j = 1; j <= week.size(); j++) {
            for (size_t k = 0; k < guess.size(); k++) {
                if (guess[k] >= encoded % j) gues[k]++;
            }
            guess.push_back(encoded % j);
            encoded /= j;
        }
        flag = true;
        for (size_t j = 0; j < guess.size(); j++) {
            if (!week[j].contains(guess[j])) {
                flag = false;
                break;
            }
        }
        if (flag) {
            return guess;
        }
    }
    return guess;
}

round #30

submitted at
0 likes

guesses
comments 0

post a comment


death.ndf ASCII text
 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
% // Code by SoundOfSpouting#6980 (UID: 151149148639330304)

GOOD_REDUCE IS TRANSFORMER f OPERATION I A {
    FOR B WITH A DO
        I := I f B;
    ENDFOR;
    I }


GOOD_ACCUMULATE IS TRANSFORMER f OPERATION I A {
    Accum := [];
    FOR B WITH A DO
        I Elt := I f B;
        Accum := Accum append Elt;
    ENDFOR;
    Accum }


enumerate IS OPERATION A { A EACHBOTH link count tally A }


step IS OPERATION A B {
    Letter1 Distance1 Distance12 := A;
    Letter2 Distance2 := B;
    Distance := min (Distance1 + 1) (Distance2 + 1)
                    (Letter1 unequal Letter2 + Distance12);
    [Letter1 Distance Distance2, Letter2 Distance] }


rowStep IS OPERATION Row B {
    Letter Number := B;
    Letter Number (Number - 1) GOOD_ACCUMULATE step Row }


entry IS OPERATION A B {
    last last ((enumerate A) GOOD_REDUCE rowStep (enumerate B)) }
death.py ASCII text
1
2
# // Code by SoundOfSpouting#6980 (UID: 151149148639330304)
entry = lambda _1, _2: 3

round #27

submitted at
1 like

guesses
comments 2
olus2000 *known at the time as [author of #8]

it works for arrays of up to 16 elements but can be easily extended to 255


razetime

woah holy shit


post a comment


leg.lua ASCII text
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
asm = [[
# load values to memory
label loadloop
add+I 0 IO mem
jle mem 1 not_max
add+I 0 adr 0
add+I 0 mem 1
label not_max
add+I 1 adr adr
jne+I 16 adr loadloop

# 0: max index (set while loading)
# 1: max height
# 2: water
# stack: tmp
# adr: adr
# mem: heights

# reset adr and max height
add+I+J 0 255 adr
add+I+J 0 0 1

label first_loop
add+I 1 adr adr
jeq adr 0 second_part
jgt mem 1 update_max_first
sub 1 mem stack
add 2 stack+pop 2
jeq+I+J 0 0 first_loop

label update_max_first
add+I 0 mem 1
jeq+I+J 0 0 first_loop

label second_part
add+I+J 0 16 adr
add+I+J 0 0 1

label second_loop
sub+J adr 1 adr
jeq adr 0 end
jgt mem 1 update_max_second
sub 1 mem stack
add 2 stack+pop 2
jeq+I+J 0 0 second_loop

label update_max_second
add+I 0 mem 1
jeq+I+J 0 0 second_loop

label end
add+I 0 2 IO
]]


codes = {
    
    jge = 0x25,
    jgt = 0x24,
    jle = 0x23,
    jlt = 0x22,
    jne = 0x21,
    jeq = 0x20,

    shl = 7,
    shr = 6,
    xor = 5,
    ["not"] = 4,
    ["or"]  = 3,
    ["and"] = 2,
    sub = 1,
    add = 0,

    I = 0x80,
    J = 0x40,
    jump = 0x20,

    stack = 3, pop = 8,
    adr   = 4,
    mem   = 5,
    IP    = 6,
    IO    = 7,

}


compile = function(asm)
    local no_coms = ""
    for l in asm:gmatch("[^\n]*") do
        if l:sub(1,1) ~= "#" then
            no_coms = no_coms .. " " .. l
        end
    end
    local iter = no_coms:gmatch("(%+?)([%w_]+)")
    local rom, labels, i = {}, {}, 0

    local plus, com = iter()
    while com do
        if com == "label" then
            plus, com = iter()
            labels[com] = labels[com] or {}
            labels[com].target = i
        else
            if plus ~= "+" then
                rom[i] = 0
                i = i + 1
            end
            if codes[com] then
                rom[i - 1] = rom[i - 1] + codes[com]
            elseif tonumber(com) then
                rom[i - 1] = rom[i - 1] + com
            else
                labels[com] = labels[com] or {}
                table.insert(labels[com], i - 1)
            end
        end
        plus, com = iter()
    end
    for k, v in pairs(labels) do
        for i = 1, #v do
            if v.target then
                rom[v[i]] = rom[v[i]] + v.target
            else
                print("A label without a target: "..k)
            end
        end
    end
    return rom
end


emulate = function(rom, input)
    local ram, stack, out = {}, {}, {}
    local ip, r0, r1, r2, adr = 0, 0, 0, 0, 0
    while rom[ip + 3] do
        local com, imm1, imm2, imm3 = rom[ip], rom[ip + 1], rom[ip + 2], rom[ip + 3]
        ip = ip + 4
        local regs = {[0] = r0, r1, r2, stack[#stack] or 0, adr, ram[adr] or 0, ip, input[1] or 0}
        local arg1, arg2, flag, ans
        if com & codes.I > 0 then
            arg1 = imm1
        else
            arg1 = regs[imm1 & 7]
        end
        if com & codes.J > 0 then
            arg2 = imm2
        else
            arg2 = regs[imm2 & 7]
        end
        if imm1 & 7 == 7 or imm2 & 7 == 7 and #input > 0
            then table.remove(input, 1) end
        if imm1 & 8 > 0 then table.remove(stack) end
        if com & codes.jump > 0 then
            if com & 7 == codes.jge & 7 then
                flag = arg1 >= arg2
            elseif com & 7 == codes.jgt & 7 then
                flag = arg1 > arg2
            elseif com & 7 == codes.jle & 7 then
                flag = arg1 <= arg2
            elseif com & 7 == codes.jlt & 7 then
                flag = arg1 < arg2
            elseif com & 7 == codes.jne & 7 then
                flag = arg1 ~= arg2
            elseif com & 7 == codes.jeq & 7 then
                flag = arg1 == arg2
            end
            if flag then ip = imm3 end
        else
            if com & 7 == codes.shl then
                ans = arg1 << arg2
            elseif com & 7 == codes.shr then
                ans = arg1 >> arg2
            elseif com & 7 == codes.xor then
                ans = arg1 ~ arg2
            elseif com & 7 == codes["not"] then
                ans = ~arg1
            elseif com & 7 == codes["or"] then
                ans = arg1 | arg2
            elseif com & 7 == codes["and"] then
                ans = arg1 & arg2
            elseif com & 7 == codes.sub then
                ans = arg1 - arg2
            elseif com & 7 == codes.add then
                ans = arg1 + arg2
            end
            ans = ans & 255
            if imm3 & 7 == 0 then r0 = ans
            elseif imm3 & 7 == 1 then r1 = ans
            elseif imm3 & 7 == 2 then r2 = ans
            elseif imm3 & 7 == 3 then table.insert(stack, ans)
            elseif imm3 & 7 == 4 then adr = ans
            elseif imm3 & 7 == 5 then ram[adr] = ans
            elseif imm3 & 7 == 6 then ip = ans
            elseif imm3 & 7 == 7 then table.insert(out, ans)
            end
        end
    end
    return out
end


entry = function(t) return emulate(compile(asm), t)[1] end

round #26

submitted at
0 likes

guesses
comments 0

post a comment


bad.c ASCII text, with CRLF line terminators
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
from dataclasses import dataclass, field
from typing import Optional


@dataclass
class Node:
    first : 'List'
    link : Optional['Node'] = None

@dataclass
class List:
    start : int
    len : int
    node : Optional[Node] = None
    next : Optional['List'] = None


def make_tree(s: str) -> Node:
    tree = Node(List(0, -1))
    cur = tree
    start = 0
    for b in range(len(s)):
        cur, start = extend(cur, start, b - start, s + '\x00')
    return tree


def find_l(node: Node, start: int, s1: str, s2: str) -> (List, bool):
    l = node.first
    while s1[l.start] != s2[start]:
        if l.next is None:
            return l, False
        l = l.next
    return l, True


def extend(node: Node, start: int, len: int, s: str) -> (Node, int):
    if len < 0: return node, start
    l, flag = find_l(node, start, s, s)
    if not flag:
        assert len == 0
        l.next = List(start, -1)
        l = l.next
    if l.node is None and len == l.len + 1:  # 1st
        l.start = start
        l.len = len
        next_node, next_start, next_len = next_node_start(node, start, len)
        extend(next_node, next_start, next_len, s)
        return node, start
    elif len > l.len:
        return extend(l.node, start + l.len + 1, len - l.len - 1, s)
    elif s[l.start + len] == s[start + len]:  # 3rd
        return node, start
    else:  # 2nd
        new_node = Node(List(start + len, 0, None,
                             List(l.start + len, l.len - len, l.node)))
        l.len = len - 1
        l.node = new_node
        next_node, next_start, next_len = next_node_start(node, start, len)
        new_node.link, new_start = extend(next_node, next_start, next_len, s)
        return new_node, new_start


def next_node_start(node: Node, start: int, len: int) -> (Node, int, int):
    if node.link:
        return node.link, start, len
    return node, start + 1, len - 1


def suffixes(node: Node, s: str):
    l = node.first
    while l is not None:
        if l.node is not None:
            yield from (s[l.start:l.start + l.len + 1] + i for i in suffixes(l.node, s))
        else:
            yield s[l.start:l.start + l.len + 1]
        l = l.next


def entry(s1, s2):
    node = make_tree(s1)
    best = ''
    match_len = 0
    len = 0
    start = 0
    for i, c in enumerate(s2):
        len += 1
        l, found = find_l(node, start, s1, s2)
        while start <= i and (not found or l.len < i - start or s1[l.start + i - start] != c):
            if not found or l.node is None or l.len >= i - start and s1[l.start + i - start] != c:
                node, start, _ = next_node_start(node, start, 0)
                len -= 1
            else:
                node = l.node
                start += l.len + 1
            if start > i:
                break
            l, found = find_l(node, start, s1, s2)
        if len > match_len:
            best = s2[i + 1 - len:i + 1]
            match_len = len
    return best

round #24

submitted at
2 likes

guesses
comments 1
olus2000 *known at the time as [author of #3]

Oh for fucks sake. Feature request: preview which files I uploaded before stage 2 starts.


post a comment


Ef_sharp.fsx ASCII text
 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
(* // Code by SoundOfSpouting#6980 (UID: 151149148639330304) *)

(* The constructor is `Entry` instead of `Entry()`, otherwise as required *)

type Color = Red | Black

type Entry<'Key, 'Value when 'Key: comparison> =
    | Empty
    | Tree of smaller: Entry<'Key, 'Value> * key: 'Key * value: 'Value
            * bigger: Entry<'Key, 'Value> * color: Color

    member this.TryFind (key: 'Key) : 'Value option =
        match this with
        | Empty -> None
        | Tree (s, k, v, b, _) ->
            if k = key then
                Some v
            else
                if key > k then b.TryFind key
                else s.TryFind key
    
    member this.Add (key : 'Key) (value: 'Value) : Entry<'Key, 'Value> =
        match this.ChildAdd key value with
        | Tree (s, k, v, b, Red) -> Tree (s, k, v, b, Black)
        | other -> other

    member private this.ChildAdd (key : 'Key) (value: 'Value) : Entry<'Key, 'Value> =
        match this with
        | Empty -> Tree (Empty, key, value, Empty, Red)
        | Tree (s, k, v, b, c) ->
            if k = key then Tree (s, key, value, b, c) else
            ( if key > k then Tree (s, k, v, b.ChildAdd key value, c)
              else Tree (s.ChildAdd key value, k, v, b, c) ).rebalance
    
    member private this.rebalance : Entry<'Key, 'Value> =
        match this with
        | Tree (Tree (Tree (a, x, xv, b, Red), y, yv, c, Red), z, zv, d, Black)
        | Tree (Tree (a, x, xv, Tree (b, y, yv, c, Red), Red), z, zv, d, Black)
        | Tree (a, x, xv, Tree (Tree (b, y, yv, c, Red), z, zv, d, Red), Black)
        | Tree (a, x, xv, Tree (b, y, yv, Tree (c, z, zv, d, Red), Red), Black) ->
            Tree (Tree (a, x, xv, b, Black), y, yv, Tree(c, z, zv, d, Black), Red)
        | other -> other
Husk_L.hs ASCII text, with no line terminators
1
-- // Code by SoundOfSpouting#6980 (UID: 151149148639330304)
Oh_camel.cma ASCII text
 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
(* // Code by SoundOfSpouting#6980 (UID: 151149148639330304) *)

module type OrderedType =
  sig
    type t
    val compare: t -> t -> int
  end

module type S =
  sig
    type key
    type +'a t
    val empty: 'a t
    val find_opt: key -> 'a t -> 'a option
    val add: key -> 'a -> 'a t -> 'a t
  end

module Make(Ord: OrderedType) = struct
    type key = Ord.t
    type 'a t = (key * 'a) list
    let empty = []
    let rec find_opt x = function
        [] -> None
      | (k, v) :: r ->
          let c = Ord.compare x k in
          if c = 0 then Some v
          else find_opt x r
    let add x data assoc = (x, data) :: assoc
  end
Pi_thone.py ASCII text
1
2
3
4
5
# // Code by SoundOfSpouting#6980 (UID: 151149148639330304)

class Entry(dict):
		def insert(self, key, val):
				self[key] = val

round #23

submitted at
0 likes

guesses
comments 3
razetime

Lyric has done this exact same thing before but without comments in cg #16 i think


olus2000

I'm sorry for this. I wanted to do something in APL but learning APL in one week while working didn't work out.


razetime

well you bamboozled me so good on you


post a comment


pure.hs ASCII text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
-- Code by SoundOfSpouting#6980 (UID: 151149148639330304)


entry = bigdiv -- Pointfree!!


bigdiv :: [Double] -> [Double] -> ([Double], [Double])
bigdiv [] _ = ([], [])
bigdiv (head : tail) b = do
    let (div, temp_mod) = bigdiv tail b
    let (x, mod) = smalldiv (head : temp_mod) b
    (x : div, mod)


smalldiv :: [Double] -> [Double] -> (Double, [Double])
smalldiv [] _ = (0, [])
smalldiv x [] = smalldiv x [0] -- Spot the zero division
smalldiv [a] [b] = (a/b, [])
smalldiv (a : ta) (b : tb) = do
    let (q, mod) = smalldiv ta tb
    (q, a - q * b : mod)

round #22

submitted at
3 likes

guesses
comments 0

post a comment


line_draw.asm magic text fragment for file(1) cmd, 1st line "#-------------------------------------------------------------------------------", 2nd line "#author: SoundOfSpouting#6980 (UID: 151149148639330304)"
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
#-------------------------------------------------------------------------------
#author: SoundOfSpouting#6980 (UID: 151149148639330304)
#date : 2022.08.12
#description : example RISC V program for drawing a line on a BMP file 
#-------------------------------------------------------------------------------

# Recommended use with RARS simulator
# Assumes a simple RGB 24bpp .bmp image
# Coordinates originate from bottom left

# for purpose of this example I define structure which will contain important
# bitmap data for image read from the bmp file. Its C definition could be:
#	struct {
#		char* filename;		// pointer to file name
#		unsigned char* hdrData; // pointer to BMP header buffer
#		unsigned char* imgData; // pointer to the first picture pixel in memory
#		int width, height;	// width and height in pixels
#		int linebytes;		// size of a line (in bytes)
#	} imgInfo;

.eqv ImgInfo_fname	0
.eqv ImgInfo_hdrdat 	4
.eqv ImgInfo_imdat	8
.eqv ImgInfo_width	12
.eqv ImgInfo_height	16
.eqv ImgInfo_lbytes	20

.eqv MAX_IMG_SIZE 	230400 # 320 x 240 x 3 (pixels) 

# more information about bmp format: https://en.wikipedia.org/wiki/BMP_file_format
.eqv BMPHeader_Size 54
.eqv BMPHeader_width 18
.eqv BMPHeader_height 22


# line is a structure which contains coordinaes of the line's ends and its color:
# 	struct {
#		int x1, y1, x2, y2;
#		char r, g, b;
#	} line

.eqv Line_x1	0
.eqv Line_y1	4
.eqv Line_x2	8
.eqv Line_y2	12
.eqv Line_0rgb	16
.eqv Line_b	16
.eqv Line_g	17
.eqv Line_r	18
.eqv Line_0	19


.eqv system_OpenFile	1024
.eqv system_ReadFile	63
.eqv system_WriteFile	64
.eqv system_CloseFile	57
.eqv system_Exit	10
.eqv system_PrintChar	11
.eqv system_ReadInt	5
.eqv system_ReadStr	8
.eqv system_PrintStr	4

.macro exit
	li a7, system_Exit
	ecall
.end_macro

.macro print (%string_addr)
	la a0, %string_addr
	li a7, system_PrintStr
	ecall
.end_macro

.macro input (%buff_addr, %buff_size)
	la a0, %buff_addr
	li a1, %buff_size
	li a7, system_ReadStr
	ecall
	li a3, 10
find_endl:
	lb a2, (a0)
	beq a2, a3, found_endl
	addi a0, a0, 1
	addi a1, a1, -1
	bgt a1, zero, find_endl
	j end_input
found_endl:
	sb zero, (a0)
end_input:
.end_macro

.macro int_input
	li a7, system_ReadInt
	ecall
.end_macro

.macro error (%message_addr)
	print %message_addr
	exit
.end_macro

		.data
imgInfo:	.space 24		# image descriptor

		.align 2
dummy:		.space 2
bmpHeader:	.space BMPHeader_Size

		.align 2
imgData: 	.space MAX_IMG_SIZE

		.align 2
line:		.space 20  # One 0 byte to make loading 0RGB values possible


ifname:		.space 64
ofname: 	.space 64

iprompt:	.asciz "Input file > "
oprompt:	.asciz "Output file > "
lineprompt:	.asciz "coordinates of line in separate lines (x1, y1, x2, y2):\n"
colorprompt:	.asciz "color of the line in separate lines (r, g, b):\n"

openError:	.asciz "Error reading file\n"

		.text
main:
	# Getting the input file name
	print iprompt
	input ifname 64

	# filling the image descriptor
	la a0, imgInfo 
	la t0, ifname
	sw t0, ImgInfo_fname(a0)
	la t0, bmpHeader
	sw t0, ImgInfo_hdrdat(a0)
	la t0, imgData
	sw t0, ImgInfo_imdat(a0)
	jal read_bmp
	beqz a0, read_success
	print openError
	j main

read_success:
	# Get the output file name and line
	print oprompt
	input ofname 64
	
	la a1, line
	print lineprompt
	int_input
	sw a0, Line_x1(a1)
	int_input
	sw a0, Line_y1(a1)
	int_input
	sw a0, Line_x2(a1)
	int_input
	sw a0, Line_y2(a1)
	print colorprompt
	sb zero, Line_0(a1)
	int_input
	sb a0, Line_r(a1)
	int_input
	sb a0, Line_g(a1)
	int_input
	sb a0, Line_b(a1)
	
	la a0, imgInfo
	la a1, line
	jal draw_line

	la a0, imgInfo
	la t0, ofname
	sw t0, ImgInfo_fname(a0)
	jal save_bmp
	exit

#============================================================================
# read_bmp: 
#	reads the content of a bmp file into memory
# arguments:
#	a0 - address of image descriptor structure
#		input filename pointer, header and image buffers should be set
# return value: 
#	a0 - 0 if successful, error code in other cases
read_bmp:
	mv t0, a0	# preserve imgInfo structure pointer
	
#open file
	li a7, system_OpenFile
	lw a0, ImgInfo_fname(t0)	#file name 
	li a1, 0			#flags: 0-read file
	ecall
	
	blt a0, zero, rb_error
	mv t1, a0			# save file handle for the future
	
#read header
	li a7, system_ReadFile
	lw a1, ImgInfo_hdrdat(t0)
	li a2, BMPHeader_Size
	ecall
	
#extract image information from header
	lw a0, BMPHeader_width(a1)
	sw a0, ImgInfo_width(t0)
	
	# compute line size in bytes - bmp line has to be multiple of 4
	add a2, a0, a0
	add a0, a2, a0	# pixelbytes = width * 3 
	addi a0, a0, 3
	srai a0, a0, 2
	slli a0, a0, 2	# linebytes = ((pixelbytes + 3) / 4 ) * 4
	sw a0, ImgInfo_lbytes(t0)
	
	lw a0, BMPHeader_height(a1)
	sw a0, ImgInfo_height(t0)

#read image data
	li a7, system_ReadFile
	mv a0, t1
	lw a1, ImgInfo_imdat(t0)
	li a2, MAX_IMG_SIZE
	ecall

#close file
	li a7, system_CloseFile
	mv a0, t1
    ecall
	
	mv a0, zero
	jr ra
	
rb_error:
	li a0, 1	# error opening file	
	jr ra
	
# ============================================================================
# save_bmp - saves bmp file stored in memory to a file
# arguments:
#	a0 - address of ImgInfo structure containing description of the image`
# return value: 
#	a0 - zero if successful, error code in other cases

save_bmp:
	mv t0, a0			# preserve imgInfo structure pointer
	
#open file
	li a7, system_OpenFile
	lw a0, ImgInfo_fname(t0)	#file name 
	li a1, 1			#flags: 1-write file
	ecall
	
	blt a0, zero, wb_error
	mv t1, a0			# save file handle for the future
	
#write header
	li a7, system_WriteFile
	lw a1, ImgInfo_hdrdat(t0)
	li a2, BMPHeader_Size
	ecall
	
#write image data
	li a7, system_WriteFile
	mv a0, t1
	# compute image size (linebytes * height)
	lw a2, ImgInfo_lbytes(t0)
	lw a1, ImgInfo_height(t0)
	mul a2, a2, a1
	lw a1, ImgInfo_imdat(t0)
	ecall

#close file
	li a7, system_CloseFile
	mv a0, t1
    ecall
	
	mv a0, zero
	jr ra
	
wb_error:
	li a0, 2 # error writing file
	jr ra


# ============================================================================
# set_pixel - sets the color of specified pixel
#arguments:
#	a0 - address of ImgInfo image descriptor
#	a1 - x coordinate
#	a2 - y coordinate - (0,0) - bottom left corner
#	a3 - 0RGB - pixel color
#return value: none
#remarks - a0, a1, a2 values are left unchanged

set_pixel:
	lw t1, ImgInfo_lbytes(a0)
	mul t1, t1, a2  # t1 = y * linebytes
	add t0, a1, a1
	add t0, t0, a1 	# t0 = x * 3
	add t0, t0, t1  # t0 is offset of the pixel

	lw t1, ImgInfo_imdat(a0) # address of image data
	add t0, t0, t1 	# t0 is address of the pixel
	
	#set new color
	sb   a3,(t0)		#store B
	srli a3, a3, 8
	sb   a3, 1(t0)		#store G
	srli a3, a3, 8
	sb   a3, 2(t0)		#store R

	jr ra


# ============================================================================

.macro swap (%line_reg, %t1, %t2)
	lw %t1, Line_x1(%line_reg)
	lw %t2, Line_x2(%line_reg)
	sw %t1, Line_x2(%line_reg)
	sw %t2, Line_x1(%line_reg)
	lw %t1, Line_y1(%line_reg)
	lw %t2, Line_y2(%line_reg)
	sw %t1, Line_y2(%line_reg)
	sw %t2, Line_y1(%line_reg)
.end_macro

# ============================================================================
# draw_line - draws a line of a given color between two points
# arguments:
#	a0 - address of ImgInfo image descriptor
#	a1 - addres of Line descriptor
# return values:
#	none
# remarks:
#	assumes that line coords are within the image
#       uses the fact that set_pixel only changes t0 and t1

draw_line:
	addi sp, sp, -8
	sw ra, 4(sp)
	sw s1, 0(sp)
	mv s1, a1
	
	lw t4, Line_x1(s1)
	lw t2, Line_x2(s1)
	sub t4, t2, t4
	lw t5, Line_y1(s1)
	lw t2, Line_y2(s1)
	sub t5, t2, t5

	sltz t2, t4
	add t2, t2, t2
	addi t2, t2, -1
	sub t4, t4, t2		# Actually aim for one pixel off diagonally
	mul t2, t2, t4
	sltz t3, t5
	add t3, t3, t3
	addi t3, t3, -1
	sub t5, t5, t3		# This will make the line have nicer shape
	mul t3, t3, t5
	bgt t2, t3, along_y

along_x:
	bgtz t4, along_x_after_swap
	swap s1, t0, t1
	sub t4, zero, t4
	sub t5, zero, t5
along_x_after_swap:
	lw a1, Line_x1(s1)
	lw t2, Line_y1(s1)
	li t3, 0

along_x_loop:
	mul a2, t5, t3
	div a2, a2, t4
	add a2, a2, t2
	lw a3, Line_0rgb(s1)
	jal set_pixel
	addi a1, a1, 1
	addi t3, t3, 1
	blt t3, t4, along_x_loop
	j line_ret

along_y:
	bgtz t5, along_y_after_swap
	swap s1, t2, t3
	sub t4, zero, t4
	sub t5, zero, t5
along_y_after_swap:
	lw t2, Line_x1(s1)
	lw a2, Line_y1(s1)
	li t3, 0

along_y_loop:
	mul a1, t4, t3
	div a1, a1, t5
	add a1, a1, t2
	lw a3, Line_0rgb(s1)
	jal set_pixel
	addi a2, a2, 1
	addi t3, t3, 1
	blt t3, t5, along_y_loop
	
line_ret:
	lw s1, 0(sp)
	lw ra, 4(sp)
	addi sp, sp, 8
	jr ra

round #21

submitted at
5 likes

guesses
comments 0

post a comment


Kestrel.c ASCII text
 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
// ca.c
#include <stddef.h>

#define written_by char
#define with_help_from size_t
#define impersonating void

#define and while
#define think_like return
#define uh for
#define m if
#define k else



written_by *SoundOfSpouting;
with_help_from RocketRace;
with_help_from LyricLy;


impersonating ISO_4683_1(with_help_from Razetime, with_help_from firecubez, written_by LyricLy) {
    SoundOfSpouting[Razetime + firecubez * RocketRace] = SoundOfSpouting[Razetime + firecubez * RocketRace] % 3 + 3 * LyricLy;
}

impersonating firecubez(with_help_from ISO_4683_1, with_help_from Razetime) {
    SoundOfSpouting[ISO_4683_1 + Razetime * RocketRace] = SoundOfSpouting[ISO_4683_1 + Razetime * RocketRace] / 3;
}

written_by Palaiologos(with_help_from no_one, with_help_from she_is_self_sufficient) {
    think_like no_one >= RocketRace || she_is_self_sufficient >= LyricLy ? 0 : SoundOfSpouting[no_one + she_is_self_sufficient * RocketRace] % 3;
}

written_by Razetime(with_help_from deadbraincoral, with_help_from GNU_Radio_Shows) {
    think_like Palaiologos(deadbraincoral - 1, GNU_Radio_Shows) > 1 || Palaiologos(deadbraincoral, GNU_Radio_Shows - 1) > 1
        || Palaiologos(deadbraincoral + 1, GNU_Radio_Shows) > 1 || Palaiologos(deadbraincoral, GNU_Radio_Shows + 1) > 1 ? 2 : 0;
}

written_by olus2000() {
    written_by Razetime = 0;
    uh (with_help_from IFcoltransG = 0; IFcoltransG < RocketRace; IFcoltransG++)
        uh (with_help_from deadbraincoral = 0; deadbraincoral < LyricLy; deadbraincoral++) {
            firecubez(IFcoltransG, deadbraincoral);
            m (Palaiologos(IFcoltransG, deadbraincoral) > 1)
                Razetime = 1;
        }
    think_like Razetime;
}

impersonating Hildegunst_Taillemythes() {
    uh (with_help_from olus2000 = 0; olus2000 < RocketRace; olus2000++)
        uh (with_help_from gollark = 0; gollark < LyricLy; gollark++) {
            m (Palaiologos(olus2000, gollark) == 0) {
                m (Razetime(olus2000, gollark))
                    ISO_4683_1(olus2000, gollark, 2);
            } k ISO_4683_1(olus2000, gollark, 1);
        }
}

impersonating entry(written_by *Palaiologos, with_help_from ISO_4683_1, with_help_from Pyrotelekinetic, with_help_from Haru, with_help_from firecubez) {
    SoundOfSpouting = Palaiologos;
    RocketRace = ISO_4683_1;
    LyricLy = Pyrotelekinetic;
    SoundOfSpouting[Haru + firecubez * RocketRace] = 2;
    do Hildegunst_Taillemythes();
    and (olus2000());
}

round #20

submitted at
3 likes

guesses
comments 0

post a comment


tictactoe.lua ASCII text
  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
---- Environment ----

data_s, return_s, dip_s, current, ip = {}, {}, {}, {}, 1


---- Operators ----

function nop () end

function drop ()
    table.remove(data_s)
end

function dup ()
    table.insert(data_s, data_s[#data_s])
end

function over ()
    table.insert(data_s, data_s[#data_s-1])
end

function swap ()
    data_s[#data_s-1], data_s[#data_s]
    = data_s[#data_s], data_s[#data_s-1]
end

function rot ()
    data_s[#data_s-2], data_s[#data_s-1], data_s[#data_s]
    = data_s[#data_s-1], data_s[#data_s], data_s[#data_s-2]
end

function dip ()
    local v = current[ip]
    ip = ip + 1
    table.insert(return_s, {current, ip})
    table.insert(return_s, {{undip}, 1})
    table.insert(dip_s, table.remove(data_s))
    current, ip = v, 1
end

function undip ()
    table.insert(data_s, table.remove(dip_s))
end

function op_not ()
    table.insert(data_s, not table.remove(data_s))
end

function suc ()
    table.insert(data_s, table.remove(data_s) + 1)
end

function add ()
    table.insert(data_s, table.remove(data_s) + table.remove(data_s))
end

function mul ()
    table.insert(data_s, table.remove(data_s) * table.remove(data_s))
end

function eq ()
    table.insert(data_s, table.remove(data_s) == table.remove(data_s))
end

function cat ()
    local v2, v1 = table.remove(data_s), table.remove(data_s)
    table.insert(data_s, v1 .. v2)
end

function get ()
    table.insert(data_s, table.remove(data_s)[table.remove(data_s)])
end

function set ()
    local v = table.remove(data_s)
    table.remove(data_s)[table.remove(data_s)] = v
end

function to_list ()
    local s, v = table.remove(data_s), {}
    for i = 1, #s do
        table.insert(v, s:sub(i, i))
    end
    table.insert(data_s, v)
end

function new_list ()
    table.insert(data_s, {})
end

function length ()
    table.insert(data_s, #table.remove(data_s))
end

function random ()
    table.insert(data_s, math.random(table.remove(data_s)))
end

function iff ()
    if not table.remove(data_s) then
        ip = ip + 2
    end
end

function elsef ()
    ip = ip + 1
end

function op_while ()
    if not table.remove(data_s) then
        ip = #current + 1
    end
end

function again ()
    ip = 1
end

function dump ()
    print(l_to_s(data_s))
end


---- Words ----

-- ( x y -- x y x y )
dup2 = {
    over, over
}

-- ( x y -- y )
nip = {
    swap, drop
}

-- ( -- value )
x = 1
o = -1
empty = 0

-- ( n -- bool )
not_zero = {
    0, eq, op_not,
}

-- ( value -- bool )
not_empty = not_zero

-- ( -- position )
random_position = {
    9, random
}

-- ( sign -- value )
from_sign = {
    dup, 'x', eq, iff,
    { drop, x }, elsef,
    { dup, 'o', eq, iff,
      { drop, o }, elsef,
      { dup, '.', eq, iff,
        { drop, empty }, elsef,
        { drop, false } } }
}

-- ( value -- sign )
to_sign = {
    dup, x, eq, iff,
    drop, 'x',
    dup, o, eq, iff,
    drop, 'o',
    dup, empty, eq, iff,
    drop, '.'
}
-- ( prev a b c -- next )
row_winner = {
    add, add, dup,
    x, 3, mul, eq, iff,
    { nip, x, swap }, nop,
    o, 3, mul, eq, iff,
    { drop, o }
}

-- ( board -- sign ) hideous but works
winner = {
    empty, swap,
    1, over, get, swap,
    2, over, get, swap,
    3, over, get, swap,
    dip, row_winner,
    4, over, get, swap,
    5, over, get, swap,
    6, over, get, swap,
    dip, row_winner,
    7, over, get, swap,
    8, over, get, swap,
    9, over, get, swap,
    dip, row_winner,
    1, over, get, swap,
    4, over, get, swap,
    7, over, get, swap,
    dip, row_winner,
    2, over, get, swap,
    5, over, get, swap,
    8, over, get, swap,
    dip, row_winner,
    3, over, get, swap,
    6, over, get, swap,
    9, over, get, swap,
    dip, row_winner,
    1, over, get, swap,
    5, over, get, swap,
    9, over, get, swap,
    dip, row_winner,
    3, over, get, swap,
    5, over, get, swap,
    7, over, get, swap,
    dip, row_winner,
    drop
}

-- ( board -- move true | false ) TODO
can_win = {
    dip, { false, 1 },
    { dup2, get,
      empty, eq, iff,
      { dup2, x, set,
        dup, winner, x, eq, iff,
        { dup2, empty, set, dip,
          { nip, true, 9 } },
        elsef, { dup2, empty, set } },
      nop,
      over, 9, eq, op_not, op_while,
      swap, suc, swap, again },
    drop, drop
}

-- ( board -- move true | false ) TODO
can_loose = {
    dip, { false, 1 },
    { dup2, get,
      empty, eq, iff,
      { dup2, o, set,
        dup, winner, o, eq, iff,
        { dup2, empty, set, dip,
          { nip, true, 9 } },
        elsef, { dup2, empty, set } },
      nop,
      over, 9, eq, op_not, op_while,
      swap, suc, swap, again },
    drop, drop
}

-- ( board -- board )
random_move = {
    { random_position,
      dup2, swap, get,
      not_empty, op_while,
      drop, again },
    over, x, set
}

-- ( board_str -- board )
parse_board = {
    to_list, new_list, swap, 1,
    { over, length, suc, over,
      eq, op_not, op_while,
      dup2, swap, get, from_sign,
      dup, iff,
      { swap, dip,
        { dip,
          { over, dup, length,
            suc, swap }, set } },
      elsef, { drop },
      suc, again },
    drop, drop
}


-- ( board -- board )
make_move = {
    dup, can_win, iff,
    { over, x, set }, elsef,
    { dup, can_loose, iff,
      { over, x, set }, elsef,
      { random_move } }
}

-- ( board -- board_str )
encode_board = {
    '', swap, 1,
    { dup, 10, eq, op_not, op_while,
      dup2, swap, get, to_sign,
      swap, dip,
      { rot, swap, cat, swap },
      suc, again },
    drop, drop
}

-- ( board_str -- board_str )
tictactoe = {
    parse_board,
    make_move,
    encode_board
}


---- Interpreter ----

function eval (word)
    return_s, ip, current = {}, 1, word
    while true do
        -- return from any finished threads
        while ip > #current do
            if #return_s == 0 then
                return
            else
                current, ip = table.unpack(table.remove(return_s))
            end
        end
        -- get current command
        com = current[ip]
        ip = ip + 1
        -- execute command
        if type(com) == 'function' then
            com()
        elseif type(com) == 'table' then
            table.insert(return_s, {current, ip})
            current, ip = com, 1
        else
            table.insert(data_s, com)
        end
    end
end


function better_entry (s)
    data_s = {s}
    eval(tictactoe)
    return table.remove(data_s)
end


---- Helpers ----

function l_to_s (l, d)
    d = d or 3 -- how deep will the printing go
    ans = '['
    for i = 1, #l do
        if type(l[i]) == 'function' then
            ans = ans .. ' [op]'
        elseif type(l[i]) == 'table' then
            if d > 0 then
                ans = ans .. ' ' .. l_to_s(l[i], d - 1)
            else
                ans = ans .. ' [...]'
            end
        else
            ans = ans .. ' ' .. tostring(l[i])
        end
    end
    return ans .. ' ]'
end

function print_stack ()
    print(l_to_s(data_s))
end


---- Dumb version ----

function bad_entry (s)
    local answer, moved, cell = '', false
    for i = 1, #s do
        cell = s:sub(i, i)
        if cell == '.' and not moved then
            cell = 'x'
            moved = true
        end
        answer = answer .. cell
    end
    return answer
end


---- Entry ----

entry = better_entry