├── LICENSE.md ├── README.md ├── model.py ├── samples.xml └── samples ├── 3Bricks.png ├── Angular.png ├── Castle ├── bridge.png ├── data.xml ├── ground.png ├── river.png ├── riverturn.png ├── road.png ├── roadturn.png ├── t.png ├── tower.png ├── wall.png ├── wallriver.png └── wallroad.png ├── Cat.png ├── Cats.png ├── Cave.png ├── Chess.png ├── Circles ├── b.png ├── b_half.png ├── b_i.png ├── b_quarter.png ├── data.xml ├── w.png ├── w_half.png ├── w_i.png └── w_quarter.png ├── Circuit ├── bridge.png ├── component.png ├── connection.png ├── corner.png ├── data.xml ├── dskew.png ├── skew.png ├── substrate.png ├── t.png ├── track.png ├── transition.png ├── turn.png ├── viad.png ├── vias.png └── wire.png ├── City.png ├── Colored City.png ├── Dungeon.png ├── Fabric.png ├── Flowers.png ├── Forest.png ├── Hogs.png ├── Knot.png ├── Knots ├── corner.png ├── cross.png ├── data.xml ├── empty.png ├── line.png └── t.png ├── Lake.png ├── Less Rooms.png ├── Link 2.png ├── Link.png ├── Magic Office.png ├── Maze.png ├── Mazelike.png ├── More Flowers.png ├── Mountains.png ├── Nested.png ├── Office 2.png ├── Office.png ├── Paths.png ├── Platformer.png ├── Qud.png ├── Red Dot.png ├── Red Maze.png ├── Rooms.png ├── Rooms ├── bend.png ├── corner.png ├── corridor.png ├── data.xml ├── door.png ├── empty.png ├── side.png ├── t.png ├── turn.png └── wall.png ├── Rule 126.png ├── Scaled Maze.png ├── Sewers.png ├── Simple Knot.png ├── Simple Maze.png ├── Simple Wall.png ├── Skew 1.png ├── Skew 2.png ├── Skyline 2.png ├── Skyline.png ├── Smile City.png ├── Spirals.png ├── Summer ├── cliff 0.png ├── cliff 1.png ├── cliff 2.png ├── cliff 3.png ├── cliffcorner 0.png ├── cliffcorner 1.png ├── cliffcorner 2.png ├── cliffcorner 3.png ├── cliffturn 0.png ├── cliffturn 1.png ├── cliffturn 2.png ├── cliffturn 3.png ├── data.xml ├── grass 0.png ├── grasscorner 0.png ├── grasscorner 1.png ├── grasscorner 2.png ├── grasscorner 3.png ├── road 0.png ├── road 1.png ├── road 2.png ├── road 3.png ├── roadturn 0.png ├── roadturn 1.png ├── roadturn 2.png ├── roadturn 3.png ├── water_a 0.png ├── water_b 0.png ├── water_c 0.png ├── watercorner 0.png ├── watercorner 1.png ├── watercorner 2.png ├── watercorner 3.png ├── waterside 0.png ├── waterside 1.png ├── waterside 2.png ├── waterside 3.png ├── waterturn 0.png ├── waterturn 1.png ├── waterturn 2.png └── waterturn 3.png ├── Town.png ├── Trick Knot.png ├── Village.png └── Water.png /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Isaac Karth 4 | 5 | Based on WaveFunctionCollapse by mxgmn 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # wfc_python 2 | An implementation of [mxgmn/WaveFunctionCollapse](https://github.com/mxgmn/WaveFunctionCollapse) in Python 3 | 4 | WaveFunctionCollapse is an algorithm that generates bitmaps that are locally similar to the input bitmap. This is a translation into Python, based on the original implementation in C#. 5 | 6 | This implementation has only had minimal testing and optimization (for example, it uses arrays of ints in places where the original C# code uses bytes). It can probably be sped up quite a lot. I can't promise I'll fix any issues any time soon, but if you run into anything please go ahead and report an issue (or submit a pull-request)! 7 | 8 | **An updated, re-implemented version of WaveFunctionCollapse in Python can be found at [ikarth/wfc_2019f](https://github.com/ikarth/wfc_2019f).** 9 | -------------------------------------------------------------------------------- /model.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # 4 | # The MIT License(MIT) 5 | # Copyright Isaac Karth 2017 6 | # Based on WaveFunctionCollapse in C#, which is Copyright(c) mxgmn 2016. 7 | # 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: 8 | # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 9 | # The software is provided "as is", 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. 10 | # 11 | 12 | import math 13 | import random 14 | import xml.etree.ElementTree as ET 15 | import collections 16 | import uuid # used for tracking experiments 17 | 18 | try: 19 | import Image 20 | except ImportError: 21 | from PIL import Image 22 | 23 | hackstring = "" 24 | hackcount = 0 25 | 26 | class Model: 27 | def __init__(self, width, height): 28 | #initialize 29 | 30 | 31 | self.stationary = [] 32 | 33 | 34 | self.FMX = width 35 | self.FMY = height 36 | self.T = 2 37 | #self.limit = 0 38 | 39 | self.rng = random.Random() #todo: set rng 40 | 41 | self.wave = [[[False for _ in range(self.T)] for _ in range(self.FMY)] for _ in range(self.FMX)] 42 | self.changes = [[False for _ in range(self.FMY)] for _ in range(self.FMX)] 43 | self.observed = None#[[0 for _ in range(self.FMY)] for _ in range(self.FMX)] 44 | 45 | self.log_prob = 0 46 | self.log_t = math.log(self.T) 47 | 48 | self.observe_count = 0 49 | 50 | self.count_prop_passes = 0 51 | 52 | def Observe(self): 53 | self.observe_count += 1 54 | observed_min = 1e+3 55 | observed_sum = 0 56 | main_sum = 0 57 | log_sum = 0 58 | noise = 0 59 | entropy = 0 60 | 61 | argminx = -1 62 | argminy = -1 63 | amount = None 64 | w = [] 65 | 66 | # Find the point of minimum entropy 67 | for x in range(0, self.FMX): 68 | for y in range(0, self.FMY): 69 | if self.OnBoundary(x, y): 70 | pass 71 | else: 72 | w = self.wave[x][y] 73 | amount = 0 74 | observed_sum = 0 75 | t = 0 76 | while t < self.T: 77 | if w[t]: 78 | amount += 1 79 | observed_sum += self.stationary[t] 80 | t += 1 81 | if 0 == observed_sum: 82 | return False 83 | noise = 1e-6 * self.rng.random() 84 | if 1 == amount: 85 | entropy = 0 86 | elif self.T == amount: 87 | entropy = self.log_t 88 | else: 89 | main_sum = 0 90 | log_sum = math.log(observed_sum) 91 | t = 0 92 | while t < self.T: 93 | if w[t]: 94 | main_sum += self.stationary[t] * self.log_prob[t] 95 | t += 1 96 | entropy = log_sum - main_sum / observed_sum 97 | if entropy > 0 and (entropy + noise < observed_min): 98 | observed_min = entropy + noise 99 | argminx = x 100 | argminy = y 101 | 102 | # No minimum entropy, so mark everything as being observed... 103 | if (-1 == argminx) and (-1 == argminy): 104 | self.observed = [[0 for _ in range(self.FMY)] for _ in range(self.FMX)] 105 | for x in range(0, self.FMX): 106 | self.observed[x] = [0 for _ in range(self.FMY)] 107 | for y in range(0, self.FMY): 108 | for t in range(0, self.T): 109 | if self.wave[x][y][t]: 110 | self.observed[x][y] = t 111 | break 112 | return True 113 | 114 | # A minimum point has been found, so prep it for propogation... 115 | distribution = [0 for _ in range(0,self.T)] 116 | for t in range(0,self.T): 117 | distribution[t] = self.stationary[t] if self.wave[argminx][argminy][t] else 0 118 | r = StuffRandom(distribution, self.rng.random()) 119 | for t in range(0,self.T): 120 | self.wave[argminx][argminy][t] = (t == r) 121 | self.changes[argminx][argminy] = True 122 | return None 123 | 124 | def Run(self, seed, limit): 125 | self.log_t = math.log(self.T) 126 | self.log_prob = [0 for _ in range(self.T)] 127 | for t in range(0,self.T): 128 | self.log_prob[t] = math.log(self.stationary[t]) 129 | self.Clear() 130 | self.rng = random.Random() 131 | self.rng.seed(seed) 132 | l = 0 133 | while (l < limit) or (0 == limit): # if limit == 0, then don't stop 134 | l += 1 135 | result = self.Observe() 136 | if None != result: 137 | return result 138 | pcount = 0 139 | presult = True 140 | global hackcount 141 | 142 | while(presult): 143 | presult = self.Propagate() 144 | 145 | self.Graphics().save("in_progress_{0}_{1}.png".format(hackstring, hackcount), format="PNG") 146 | hackcount += 1 147 | 148 | #print("Propagate: {0}".format(pcount)) 149 | pcount += 1 150 | return True 151 | 152 | 153 | def Propagate(self): 154 | return False 155 | 156 | def Clear(self): 157 | for x in range(0,self.FMX): 158 | for y in range(0, self.FMY): 159 | for t in range(0, self.T): 160 | self.wave[x][y][t] = True 161 | self.changes[x][y] = False 162 | 163 | 164 | def OnBoundary(self, x, y): 165 | return True # Abstract, replaced in child classes 166 | 167 | def Graphics(self): 168 | return Image.new("RGB",(self.FMX, self.FMY),(0,0,0)) 169 | 170 | class OverlappingModel(Model): 171 | 172 | def __init__(self, width, height, name, N_value = 2, periodic_input_value = True, periodic_output_value = False, symmetry_value = 8, ground_value = 0): 173 | """ 174 | Initializes the model. 175 | """ 176 | super( OverlappingModel, self).__init__(width, height) 177 | self.propagator = [[[[]]]] 178 | self.N = N_value 179 | self.periodic = periodic_output_value 180 | self.bitmap = Image.open("samples/{0}.png".format(name)) 181 | self.SMX = self.bitmap.size[0] 182 | self.SMY = self.bitmap.size[1] 183 | 184 | # .sample is an array of arrays that holds the index values for colors 185 | # as found in the source image 186 | self.sample = [[0 for _ in range(self.SMY)] for _ in range(self.SMX)] 187 | # .colors is the list of colors that are found in the source image 188 | self.colors = [] 189 | 190 | # This initializes the .sample array with the color index values. 191 | # It loops over the pixels in the source bitmap, adds the color to the 192 | # list of colors if it is new, and sets the .sample x,y value to the 193 | # index of the color in the list of colors. 194 | for y in range(0, self.SMY): 195 | for x in range(0, self.SMX): 196 | a_color = self.bitmap.getpixel((x, y)) 197 | color_exists = [c for c in self.colors if c == a_color] 198 | if len(color_exists) < 1: 199 | self.colors.append(a_color) 200 | samp_result = [i for i,v in enumerate(self.colors) if v == a_color] 201 | self.sample[x][y] = samp_result 202 | 203 | 204 | self.color_count = len(self.colors) 205 | self.W = StuffPower(self.color_count, self.N * self.N) 206 | 207 | # The pattern matrix, as an array of arrays. 208 | self.patterns= [[]] 209 | #self.ground = 0 210 | 211 | # A helper function to extract the neighboring cells from the sample 212 | # matrix. Takes a function that translates (dx,dy) into a reference to 213 | # a cell in the matrix. 214 | def FuncPattern(passed_func): 215 | result = [0 for _ in range(self.N * self.N)] 216 | for y in range(0, self.N): 217 | for x in range(0, self.N): 218 | result[x + (y * self.N)] = passed_func(x, y) 219 | return result 220 | 221 | pattern_func = FuncPattern 222 | 223 | def PatternFromSample(x, y): 224 | ''' 225 | Takes the sample and returns the pattern for that (x,y) location. 226 | ''' 227 | def innerPattern(dx, dy): 228 | return self.sample[(x + dx) % self.SMX][(y + dy) % self.SMY] 229 | return pattern_func(innerPattern) 230 | def Rotate(p): 231 | ''' 232 | Returns a rotated version of the pattern. 233 | ''' 234 | return FuncPattern(lambda x, y: p[self.N - 1 - y + x * self.N]) 235 | def Reflect(p): 236 | ''' 237 | Returns a reflected version of the pattern. 238 | ''' 239 | return FuncPattern(lambda x, y: p[self.N - 1 - x + y * self.N]) 240 | 241 | def Index(p): 242 | ''' 243 | Converts a color index into a powers-of-two representation for 244 | bytewise storage. 245 | ''' 246 | result = 0 247 | power = 1 248 | for i in range(0, len(p)): 249 | result = result + (sum(p[len(p) - 1 - i]) * power) 250 | power = power * self.color_count 251 | return result 252 | 253 | 254 | 255 | def PatternFromIndex(ind): 256 | ''' 257 | Takes a pattern index and returns the pattern byte power index. 258 | ''' 259 | residue = ind 260 | power = self.W 261 | result = [None for _ in range(self.N * self.N)] 262 | for i in range(0, len(result)): 263 | power = power / self.color_count 264 | count = 0 265 | while residue >= power: 266 | residue = residue - power 267 | count = count + 1 268 | result[i] = count 269 | return result 270 | 271 | self.weights = collections.Counter() 272 | ordering = [] 273 | 274 | # This chunk converts the sample to patterns. 275 | # SMX and SMY are the sample size x and y. 276 | # if periodic_input_value is true, the source image wraps around 277 | ylimit = self.SMY - self.N + 1 278 | xlimit = self.SMX - self.N + 1 279 | if True == periodic_input_value: 280 | ylimit = self.SMY 281 | xlimit = self.SMX 282 | for y in range (0, ylimit): 283 | for x in range(0, xlimit): 284 | ps = [0 for _ in range(8)] 285 | ps[0] = PatternFromSample(x,y) 286 | ps[1] = Reflect(ps[0]) 287 | ps[2] = Rotate(ps[0]) 288 | ps[3] = Reflect(ps[2]) 289 | ps[4] = Rotate(ps[2]) 290 | ps[5] = Reflect(ps[4]) 291 | ps[6] = Rotate(ps[4]) 292 | ps[7] = Reflect(ps[6]) 293 | for k in range(0,symmetry_value): 294 | ind = Index(ps[k]) 295 | indexed_weight = collections.Counter({ind : 1}) 296 | self.weights = self.weights + indexed_weight 297 | if not ind in ordering: 298 | ordering.append(ind) 299 | 300 | self.T = len(self.weights) 301 | self.ground = int((ground_value + self.T) % self.T) 302 | 303 | self.patterns = [[None] for _ in range(self.T)] 304 | self.stationary = [None for _ in range(self.T)] 305 | self.propagator = [[[[0]]] for _ in range(2 * self.N - 1)] 306 | 307 | counter = 0 308 | for w in ordering: 309 | self.patterns[counter] = PatternFromIndex(w) 310 | self.stationary[counter] = self.weights[w] 311 | counter += 1 312 | 313 | for x in range(0, self.FMX): 314 | for y in range(0, self.FMY): 315 | self.wave[x][y] = [False for _ in range(self.T)] 316 | 317 | def Agrees(p1, p2, dx, dy): 318 | ifany = True 319 | xmin = dx 320 | xmax = self.N 321 | if dx < 0: 322 | xmin = 0 323 | xmax = dx + self.N 324 | ymin = dy 325 | ymax = self.N 326 | if dy < 0: 327 | ymin = 0 328 | ymax = dy + self.N 329 | for y in range(ymin, ymax): 330 | for x in range(xmin, xmax): 331 | if p1[x + self.N * y] != p2[x - dx + self.N * (y - dy)]: 332 | print(p1[x + self.N * y] != p2[x - dx + self.N * (y - dy)]) 333 | ifany = False 334 | #return False 335 | return ifany 336 | #return True 337 | 338 | for x in range(0, 2 * self.N - 1): 339 | self.propagator[x] = [[[0]] for _ in range(2 * self.N - 1)] 340 | for y in range(0, 2 * self.N - 1): 341 | self.propagator[x][y] = [[0] for _ in range(self.T)] 342 | 343 | for t in range(0, self.T): 344 | a_list = [] 345 | for t2 in range(0, self.T): 346 | if Agrees(self.patterns[t], self.patterns[t2], x - self.N + 1, y - self.N + 1): 347 | a_list.append(t2) 348 | self.propagator[x][y][t] = [0 for _ in range(len(a_list))] 349 | for c in range(0, len(a_list)): 350 | self.propagator[x][y][t][c] = a_list[c] 351 | return 352 | 353 | def OnBoundary(self, x, y): 354 | return (not self.periodic) and ((x + self.N > self.FMX ) or (y + self.N > self.FMY)) 355 | 356 | def Propagate(self): 357 | change = False 358 | b = False 359 | 360 | #x2 = None 361 | #y2 = None 362 | for x1 in range(0, self.FMX): 363 | for y1 in range(0, self.FMY): 364 | if (self.changes[x1][y1]): 365 | self.changes[x1][y1] = False 366 | dx = (0 - self.N) + 1 367 | while dx < self.N: 368 | #for dx in range(1 - self.N, self.N): 369 | dy = (0 - self.N) + 1 370 | while dy < self.N: 371 | #for dy in range(1 - self.N, self.N): 372 | x2 = x1 + dx 373 | if x2 < 0: 374 | x2 += self.FMX 375 | elif x2 >= self.FMX: 376 | x2 -= self.FMX 377 | y2 = y1 + dy 378 | if y2 < 0: 379 | y2 += self.FMY 380 | elif y2 >= self.FMY: 381 | y2 -= self.FMY 382 | 383 | if (not self.periodic) and (x2 + self.N > self.FMX or y2 + self.N > self.FMY): 384 | pass 385 | else: 386 | 387 | w1 = self.wave[x1][y1] 388 | w2 = self.wave[x2][y2] 389 | 390 | p = self.propagator[(self.N - 1) - dx][(self.N - 1) - dy] 391 | 392 | for t2 in range(0,self.T): 393 | if (not w2[t2]): 394 | pass 395 | else: 396 | b = False 397 | prop = p[t2] 398 | #print("Prop: {0}".format(prop)) 399 | i_one = 0 400 | while (i_one < len(prop)) and (False == b): 401 | b = w1[prop[i_one]] 402 | i_one += 1 403 | if False == b: 404 | self.changes[x2][y2] = True 405 | change = True 406 | w2[t2] = False 407 | dy += 1 408 | dx += 1 409 | 410 | return change 411 | 412 | def Graphics(self): 413 | result = Image.new("RGB",(self.FMX, self.FMY),(0,0,0)) 414 | bitmap_data = list(result.getdata()) 415 | if(self.observed != None): 416 | for y in range(0, self.FMY): 417 | dy = self.N - 1 418 | if (y < (self.FMY - self.N + 1)): 419 | dy = 0 420 | for x in range(0, self.FMX): 421 | dx = 0 422 | if (x < (self.FMX - self.N + 1)): 423 | dx = self.N - 1 424 | local_obsv = self.observed[x - dx][y - dy] 425 | local_patt = self.patterns[local_obsv][dx + dy * self.N] 426 | c = self.colors[local_patt] 427 | #bitmap_data[x + y * self.FMX] = (0xff000000 | (c.R << 16) | (c.G << 8) | c.B) 428 | if isinstance(c, (int, float)): 429 | bitmap_data[x + y * self.FMX] = (c, c, c) 430 | else: 431 | bitmap_data[x + y * self.FMX] = (c[0], c[1], c[2]) 432 | 433 | else: 434 | for y in range(0, self.FMY): 435 | for x in range(0, self.FMX): 436 | contributors = 0 437 | r = 0 438 | g = 0 439 | b = 0 440 | for dy in range(0, self.N): 441 | for dx in range(0, self.N): 442 | sx = x - dx 443 | if sx < 0: 444 | sx += self.FMX 445 | sy = y - dy 446 | if sy < 0: 447 | sy += self.FMY 448 | if (self.OnBoundary(sx, sy)): 449 | pass 450 | else: 451 | for t in range(0, self.T): 452 | if self.wave[sx][sy][t]: 453 | contributors += 1 454 | color = self.colors[self.patterns[t][dx + dy * self.N]] 455 | if isinstance(color, (int, float)): 456 | r = int(color) 457 | g = int(color) 458 | b = int(color) 459 | else: 460 | r += int(color[0])#.R 461 | g += int(color[1])#.G 462 | b += int(color[2])#.B 463 | #bitmap_data[x + y * self.FMX] = (0xff000000 | ((r / contributors) << 16) | ((g / contributors) << 8) | (b / contributors)) 464 | if contributors > 0: 465 | bitmap_data[x + y * self.FMX] = (int(r / contributors), int(g / contributors), int(b / contributors)) 466 | else: 467 | print("WARNING: No contributors") 468 | bitmap_data[x + y * self.FMX] = (int(r), int(g), int(b)) 469 | result.putdata(bitmap_data) 470 | return result 471 | 472 | def Clear(self): 473 | super(OverlappingModel, self).Clear() 474 | if(self.ground != 0 ): 475 | 476 | for x in range(0, self.FMX): 477 | for t in range(0, self.T): 478 | if t != self.ground: 479 | self.wave[x][self.FMY - 1][t] = False 480 | self.changes[x][self.FMY - 1] = True 481 | 482 | for y in range(0, self.FMY - 1): 483 | self.wave[x][y][self.ground] = False 484 | self.changes[x][y] = True 485 | while self.Propagate(): 486 | pass 487 | 488 | 489 | 490 | 491 | class SimpleTiledModel(Model): 492 | def __init__(self, width, height, name, subset_name, periodic_value, black_value): 493 | super( OverlappingModel, self).__init__(width, height) 494 | self.propagator = [[[]]] 495 | self.tiles = [] 496 | self.tilenames = [] 497 | self.tilesize = 0 498 | self.black = False 499 | self.periodic = periodic_value 500 | self.black = black_value 501 | 502 | 503 | 504 | 505 | #def getNextRandom(): 506 | # return random.random() 507 | 508 | def StuffRandom(source_array, random_value): 509 | a_sum = sum(source_array) 510 | 511 | if 0 == a_sum: 512 | for j in range(0, len(source_array)): 513 | source_array[j] = 1 514 | a_sum = sum(source_array) 515 | for j in range(0, len(source_array)): 516 | source_array[j] /= a_sum 517 | i = 0 518 | x = 0 519 | while (i < len(source_array)): 520 | x += source_array[i] 521 | if random_value <= x: 522 | return i 523 | i += 1 524 | return 0 525 | 526 | def StuffPower(a, n): 527 | product = 1 528 | for i in range(0, n): 529 | product *= a 530 | return product 531 | 532 | # TODO: finish StuffGet 533 | def StuffGet(xml_node, xml_attribute, default_t): 534 | s = "" 535 | if s == "": 536 | return default_t 537 | return s 538 | 539 | def string2bool(strn): 540 | if isinstance(strn, bool): 541 | return strn 542 | return strn.lower() in ["true"] 543 | 544 | class Program: 545 | def __init__(self): 546 | pass 547 | 548 | def Main(self): 549 | self.random = random.Random() 550 | xdoc = ET.ElementTree(file="samples.xml") 551 | counter = 1 552 | for xnode in xdoc.getroot(): 553 | if("#comment" == xnode.tag): 554 | continue 555 | a_model = None 556 | 557 | name = xnode.get('name', "NAME") 558 | global hackstring 559 | hackstring = name 560 | 561 | 562 | 563 | print("< {0} ".format(name), end='') 564 | if "overlapping" == xnode.tag: 565 | #print(xnode.attrib) 566 | a_model = OverlappingModel(int(xnode.get('width', 48)), int(xnode.get('height', 48)), xnode.get('name', "NAME"), int(xnode.get('N', 2)), string2bool(xnode.get('periodicInput', True)), string2bool(xnode.get('periodic', False)), int(xnode.get('symmetry', 8)), int(xnode.get('ground',0))) 567 | pass 568 | elif "simpletiled" == xnode.tag: 569 | print("> ", end="\n") 570 | continue 571 | else: 572 | continue 573 | 574 | 575 | 576 | for i in range(0, int(xnode.get("screenshots", 2))): 577 | for k in range(0, 10): 578 | print("> ", end="") 579 | seed = self.random.random() 580 | finished = a_model.Run(seed, int(xnode.get("limit", 0))) 581 | if finished: 582 | print("DONE") 583 | a_model.Graphics().save("{0}_{1}_{2}_{3}.png".format(counter, name, i, uuid.uuid4()), format="PNG") 584 | break 585 | else: 586 | print("CONTRADICTION") 587 | counter += 1 588 | 589 | 590 | prog = Program() 591 | prog.Main() 592 | 593 | #a_model = OverlappingModel(8, 8, "Chess", 2, True, True, 8,0) 594 | #a_model = OverlappingModel(48, 48, "Hogs", 3, True, True, 8,0) 595 | #gseed = random.Random() 596 | #finished = a_model.Run(364, 0) 597 | #if(finished): 598 | #test_img = a_model.Graphics() 599 | #else: 600 | # print("CONTRADICTION") 601 | #test_img -------------------------------------------------------------------------------- /samples.xml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /samples/3Bricks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/3Bricks.png -------------------------------------------------------------------------------- /samples/Angular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Angular.png -------------------------------------------------------------------------------- /samples/Castle/bridge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Castle/bridge.png -------------------------------------------------------------------------------- /samples/Castle/data.xml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /samples/Castle/ground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Castle/ground.png -------------------------------------------------------------------------------- /samples/Castle/river.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Castle/river.png -------------------------------------------------------------------------------- /samples/Castle/riverturn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Castle/riverturn.png -------------------------------------------------------------------------------- /samples/Castle/road.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Castle/road.png -------------------------------------------------------------------------------- /samples/Castle/roadturn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Castle/roadturn.png -------------------------------------------------------------------------------- /samples/Castle/t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Castle/t.png -------------------------------------------------------------------------------- /samples/Castle/tower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Castle/tower.png -------------------------------------------------------------------------------- /samples/Castle/wall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Castle/wall.png -------------------------------------------------------------------------------- /samples/Castle/wallriver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Castle/wallriver.png -------------------------------------------------------------------------------- /samples/Castle/wallroad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Castle/wallroad.png -------------------------------------------------------------------------------- /samples/Cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Cat.png -------------------------------------------------------------------------------- /samples/Cats.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Cats.png -------------------------------------------------------------------------------- /samples/Cave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Cave.png -------------------------------------------------------------------------------- /samples/Chess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Chess.png -------------------------------------------------------------------------------- /samples/Circles/b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circles/b.png -------------------------------------------------------------------------------- /samples/Circles/b_half.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circles/b_half.png -------------------------------------------------------------------------------- /samples/Circles/b_i.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circles/b_i.png -------------------------------------------------------------------------------- /samples/Circles/b_quarter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circles/b_quarter.png -------------------------------------------------------------------------------- /samples/Circles/data.xml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /samples/Circles/w.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circles/w.png -------------------------------------------------------------------------------- /samples/Circles/w_half.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circles/w_half.png -------------------------------------------------------------------------------- /samples/Circles/w_i.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circles/w_i.png -------------------------------------------------------------------------------- /samples/Circles/w_quarter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circles/w_quarter.png -------------------------------------------------------------------------------- /samples/Circuit/bridge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circuit/bridge.png -------------------------------------------------------------------------------- /samples/Circuit/component.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circuit/component.png -------------------------------------------------------------------------------- /samples/Circuit/connection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circuit/connection.png -------------------------------------------------------------------------------- /samples/Circuit/corner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circuit/corner.png -------------------------------------------------------------------------------- /samples/Circuit/data.xml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /samples/Circuit/dskew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circuit/dskew.png -------------------------------------------------------------------------------- /samples/Circuit/skew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circuit/skew.png -------------------------------------------------------------------------------- /samples/Circuit/substrate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circuit/substrate.png -------------------------------------------------------------------------------- /samples/Circuit/t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circuit/t.png -------------------------------------------------------------------------------- /samples/Circuit/track.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circuit/track.png -------------------------------------------------------------------------------- /samples/Circuit/transition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circuit/transition.png -------------------------------------------------------------------------------- /samples/Circuit/turn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circuit/turn.png -------------------------------------------------------------------------------- /samples/Circuit/viad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circuit/viad.png -------------------------------------------------------------------------------- /samples/Circuit/vias.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circuit/vias.png -------------------------------------------------------------------------------- /samples/Circuit/wire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Circuit/wire.png -------------------------------------------------------------------------------- /samples/City.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/City.png -------------------------------------------------------------------------------- /samples/Colored City.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Colored City.png -------------------------------------------------------------------------------- /samples/Dungeon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Dungeon.png -------------------------------------------------------------------------------- /samples/Fabric.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Fabric.png -------------------------------------------------------------------------------- /samples/Flowers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Flowers.png -------------------------------------------------------------------------------- /samples/Forest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Forest.png -------------------------------------------------------------------------------- /samples/Hogs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Hogs.png -------------------------------------------------------------------------------- /samples/Knot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Knot.png -------------------------------------------------------------------------------- /samples/Knots/corner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Knots/corner.png -------------------------------------------------------------------------------- /samples/Knots/cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Knots/cross.png -------------------------------------------------------------------------------- /samples/Knots/data.xml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /samples/Knots/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Knots/empty.png -------------------------------------------------------------------------------- /samples/Knots/line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Knots/line.png -------------------------------------------------------------------------------- /samples/Knots/t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Knots/t.png -------------------------------------------------------------------------------- /samples/Lake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Lake.png -------------------------------------------------------------------------------- /samples/Less Rooms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Less Rooms.png -------------------------------------------------------------------------------- /samples/Link 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Link 2.png -------------------------------------------------------------------------------- /samples/Link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Link.png -------------------------------------------------------------------------------- /samples/Magic Office.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Magic Office.png -------------------------------------------------------------------------------- /samples/Maze.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Maze.png -------------------------------------------------------------------------------- /samples/Mazelike.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Mazelike.png -------------------------------------------------------------------------------- /samples/More Flowers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/More Flowers.png -------------------------------------------------------------------------------- /samples/Mountains.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Mountains.png -------------------------------------------------------------------------------- /samples/Nested.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Nested.png -------------------------------------------------------------------------------- /samples/Office 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Office 2.png -------------------------------------------------------------------------------- /samples/Office.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Office.png -------------------------------------------------------------------------------- /samples/Paths.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Paths.png -------------------------------------------------------------------------------- /samples/Platformer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Platformer.png -------------------------------------------------------------------------------- /samples/Qud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Qud.png -------------------------------------------------------------------------------- /samples/Red Dot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Red Dot.png -------------------------------------------------------------------------------- /samples/Red Maze.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Red Maze.png -------------------------------------------------------------------------------- /samples/Rooms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Rooms.png -------------------------------------------------------------------------------- /samples/Rooms/bend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Rooms/bend.png -------------------------------------------------------------------------------- /samples/Rooms/corner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Rooms/corner.png -------------------------------------------------------------------------------- /samples/Rooms/corridor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Rooms/corridor.png -------------------------------------------------------------------------------- /samples/Rooms/data.xml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /samples/Rooms/door.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Rooms/door.png -------------------------------------------------------------------------------- /samples/Rooms/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Rooms/empty.png -------------------------------------------------------------------------------- /samples/Rooms/side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Rooms/side.png -------------------------------------------------------------------------------- /samples/Rooms/t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Rooms/t.png -------------------------------------------------------------------------------- /samples/Rooms/turn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Rooms/turn.png -------------------------------------------------------------------------------- /samples/Rooms/wall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Rooms/wall.png -------------------------------------------------------------------------------- /samples/Rule 126.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Rule 126.png -------------------------------------------------------------------------------- /samples/Scaled Maze.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Scaled Maze.png -------------------------------------------------------------------------------- /samples/Sewers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Sewers.png -------------------------------------------------------------------------------- /samples/Simple Knot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Simple Knot.png -------------------------------------------------------------------------------- /samples/Simple Maze.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Simple Maze.png -------------------------------------------------------------------------------- /samples/Simple Wall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Simple Wall.png -------------------------------------------------------------------------------- /samples/Skew 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Skew 1.png -------------------------------------------------------------------------------- /samples/Skew 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Skew 2.png -------------------------------------------------------------------------------- /samples/Skyline 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Skyline 2.png -------------------------------------------------------------------------------- /samples/Skyline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Skyline.png -------------------------------------------------------------------------------- /samples/Smile City.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Smile City.png -------------------------------------------------------------------------------- /samples/Spirals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Spirals.png -------------------------------------------------------------------------------- /samples/Summer/cliff 0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/cliff 0.png -------------------------------------------------------------------------------- /samples/Summer/cliff 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/cliff 1.png -------------------------------------------------------------------------------- /samples/Summer/cliff 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/cliff 2.png -------------------------------------------------------------------------------- /samples/Summer/cliff 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/cliff 3.png -------------------------------------------------------------------------------- /samples/Summer/cliffcorner 0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/cliffcorner 0.png -------------------------------------------------------------------------------- /samples/Summer/cliffcorner 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/cliffcorner 1.png -------------------------------------------------------------------------------- /samples/Summer/cliffcorner 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/cliffcorner 2.png -------------------------------------------------------------------------------- /samples/Summer/cliffcorner 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/cliffcorner 3.png -------------------------------------------------------------------------------- /samples/Summer/cliffturn 0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/cliffturn 0.png -------------------------------------------------------------------------------- /samples/Summer/cliffturn 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/cliffturn 1.png -------------------------------------------------------------------------------- /samples/Summer/cliffturn 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/cliffturn 2.png -------------------------------------------------------------------------------- /samples/Summer/cliffturn 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/cliffturn 3.png -------------------------------------------------------------------------------- /samples/Summer/data.xml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /samples/Summer/grass 0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/grass 0.png -------------------------------------------------------------------------------- /samples/Summer/grasscorner 0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/grasscorner 0.png -------------------------------------------------------------------------------- /samples/Summer/grasscorner 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/grasscorner 1.png -------------------------------------------------------------------------------- /samples/Summer/grasscorner 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/grasscorner 2.png -------------------------------------------------------------------------------- /samples/Summer/grasscorner 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/grasscorner 3.png -------------------------------------------------------------------------------- /samples/Summer/road 0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/road 0.png -------------------------------------------------------------------------------- /samples/Summer/road 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/road 1.png -------------------------------------------------------------------------------- /samples/Summer/road 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/road 2.png -------------------------------------------------------------------------------- /samples/Summer/road 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/road 3.png -------------------------------------------------------------------------------- /samples/Summer/roadturn 0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/roadturn 0.png -------------------------------------------------------------------------------- /samples/Summer/roadturn 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/roadturn 1.png -------------------------------------------------------------------------------- /samples/Summer/roadturn 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/roadturn 2.png -------------------------------------------------------------------------------- /samples/Summer/roadturn 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/roadturn 3.png -------------------------------------------------------------------------------- /samples/Summer/water_a 0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/water_a 0.png -------------------------------------------------------------------------------- /samples/Summer/water_b 0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/water_b 0.png -------------------------------------------------------------------------------- /samples/Summer/water_c 0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/water_c 0.png -------------------------------------------------------------------------------- /samples/Summer/watercorner 0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/watercorner 0.png -------------------------------------------------------------------------------- /samples/Summer/watercorner 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/watercorner 1.png -------------------------------------------------------------------------------- /samples/Summer/watercorner 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/watercorner 2.png -------------------------------------------------------------------------------- /samples/Summer/watercorner 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/watercorner 3.png -------------------------------------------------------------------------------- /samples/Summer/waterside 0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/waterside 0.png -------------------------------------------------------------------------------- /samples/Summer/waterside 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/waterside 1.png -------------------------------------------------------------------------------- /samples/Summer/waterside 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/waterside 2.png -------------------------------------------------------------------------------- /samples/Summer/waterside 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/waterside 3.png -------------------------------------------------------------------------------- /samples/Summer/waterturn 0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/waterturn 0.png -------------------------------------------------------------------------------- /samples/Summer/waterturn 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/waterturn 1.png -------------------------------------------------------------------------------- /samples/Summer/waterturn 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/waterturn 2.png -------------------------------------------------------------------------------- /samples/Summer/waterturn 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Summer/waterturn 3.png -------------------------------------------------------------------------------- /samples/Town.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Town.png -------------------------------------------------------------------------------- /samples/Trick Knot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Trick Knot.png -------------------------------------------------------------------------------- /samples/Village.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Village.png -------------------------------------------------------------------------------- /samples/Water.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikarth/wfc_python/997c80be56ef53c55081e54ad376be6f3c179219/samples/Water.png --------------------------------------------------------------------------------