Skip to content

Commit 27f07f3

Browse files
committed
Added codex experiments
1 parent ff70233 commit 27f07f3

16 files changed

+7814
-132
lines changed

solvers/codex/138puzzles.json

Lines changed: 968 additions & 0 deletions
Large diffs are not rendered by default.

solvers/codex/30puzzles.json

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
[
2+
{
3+
"name": "Study_1_0",
4+
"sat": "def sat(s: str):\n return s.count('o') == 1000 and s.count('oo') == 0",
5+
"sol_docstring": " \"\"\"Find a string with 1000 'o's but no two adjacent 'o's.\"\"\"",
6+
"ans_type": "str",
7+
"sol_header": "def sol():"
8+
},
9+
{
10+
"name": "Study_2_0",
11+
"sat": "def sat(s: str):\n return s.count('o') == 1000 and s.count('oo') == 100 and s.count('ho') == 801",
12+
"sol_docstring": " \"\"\"Find a string with 1000 'o's, 100 pairs of adjacent 'o's and 801 copies of 'ho'.\"\"\"",
13+
"ans_type": "str",
14+
"sol_header": "def sol():"
15+
},
16+
{
17+
"name": "Study_3_0",
18+
"sat": "def sat(li: List[int]):\n return sorted(li) == list(range(999)) and all(li[i] != i for i in range(len(li)))",
19+
"sol_docstring": " \"\"\"Find a permutation of [0, 1, ..., 998] such that the ith element is *not* i, for all i=0, 1, ..., 998.\"\"\"",
20+
"ans_type": "List[int]",
21+
"sol_header": "def sol():"
22+
},
23+
{
24+
"name": "Study_4_0",
25+
"sat": "def sat(li: List[int]):\n return len(li) == 10 and li.count(li[3]) == 2",
26+
"sol_docstring": " \"\"\"Find a list of length 10 where the fourth element occurs exactly twice.\"\"\"",
27+
"ans_type": "List[int]",
28+
"sol_header": "def sol():"
29+
},
30+
{
31+
"name": "Study_5_0",
32+
"sat": "def sat(li: List[int]):\n return all([li.count(i) == i for i in range(10)])",
33+
"sol_docstring": " \"\"\"Find a list integers such that the integer i occurs i times, for i = 0, 1, 2, ..., 9.\"\"\"",
34+
"ans_type": "List[int]",
35+
"sol_header": "def sol():"
36+
},
37+
{
38+
"name": "Study_6_0",
39+
"sat": "def sat(i: int):\n return i % 123 == 4 and i > 10 ** 10",
40+
"sol_docstring": " \"\"\"Find an integer greater than 10^10 which is 4 mod 123.\"\"\"",
41+
"ans_type": "int",
42+
"sol_header": "def sol():"
43+
},
44+
{
45+
"name": "Study_7_0",
46+
"sat": "def sat(s: str):\n return str(8 ** 2888).count(s) > 8 and len(s) == 3",
47+
"sol_docstring": " \"\"\"Find a three-digit pattern that occurs more than 8 times in the decimal representation of 8^2888.\"\"\"",
48+
"ans_type": "str",
49+
"sol_header": "def sol():"
50+
},
51+
{
52+
"name": "Study_8_0",
53+
"sat": "def sat(ls: List[str]):\n return ls[1234] in ls[1235] and ls[1234] != ls[1235]",
54+
"sol_docstring": " \"\"\"Find a list of more than 1235 strings such that the 1234th string is a proper substring of the 1235th.\"\"\"",
55+
"ans_type": "List[str]",
56+
"sol_header": "def sol():"
57+
},
58+
{
59+
"name": "Study_9_0",
60+
"sat": "def sat(li: List[int]):\n return [\"The quick brown fox jumps over the lazy dog\"[i] for i in li] == list(\n \"The five boxing wizards jump quickly\")",
61+
"sol_docstring": " \"\"\"Find a way to rearrange the letters in the pangram \"The quick brown fox jumps over the lazy dog\" to\n get the pangram \"The five boxing wizards jump quickly\". The answer should be represented as a list of index\n mappings.\"\"\"",
62+
"ans_type": "List[int]",
63+
"sol_header": "def sol():"
64+
},
65+
{
66+
"name": "Study_10_0",
67+
"sat": "def sat(s: str):\n return s in str(8 ** 1818) and s == s[::-1] and len(s) > 11",
68+
"sol_docstring": " \"\"\"Find a palindrome of length greater than 11 in the decimal representation of 8^1818.\"\"\"",
69+
"ans_type": "str",
70+
"sol_header": "def sol():"
71+
},
72+
{
73+
"name": "Study_11_0",
74+
"sat": "def sat(ls: List[str]):\n return min(ls) == max(ls) == str(len(ls))",
75+
"sol_docstring": " \"\"\"Find a list of strings whose length (viewed as a string) is equal to the lexicographically largest element\n and is equal to the lexicographically smallest element.\"\"\"",
76+
"ans_type": "List[str]",
77+
"sol_header": "def sol():"
78+
},
79+
{
80+
"name": "Study_12_0",
81+
"sat": "def sat(li: List[int]):\n return all(i + j == 9 for i, j in zip([4] + li, li)) and len(li) == 1000",
82+
"sol_docstring": " \"\"\"Find a list of 1,000 integers where every two adjacent integers sum to 9, and where the first\n integer plus 4 is 9.\"\"\"",
83+
"ans_type": "List[int]",
84+
"sol_header": "def sol():"
85+
},
86+
{
87+
"name": "Study_13_0",
88+
"sat": "def sat(x: float):\n return str(x - 3.1415).startswith(\"123.456\")",
89+
"sol_docstring": " \"\"\"Find a real number which, when you subtract 3.1415, has a decimal representation starting with 123.456.\"\"\"",
90+
"ans_type": "float",
91+
"sol_header": "def sol():"
92+
},
93+
{
94+
"name": "Study_14_0",
95+
"sat": "def sat(li: List[int]):\n return all([sum(li[:i]) == i for i in range(20)])",
96+
"sol_docstring": " \"\"\"Find a list of integers such that the sum of the first i integers is i, for i=0, 1, 2, ..., 19.\"\"\"",
97+
"ans_type": "List[int]",
98+
"sol_header": "def sol():"
99+
},
100+
{
101+
"name": "Study_15_0",
102+
"sat": "def sat(li: List[int]):\n return all(sum(li[:i]) == 2 ** i - 1 for i in range(20))",
103+
"sol_docstring": " \"\"\"Find a list of integers such that the sum of the first i integers is 2^i -1, for i = 0, 1, 2, ..., 19.\"\"\"",
104+
"ans_type": "List[int]",
105+
"sol_header": "def sol():"
106+
},
107+
{
108+
"name": "Study_16_0",
109+
"sat": "def sat(s: str):\n return float(s) + len(s) == 4.5",
110+
"sol_docstring": " \"\"\"Find a real number such that when you add the length of its decimal representation to it, you get 4.5.\n Your answer should be the string form of the number in its decimal representation.\"\"\"",
111+
"ans_type": "str",
112+
"sol_header": "def sol():"
113+
},
114+
{
115+
"name": "Study_17_0",
116+
"sat": "def sat(i: int):\n return len(str(i + 1000)) > len(str(i + 1001))",
117+
"sol_docstring": " \"\"\"Find a number whose decimal representation is *a longer string* when you add 1,000 to it than when you add 1,001.\"\"\"",
118+
"ans_type": "int",
119+
"sol_header": "def sol():"
120+
},
121+
{
122+
"name": "Study_18_0",
123+
"sat": "def sat(ls: List[str]):\n return [s + t for s in ls for t in ls if s != t] == 'berlin berger linber linger gerber gerlin'.split()",
124+
"sol_docstring": " \"\"\"Find a list of strings that when you combine them in all pairwise combinations gives the six strings:\n 'berlin', 'berger', 'linber', 'linger', 'gerber', 'gerlin'\"\"\"",
125+
"ans_type": "List[str]",
126+
"sol_header": "def sol():"
127+
},
128+
{
129+
"name": "Study_19_0",
130+
"sat": "def sat(si: Set[int]):\n return {i + j for i in si for j in si} == {0, 1, 2, 3, 4, 5, 6, 17, 18, 19, 20, 34}",
131+
"sol_docstring": " \"\"\"Find a set of integers whose pairwise sums make the set {0, 1, 2, 3, 4, 5, 6, 17, 18, 19, 20, 34}.\n That is find set S such that, { i + j | i, j in S } = {0, 1, 2, 3, 4, 5, 6, 17, 18, 19, 20, 34}.\"\"\"",
132+
"ans_type": "Set[int]",
133+
"sol_header": "def sol():"
134+
},
135+
{
136+
"name": "Study_20_0",
137+
"sat": "def sat(li: List[int]):\n return all(j in {i - 1, i + 1, 3 * i} for i, j in zip([0] + li, li + [128]))",
138+
"sol_docstring": " \"\"\"Find a list of integers, starting with 0 and ending with 128, such that each integer either differs from\n the previous one by one or is thrice the previous one.\"\"\"",
139+
"ans_type": "List[int]",
140+
"sol_header": "def sol():"
141+
},
142+
{
143+
"name": "Study_21_0",
144+
"sat": "def sat(li: List[int]):\n return all([li[i] != li[i + 1] for i in range(10)]) and len(set(li)) == 3",
145+
"sol_docstring": " \"\"\"Find a list integers containing exactly three distinct values, such that no integer repeats\n twice consecutively among the first eleven entries. (So the list needs to have length greater than ten.)\"\"\"",
146+
"ans_type": "List[int]",
147+
"sol_header": "def sol():"
148+
},
149+
{
150+
"name": "Study_22_0",
151+
"sat": "def sat(s: str):\n return s[::2] in s and len(set(s)) == 5",
152+
"sol_docstring": " \"\"\"Find a string s containing exactly five distinct characters which also contains as a substring every other\n character of s (e.g., if the string s were 'parrotfish' every other character would be 'profs').\"\"\"",
153+
"ans_type": "str",
154+
"sol_header": "def sol():"
155+
},
156+
{
157+
"name": "Study_23_0",
158+
"sat": "def sat(ls: List[str]):\n return tuple(ls) in zip('dee', 'doo', 'dah!')",
159+
"sol_docstring": " \"\"\"Find a list of characters which are aligned at the same indices of the three strings 'dee', 'doo', and 'dah!'.\"\"\"",
160+
"ans_type": "List[str]",
161+
"sol_header": "def sol():"
162+
},
163+
{
164+
"name": "Study_24_0",
165+
"sat": "def sat(li: List[int]):\n return li.count(17) == 3 and li.count(3) >= 2",
166+
"sol_docstring": " \"\"\"Find a list of integers with exactly three occurrences of seventeen and at least two occurrences of three.\"\"\"",
167+
"ans_type": "List[int]",
168+
"sol_header": "def sol():"
169+
},
170+
{
171+
"name": "Study_25_0",
172+
"sat": "def sat(s: str):\n return sorted(s) == sorted('Permute me true') and s == s[::-1]",
173+
"sol_docstring": " \"\"\"Find a permutation of the string 'Permute me true' which is a palindrome.\"\"\"",
174+
"ans_type": "str",
175+
"sol_header": "def sol():"
176+
},
177+
{
178+
"name": "Study_26_0",
179+
"sat": "def sat(ls: List[str]):\n return \"\".join(ls) == str(8 ** 88) and all(len(s) == 8 for s in ls)",
180+
"sol_docstring": " \"\"\"Divide the decimal representation of 8^88 up into strings of length eight.\"\"\"",
181+
"ans_type": "List[str]",
182+
"sol_header": "def sol():"
183+
},
184+
{
185+
"name": "Study_27_0",
186+
"sat": "def sat(li: List[int]):\n return li[li[0]] != li[li[1]] and li[li[li[0]]] == li[li[li[1]]]",
187+
"sol_docstring": " \"\"\"Consider a digraph where each node has exactly one outgoing edge. For each edge (u, v), call u the parent and\n v the child. Then find such a digraph where the grandchildren of the first and second nodes differ but they\n share the same great-grandchildren. Represented this digraph by the list of children indices.\"\"\"",
188+
"ans_type": "List[int]",
189+
"sol_header": "def sol():"
190+
},
191+
{
192+
"name": "Study_28_0",
193+
"sat": "def sat(si: Set[int]):\n return all(i in range(1000) and abs(i - j) >= 10 for i in si for j in si if i != j) and len(si) == 100",
194+
"sol_docstring": " \"\"\"Find a set of one hundred integers between 0 and 999 which all differ by at least ten from one another.\"\"\"",
195+
"ans_type": "Set[int]",
196+
"sol_header": "def sol():"
197+
},
198+
{
199+
"name": "Study_29_0",
200+
"sat": "def sat(si: Set[int]):\n return all(i in range(1000) and abs(i * i - j * j) >= 10 for i in si for j in si if i != j) and len(si) > 995",
201+
"sol_docstring": " \"\"\"Find a set of more than 995 integers between 0 and 999, inclusive, such that each pair of integers have\n squares that differ by at least 10.\"\"\"",
202+
"ans_type": "Set[int]",
203+
"sol_header": "def sol():"
204+
},
205+
{
206+
"name": "Study_30_0",
207+
"sat": "def sat(li: List[int]):\n return all([123 * li[i] % 1000 < 123 * li[i + 1] % 1000 and li[i] in range(1000) for i in range(20)])",
208+
"sol_docstring": " \"\"\"Define f(n) to be the residue of 123 times n mod 1000. Find a list of integers such that the first twenty one\n are between 0 and 999, inclusive, and are strictly increasing in terms of f(n).\"\"\"",
209+
"ans_type": "List[int]",
210+
"sol_header": "def sol():"
211+
}
212+
]

0 commit comments

Comments
 (0)