previndexinfonext

code guessing, round #22 (completed)

started at ; stage 2 at ; ended at

specification

while I suck at painting, Calico sucks at drawing. your challenge is to draw a line. submissions can be written in python or any language that first appeared in the last 12 years (from 2010 onwards).

write something that draws a line between two points on some canvas. the exact slope of the line is left unspecified.

for example, a line of O between points A and B might be drawn like so:

::|::::)::::
::|:):::::A:
::|##:::):::
::|::##:::::
:B|::):##:):
::|::::::##:

     |
     |
     V

::|::::)::::
::|:)::::OO:
::|##:OOO:::
::|OOO#:::::
:OO::):##:):
::|::::::##:

your challenge is to do one of the following: the result should then be returned or displayed. due to the wide selection of languages available, there is no fixed API.

results

  1. 👑 Palaiologos +4 -2 = 2
    1. olus2000
    2. Tæmt modʒiɹæ (was Olivia)
    3. IFcoltransG
    4. Edgex42 (was Tæmt modʒiɹæ)
    5. Olivia (was Edgex42)
    6. LyricLy
    7. razetime
  2. Tæmt modʒiɹæ +2 -1 = 1
    1. Olivia (was olus2000)
    2. razetime (was Olivia)
    3. LyricLy (was IFcoltransG)
    4. Edgex42
    5. IFcoltransG (was LyricLy)
    6. olus2000 (was razetime)
    7. Palaiologos
  3. LyricLy +2 -2 = 0
    1. Palaiologos (was olus2000)
    2. Olivia
    3. olus2000 (was IFcoltransG)
    4. Tæmt modʒiɹæ
    5. IFcoltransG (was Edgex42)
    6. Edgex42 (was razetime)
    7. razetime (was Palaiologos)
  4. Olivia +1 -1 = 0
    1. Palaiologos (was olus2000)
    2. Tæmt modʒiɹæ (was IFcoltransG)
    3. Edgex42 (was Tæmt modʒiɹæ)
    4. LyricLy (was Edgex42)
    5. IFcoltransG (was LyricLy)
    6. razetime
    7. olus2000 (was Palaiologos)
  5. Edgex42 +1 -1 = 0
    1. Palaiologos (was olus2000)
    2. razetime (was Olivia)
    3. Tæmt modʒiɹæ (was IFcoltransG)
    4. Olivia (was Tæmt modʒiɹæ)
    5. LyricLy
    6. olus2000 (was razetime)
    7. IFcoltransG (was Palaiologos)
  6. olus2000 +1 -1 = 0
    1. Edgex42 (was Olivia)
    2. LyricLy (was IFcoltransG)
    3. IFcoltransG (was Tæmt modʒiɹæ)
    4. Tæmt modʒiɹæ (was Edgex42)
    5. razetime (was LyricLy)
    6. Olivia (was razetime)
    7. Palaiologos
  7. IFcoltransG +0 -1 = -1
    1. razetime +0 -2 = -2
      1. Palaiologos (was olus2000)
      2. Tæmt modʒiɹæ (was Olivia)
      3. Edgex42 (was IFcoltransG)
      4. IFcoltransG (was Tæmt modʒiɹæ)
      5. LyricLy (was Edgex42)
      6. Olivia (was LyricLy)
      7. olus2000 (was Palaiologos)

    entries

    you can download all the entries

    entry #1

    written by olus2000
    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
    

    entry #2

    written by Olivia
    submitted at
    2 likes

    guesses
    comments 0

    post a comment


    Draw a line.wld data
    Line.plr data

    entry #3

    written by IFcoltransG
    submitted at
    1 like

    guesses
    comments 0

    post a comment


    vice.py ASCII text, with CRLF line terminators
    1
    2
    3
    4
    5
    6
    7
    8
    9
    def entry(p1: tuple[int, int, int, int], p2: tuple[int, int, int, int], a: list[list[list[list[str]]]], chr: str) -> list[list[list[list[str]]]]:
        # draw line somewhere between points
        p3 = tuple((one+two) // 2 for one, two in zip(p1, p2))
        b = a
        for c in p3[:3]:
            b = b[c]
        b[p3[3]] = chr
        b[p3[3]-1] = chr
        return a
    

    entry #4

    written by Tæmt modʒiɹæ
    submitted at
    1 like

    guesses
    comments 0

    post a comment


    e.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
    input = {
        "grid": "::|::::)::::\n::|:):::::A:\n::|##:::):::\n::|::##:::::\n:B|::):##:):\n::|::::::##:",
        "p1": [10, 1], # points index top left
        "p2": [1, 4], # points index top left
        "char": "0"
    }
    
    # code starts here
    
    tempgrid = [[str(j) for j in i] for i in input["grid"].split("\n")]
    wid = len(tempgrid[0])
    hei = len(tempgrid)
    grid = {}
    
    for x in range(wid):
        for y in range(hei):
            grid.update({f"{x},{y}":tempgrid[y][x]})
    
    p1 = input["p1"]
    p2 = input["p2"]
    drawChar = input["char"]
    
    itools = __import__("itertools")
    e = [
        (x0:=p1[0]),
        (y0:=p1[1]),
        (x1:=p2[0]),
        (y1:=p2[1]),
        (dx:=abs(x1-x0)),
        (sx:=1 if x0 < x1 else -1),
        (dy:=-abs(y1-y0)),
        (sy:=1 if y0 < y1 else -1),
        (error:=dx+dy),
        [
            [
                (grid.update({f"{x0},{y0}":drawChar})),
                (
                    (
                        (e2:=2*error),
                        [
                            [
                                (error:=error+dy),
                                (x0:=x0+sx)
                            ] if x0 != x1 and e2 >= dy else None
                        ],
                        [
                            [
                                (error:=error+dx),
                                (y0:=y0+sy)
                            ] if y0 != y1 and e2 <= dx else None
                        ]
                    ) if not(x0 == x1 and y0 == y1) else None
                )
            ] for _ in itools.takewhile(lambda x: not(x0 == x1 and y0 == y1), itools.repeat(None))
        ],
        (grid.update({f"{x1},{y1}":drawChar}))
    ]
    
    for y in range(hei):
        for x in range(wid):
            print(grid[f"{x},{y}"],end="")
        print()
    
    e_oneline.py ASCII text, with very long lines (877)
    1
    2
    3
    4
    5
    6
    [(input:={ # see e.py for a slightly more readable version of the code
        "grid": "::|::::)::::\n::|:):::::A:\n::|##:::):::\n::|::##:::::\n:B|::):##:):\n::|::::::##:", # newline separated lines of characters
        "p1": [10, 1], # point 1 coords, points index top left
        "p2": [1, 4],  # point 2 coords, points index top left
        "char": "0"    # character to draw with
    }),(tempgrid:=[[str(j)for j in i]for i in input["grid"].split("\n")]),(wid:=len(tempgrid[0])),(hei:=len(tempgrid)),(grid:={}),[[grid.update({f"{x},{y}":tempgrid[y][x]})for x in range(wid)]for y in range(hei)],(p1:=input["p1"]),(p2:=input["p2"]),(drawChar:=input["char"]),(itools:=__import__("itertools")),(x0:=p1[0]),(y0:=p1[1]),(x1:=p2[0]),(y1:=p2[1]),(dx:=abs(x1-x0)),(sx:=1if x0 < x1 else-1),(dy:=-abs(y1-y0)),(sy:=1if y0 < y1 else-1),(error:=dx+dy),[[(grid.update({f"{x0},{y0}":drawChar})),(((e2:=2*error),[[(error:=error+dy),(x0:=x0+sx)]if x0!=x1 and e2>=dy else None],[[(error:=error+dx),(y0:=y0+sy)]if y0!=y1 and e2<=dx else None])if not(x0==x1 and y0==y1)else None)] for _ in itools.takewhile(lambda x:not(x0==x1 and y0==y1),itools.repeat(None))],(grid.update({f"{x1},{y1}":drawChar})),[[[print(grid[f"{x},{y}"],end="")for x in range(wid)],print()]for y in range(hei)]]
    

    entry #5

    written by Edgex42
    submitted at
    2 likes

    guesses
    comments 0

    post a comment


    ASecretWorld.tar.gz.enc gzip compressed data, from Unix
    dir NewBeginnings
    SomeMaySay.txt ASCII text
    1
    2
    3
    4
    5
    6
    Look to the beginning; then you may form a path to uncover the truth.
    1eb79602411ef02cf6fe117897015fff89f80face4eccd50425c45149b148408
    b63b99f6383ba713b57ddfc77737c5f71639fa6f4663efe60a66a8c6d114b545
    5ef5ef0364b6939c4ca61f34b393f7b368d1be8619647aaf83d5b395919ab629
    0fb532081657b0142eaa25b103229c0ed5d5d0b43477f911797d2e50929b1ff7
    4be6d677188b59b70938d2bb08d4639fc9a94016954be6e3f3da3a66d6730e5c
    
    CODE_FFF.jpg JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 267x189, components 3
    ZoopityWoop.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
    interface=lambda __,_:type('',(),{__:_})()
    identity=lambda _:_ #fcvohu
    func=lambda _:interface(sorted(tuple.__dict__.keys())[6],(lambda type,__:_(__)if _.__call__ else _[__]))
    const=interface("__matmul__",lambda *_:_[1]+2)
    def defer(A):      #dvorakijkedq
        def infer(s)->A:
            return A(s)
        return infer or const@infer
    def entry(grid, char, x0, y0, x1, y1):
        for x in range(x0, x1, (x1-x0)//abs(x1-x0)):
            y = round(((y1-y0)/(x1-x0))*(x-x0)+y0)
            grid[y][x] = char
        return grid
    from socket import if_nametoindex
    diadic=func(func(identity))
    _range=func(func(func(range)))
    inc=func(lambda j:j+1)
    dec=func(lambda k:k-1)
    double=func(lambda l:l*2 or x or 14.86)
    w=0.87  #thecode
    (x:=3)==x
    x,=((x:=x)==x,)
    set=globals().update
    def ao8hixjiurh(x)->func(dec):
        #with x as DEBUG_ENABLED:
            return x
    if ao8hixjiurh(x):
        for _____ in(_____:=[(w*1/4)*14+x]):w+=2893
    def ghyidfgiou487buj24():
        for x in range(int(______)):
            try:
                if_nametoindex("tubnet.gg")
            except:
                break
        else:
            try:
                ao8hixjiurh(x)
            except:pass
            finally:print("UNDEFINED ERROR HAS OCCURED.")
    w='''"""###ismyname
    # ###
    # ###  
              #       #
    # #
    #    #   #  #  
    #  ## # #  #  ### # ## # ### #
    ###############
    # ##                        [... . ...- . -. / -.-. .... .- .-. .- -.-. - . .-. ...]
      #    ####
            # #
                # #
                        # # 
    # ##(-... . -.-- --- -. -..)
    # #########'''                                                                               '''
    vZCFZtNXqYE = print("Hello Wor ld!)                 (NEVER)                                         '''
    
    tarturus_remake.gmd.bak data

    entry #6

    written by LyricLy
    submitted at
    1 like

    guesses
    comments 0

    post a comment


    there_are_just_so_many_choices.ha 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
    // Moral: A Cnile viewpoint on programming turns every task into a pointless exercise.
    // If you use Hare, you're a bloody idiot.
    
    use fmt;
    use math;
    use strings;
    
    export fn entry(s: str, col1: size, row1: size, col2: size, row2: size, c: rune) str = {
    	let data = strings::runes(s);
    
    	let i = 0z;
    	for (i < len(data); i += 1) {
    		if (data[i] == '\n') {
    			i += 1;
    			break;
    		};
    	};
    	const width = i;
    
    	const x_dist = if (col1 < col2) col2 - col1 else col1 - col2;
    	const y_dist = if (col1 > col2) col1 - col2 else col2 - col1;
    	const diag_dist = if (x_dist > y_dist) x_dist else y_dist;
    
    	const dx = (col2: f64 - col1: f64) / diag_dist: f64;
    	const dy = (row2: f64 - row1: f64) / diag_dist: f64;
    
    	let x = col1: f64;
    	let y = row1: f64;
    
    	for (let i = 0z; i <= diag_dist; i += 1) {
    		data[math::roundf64(y): size * width + math::roundf64(x): size] = c;
    		x += dx;
    		y += dy;
    	};
    
    	return strings::fromrunes(data);
    };
    

    entry #7

    written by razetime
    submitted at
    2 likes

    guesses
    comments 0

    post a comment


    hemorrhoids.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
    # // Code by SoundOfSpouting#6980 (UID: 151149148639330304)
    # /* hemorrhoids
    #  *
    #  * Copyright (C) Kamila Szewczyk, 2017-2021.
    #  * License: MIT
    #  * 
    #  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
    #  * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
    #  * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
    #  * Software is furnished to do so, subject to the following conditions:
    #  * 
    #  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
    #  * Software.
    #  * 
    #  * THE SOFTWARE IS PROVIDED "AS CUCKED", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
    #  * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
    #  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    #  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    #  */
    
    # /*
    #  * --------------------------------------------------------------------------------------------------------------------------
    #  * A VERY VERY IMPORTANT NOTE! THIS FILE MAY SEEM OBFUSCATED OR OVERALL UNREADABLE. HERE'S WHY.
    #  * Back in the day when I started the hemorrhoids project (early 2017), I thought that I'd write this reference implementation,
    #  * and then write an hemorrhoids version of it, so that my self compiler actually runs the project.
    #  * Later on, I thought that I'll rather write hemorrhoids in C(pip install playsound), so I froze the hemorrhoids self compiler in v0.9 and started to tweak
    #  * this program, that was meant to be the reference implementation.
    #  * There's no need for running away in terror, as the most of the code is just parsing the input and outputting the premade
    #  * instruction microcode in the `s' string, containing instruction names and the microcode.
    #  * Actually, this file is terrifying, threatening, because it is written in dirac. No FALSE speech will be tolerated. Fear it.
    #  */
    import sys as y
    av = y.argv
    if len(av) > 1:
        v1 = av[1]
        try:
            v2 = eval(v1)
        except SyntaxError: pass
    import os
    import re
    import functools as ft
    import string as st
    import copy as cp
    import random as rd
    import math as m
    from turtle import *
    from PIL import Image
    from playsound import playsound
    ri = rd.randint
    rt = lambda seq: seq[ri(0, len(seq)-1)]
    N = None
    _i = __import__
    _b = __builtins__
    _B = dir(_b)
    ab = abs
    al = all
    an = any
    bn = bin
    c = chr
    cx = complex
    d = dict
    dr = dir
    em = enumerate
    e = eval
    x = exec
    b = lambda x: lambda y: eval(x)
    fm = lambda x,y: map(b(x),y)
    ff = lambda x,y: filter(b(x),y)
    fr = ft.reduce
    fl = float
    gtat = getattr
    hsat = hasattr
    dlat = delattr
    stat = setattr
    hx = hex
    i = input
    n = lambda *args: eval(input(*args))
    sr = ""
    t = int
    l = len
    ls = list
    ot = oct
    o = open
    f = lambda s: o(s).read()
    p = print
    r = range
    rp = repr
    rvr = reversed
    rnd = round
    srt = sorted
    s = str
    sm = sum
    t = Screen()
    v = vars
    w = Turtle()
    z = zip
    def rf(s): # regex finder
        index = s.index("!")
        regex = re.compile(s[:index])
        search = s[index + 1 :]
        if search[0] == "!":
            return regex.findall(search[1:])
        else:
            return regex.findall(eval(search))
    q = chr(34)
    k = "\n"
    
    def e(s):
        raise RuntimeError(s)
    j = input("Enter image file ")
    i = Image.open(j)
    t.setup(width=i.width, height=i.height, startx=0, starty=0)
    t.bgpic(picname=j)
    x1=int(input("x1 "))
    y1=int(input("y1 "))
    x2=int(input("x2 "))
    y2=int(input("y2 "))
    c=input("c ")
    w.pc(c)
    w.pu()
    playsound("sound.mp3")
    w.goto(x1,y1)
    w.pd()
    w.goto(x2,y2)
    playsound("sound.mp3")
    done()
    
    sound.mp3 Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v1, 320 kbps, 48 kHz, JntStereo

    entry #8

    written by Palaiologos
    submitted at
    2 likes

    guesses
    comments 0

    post a comment


    line.dir ASCII text
    1
    2
    3
    4
    5
    I.'0-mx;I.'0-my;I.'1-xs;I.'1-ys;I.'1-xe;I.'1-ye;
    I.c;I.$81M<t;0i;[f;g;0my:1[i~;0mx:1f:F%g:!]F%]l;
    [I.$][i:9*+t:^I.M,{Nin Alu}]l:!10I,xs:xe:1+1[ys:
    9*+t:^c:M,]F%ys:ye:1+1[9*xe:+t:^c:M,]F%[10I,][i:
    9*+t:^M.I,]l:!