prev • index • info

code guessing, round #109, stage 2 (guessing)

started at ; stage 2 since . guess by

specification

I'm too lost, so let's return to mazemaking... I guess? print random slashes. submissions may be written in any language.

there's a book about this one-line Commodore 64 program, which prints a maze by randomly printing either a / or \ character ad infinitum:

10 PRINT CHR$(205.5+RND(1)); : GOTO 10

I didn't read the book, so I can't tell you any more than that. here's what the output looks like on the Commodore: a maze made up of slash characters

and here's what it looks like in text:

\///\//\//\/\\\/\\\/\//\////\\\\\\\/\\\/
\\/\\//\/\/////\//\///\\///\//\//\/\\\//
\\/\/\\\/////\///\\//\\\////\\/\/\\\\///
\\/\////\\\//\\/\////\/////\\/\//\\/\//\
\\/////\\//////\//\\/\\/\\\/\\\\\\\/\/\/
//\//\\\\\\/\\\\/\/\/\\/////\///\//\\\\/
\\//\\/\\//\/\\/\/\\\\\\\\////\///\//\/\
//\\\/\\\//\/\\\/\\\\\\\/\//////\//\//\\
\\/\\///\\/\\/\////\//\/\/\\//\\\\///\\\
\/\/\/\\\\///\\//\\/\\/////\/\/\/\\\////
/\//\/\/\/\\\\////\\\\/\\/\\\\/\\\\\/\/\
\//\\\\///\/\\\\\/////\\\\/\\/\\\/\\\//\
/\\\/\//\\//\//\\///\//\/\\/////\\\\\\//
///\\//\\/\//\\\/\//\/\\////\/\/\/\/\/\/
\\/\\////\\/\\\\\\/\//\//\\/\\\//\////\/
\/\\\\\///\\\\\\\//\\\\\\/\\/\/\\////\\/
///\\\\/\\\\\///\///\\\///\\\/\/\///\/\\
/\\\//\\/\/\/////\\///\//\//\/\/\\\//\\\
///\\\\//\\/\\\///\\/\/\//\\\\\/\\\\\\\/
\\/\\/\/////\\\//\/\/\/\//\\\/\\/\\\//\\
/\//\\\\/\/\//\\/\/\/\\\//\//\/\\/\\\\\\
//////\\/\\/\/\\\///\\\\/\\\/\/\////\///
//\/\//\\/\/\/\\//\\/\\///\///\\\/\/\///
\////\\\\\\\\/\//\\///////\///\\\\\/////
\////\\///\/\/\/\/\//\\/\\///////\/\//\\

your challenge is to do that. as any language is allowed, there is no fixed API.

players

  1. Dolphy
  2. essaie
  3. evie
  4. GNU Radio Shows
  5. JJRubes
  6. LyricLy
  7. Viken

entries

you can download all the entries

entry #1

comments 0

post a comment


hawk.thue 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
$::=\
$::=/
 ::=
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$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$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

entry #2

comments 0

post a comment


dir project
canvas.gd ASCII text
1
2
3
4
5
6
extends TileMapLayer

func _ready() -> void:
	for y in range(25):
		for x in range(40):
			self.set_cell(Vector2i(x, y), 0, Vector2i(randi() % 2, 0))
canvas.gd.uid ASCII text
1
uid://bg7xnx03fyvva
canvas.tscn ASCII text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
[gd_scene format=3 uid="uid://caer26earq72c"]

[ext_resource type="Texture2D" uid="uid://vyoy3n672r1w" path="res://tilesheet.png" id="1_75aqd"]
[ext_resource type="Script" uid="uid://bg7xnx03fyvva" path="res://canvas.gd" id="2_pfdkn"]

[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_pfdkn"]
texture = ExtResource("1_75aqd")
texture_region_size = Vector2i(8, 8)
0:0/0 = 0
1:0/0 = 0

[sub_resource type="TileSet" id="TileSet_x1h6x"]
tile_size = Vector2i(8, 8)
sources/0 = SubResource("TileSetAtlasSource_pfdkn")

[node name="TileMapLayer" type="TileMapLayer" unique_id=1611024483]
tile_set = SubResource("TileSet_x1h6x")
script = ExtResource("2_pfdkn")
icon.svg SVG Scalable Vector Graphics image, ASCII text, with very long lines (994)
1
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>
icon.svg.import 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
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://qcxkfvrxfbkm"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
project.godot 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
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
;   [section] ; section goes between []
;   param=value ; assign values to parameters

config_version=5

[application]

config/name="cg109"
run/main_scene="uid://caer26earq72c"
config/features=PackedStringArray("4.7", "GL Compatibility")
config/icon="res://icon.svg"

[display]

window/size/viewport_width=320
window/size/viewport_height=200
window/stretch/mode="viewport"
window/stretch/scale_mode="integer"

[importer_defaults]

texture={
"compress/channel_pack": 0,
"compress/hdr_compression": 1,
"compress/high_quality": false,
"compress/lossy_quality": 0.7,
"compress/mode": 0,
"compress/normal_map": 0,
"compress/rdo_quality_loss": 0.0,
"compress/uastc_level": 0,
"detect_3d/compress_to": 0,
"editor/convert_colors_with_editor_theme": false,
"editor/scale_with_editor_scale": false,
"mipmaps/generate": false,
"mipmaps/limit": -1,
"process/channel_remap/alpha": 3,
"process/channel_remap/blue": 2,
"process/channel_remap/green": 1,
"process/channel_remap/red": 0,
"process/fix_alpha_border": true,
"process/hdr_as_srgb": false,
"process/hdr_clamp_exposure": false,
"process/normal_map_invert_y": false,
"process/premult_alpha": false,
"process/size_limit": 0,
"roughness/mode": 0,
"roughness/src_normal": "",
"svg/scale": 1.0
}

[physics]

3d/physics_engine="Jolt Physics"

[rendering]

textures/canvas_textures/default_texture_filter=0
rendering_device/driver.windows="d3d12"
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
environment/defaults/default_clear_color=Color(0.07565539, 0.11304154, 0.053229623, 1)
tilesheet.png PNG image data, 16 x 8, 8-bit/color RGBA, non-interlaced
tilesheet.png.import 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
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://vyoy3n672r1w"
path="res://.godot/imported/tilesheet.png-55e778059ad55a1a47c5237b5db55343.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://tilesheet.png"
dest_files=["res://.godot/imported/tilesheet.png-55e778059ad55a1a47c5237b5db55343.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
readme.txt ASCII text
1
2
3
4
No, I'm not going to export the project. You'll have to import it in Godot yourself to run it. Here's why:
- Code guessing is about submitting code, not binaries
- Godot is not that hard to install
- It was too much work

entry #3

comments 0

post a comment


cg109.raku ASCII text
1
2
my $n = (2..^20).pick;
say <\ />.roll($n).join for ^(2..^20).pick;

entry #4

comments 0

post a comment


preview.html 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
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <style>
    @font-face {
      font-family: 'Slashes';
      src: url('slash.ttf') format('truetype');
    }

    #display {
      font-family: 'Slashes', monospace;
      font-feature-settings: 'calt' 1;
    }
  </style>
</head>

<body>
  <h2>Make the maze.</h2>
  <textarea id="input" rows="7" style="width:99%;">
aaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbb
ccccccccccccccccccccccccccc
ddddddddddddddddddddddddddd
eeeeeeeeeeeeeeeeeeeeeeeeeee
fffffffffffffffffffffffffff    
  </textarea>
  <pre id="display" style="font-size:32px; margin-top:10px;"></pre>
  <script>
    const input = document.getElementById('input');
    const display = document.getElementById('display');
    display.textContent = input.value;
    input.addEventListener('input', () => { display.textContent = input.value; });
  </script>
</body>

</html>
slash.ttf TrueType Font data, 11 tables, 1st "GSUB", 2 names, Microsoft, language 0x409, type 1 string, SlashesRegular

entry #5

comments 0

post a comment


index.html ASCII text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<!DOCTYPE html>
<html lang="en">
  <head>
    <script src="https://codeguessing.gay/43/p5.min.js"></script>
    <meta charset="utf-8" />
  </head>
  <body>
    <main>
    </main>
    <script src="sketch.js"></script>
  </body>
</html>
sketch.js 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
let t = 0;
let state = [];
let offsets = [];
let offset = 50;
let w = 20;
let c;

function setup() {
  createCanvas(400, 400);

  c = (width - 2 * offset) / w;
  for(let i = 0; i < c; i++) {
    state[i] = [];
    offsets[i] = [];
    for(let j = 0; j < c; j++) {
      state[i][j] = random() > 0.5;
      offsets[i][j] = [2 * random() - 1, 2 * random() - 1];
    }
  }
}

function rand(n) {
  let r = noise(n, 0.01 * t);
  r = 2 * r - 1;
  let s = Math.sign(r);
  return r;
}

function dotLine(x1, y1, x2, y2) {
  let len = dist(x1, y1, x2, y2);
  let spread = 6;
  strokeWeight(2);
  for(let i = 0; i < len; i += 3) {
    for(let j = 0; j < 2; j++) {
      let px = lerp(x1, x2, i / len);
      let py = lerp(y1, y2, i / len);
      let seed = x1 * 120 + y1 * 203 + x2 * 324 + y2 * 415 + i * 25 + j * 13 + x1 * y1 * x2 * y2 * i * j;
      let rx = rand(seed), ry = rand(seed + 10000);
      stroke(0x20, 0xd3, 0xff, 100 * (rx + ry) + 150);
      point(px + spread * rx, py + spread * ry);
    }
  }
  strokeWeight(1);
  for(let i = 0; i < len; i += 3) {
    for(let j = 0; j < 2; j++) {
      let px = lerp(x1, x2, i / len);
      let py = lerp(y1, y2, i / len);
      let seed = x1 * 634 + y1 * 2345 + x2 * 543 + y2 * 234 + i * 756 + j * 43 + x1 * y1 * x2 * y2 * i * j;
      let rx = rand(seed), ry = rand(seed + 10000);
      stroke(200, 240, 255);
      point(px + 3 * rx, py + 3 * ry);
    }
  }
  stroke(255, 255, 255);
  strokeWeight(1);
  line(x1, y1, x2, y2);
}

let scaling = 0.12;
function offsettedX(x, y) {
  if(y >= offsets.length) {
    return x;
  }
  if(x >= offsets[y].length) {
    return x;
  }
  return x + scaling * offsets[y][x][0];
}
function offsettedY(x, y) {
  if(y >= offsets.length) {
    return y;
  }
  if(x >= offsets[y].length) {
    return y;
  }
  return y + scaling * offsets[y][x][1];
}

function backslash(x, y) {
  dotLine(
    offset + w * offsettedX(x, y),
    offset + w * offsettedY(x, y),
    offset + w * offsettedX(x + 1, y + 1),
    offset + w * offsettedY(x + 1, y + 1)
  );
}

function forwardslash(x, y) {
  dotLine(
    offset + w * offsettedX(x + 1, y),
    offset + w * offsettedY(x + 1, y),
    offset + w * offsettedX(x, y + 1),
    offset + w * offsettedY(x, y + 1)
  );
}

function draw() {  
  background(35, 0, 60);
  for(let i = 0; i < state.length; i++) {
    for(let j = 0; j < state[i].length; j++) {
      if(i * state.length + j > 0.1 * t) {
        continue;
      }
      if(state[i][j]) {
        backslash(j, i);
      } else {
        forwardslash(j, i);
      }
    }
  }
  t++;
}

entry #6

comments 0

post a comment


girlmoder.vim data
1
2
qqa=rand()%2?'/':'\'
qxqr60@qoq30@r

entry #7

comments 0

post a comment


slashes.cpp 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
#include <cstdint>
#include <iostream>
#include <type_traits>
#include <utility>

#ifndef WIDTH
#define WIDTH 30
#endif // !WIDTH

#ifndef HEIGHT
#define HEIGHT 10
#endif // !HEIGHT

constexpr std::uint32_t get_seed()
{
    return (__TIME__[0] - '0') * 1e5 + 
           (__TIME__[1] - '0') * 1e4 + 
           (__TIME__[3] - '0') * 1e3 + 
           (__TIME__[4] - '0') * 1e2 + 
           (__TIME__[6] - '0') * 1e1 + 
           (__TIME__[7] - '0') * 1e0;
}

template<bool B>
struct Slash;

template<>
struct Slash<false>
{
    static constexpr char content = '/';
};

template<>
struct Slash<true>
{
    static constexpr char content = '\\';
};

template<std::uint32_t seed, std::uint32_t next>
struct LCG;

template<std::uint32_t seed>
struct LCG<seed, 0>
{
    static constexpr std::uint32_t state = seed;
};

template<std::uint32_t seed, std::uint32_t next>
struct LCG
{
    static constexpr std::uint32_t state = (1103515245 * LCG<seed, next - 1>::state + 12345) % 0x7fffffff;
};

template <std::uint32_t y, std::uint32_t x>
struct Maze
{
    static constexpr char entry = Slash<LCG<get_seed(), y * WIDTH + x>::state & 1>::content;
};

template <std::uint32_t area, std::uint32_t current>
struct Program;

template <typename F, std::size_t... I>
constexpr void static_for_impl(F&& f, std::index_sequence<I...>) {
    (f(std::integral_constant<std::size_t, I>{}), ...);
}

template <std::size_t N, typename F>
constexpr void static_for(F&& f) {
    static_for_impl(f, std::make_index_sequence<N>{});
}

int main()
{
    static_for<WIDTH * HEIGHT>([](auto i){
        constexpr std::size_t idx = decltype(i)::value;
        std::cout << Maze<i / WIDTH, i % WIDTH>::entry;
        if constexpr (i % WIDTH == WIDTH - 1) {
            std::cout << std::endl;
        }
    });
    return 0;
}