File size: 1,430 Bytes
56d00e6
 
 
 
 
 
 
 
 
 
 
3b40d08
fdf8bc1
3b40d08
 
56d00e6
 
 
 
 
 
a02cdff
 
 
aa42a3f
a02cdff
 
 
 
89f3f6b
a02cdff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8ff1706
a02cdff
 
 
 
 
 
 
 
 
25b4d55
a02cdff
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
---
dataset_info:
  features:
  - name: code
    dtype: string
  - name: output
    list: int64
  - name: n_cells
    dtype: int64
  splits:
  - name: train
    num_bytes: 15602481
    num_examples: 32768
  download_size: 14512543
  dataset_size: 15602481
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
---

### dataset creation

```python
import random
from datasets import Dataset
from tqdm.auto import trange

bf = Brainfuck(n_cells = 1024, max_steps = 32768)
SIMPLE = "><+-."
def bf_program(p_continue=0.5, p_loop=0.3, max_depth=6, rng=random):
    # glm5.3-flash generated function sorry for my lazy
    def sequence(depth):
        parts = []
        while rng.random() < p_continue:
            if depth > 0 and rng.random() < p_loop:
                parts += ["[", *sequence(depth - 1), "]"]
            else:
                parts.append(rng.choice(SIMPLE))
        return parts
    return "".join(sequence(max_depth))
data = []
for _ in trange(32_000, miniters=100):
    valid = False
    output = []
    while valid is False or (len(output) < 3 or len(code) > 256 or len(code)<8 or False not in [i==0 for i in output]):
        code = bf_program(p_continue=0.8)
        output, valid = bf.run(code)
    data.append({
        "code": code,
        "output": output,
        "n_cells": 1024
    })
dataset = Dataset.from_list(data)
dataset.push_to_hub("crumb/bf_random_valid")
```