Compare commits

...

5 Commits

Author SHA1 Message Date
Rob Heaton
093d218e79 Update LICENSE 2019-11-03 09:46:31 -05:00
Rob Heaton
4e47f5bf9b Merge pull request #4 from Vaskivo/migrate-to-python-3
Migrate to Python 3
2019-07-25 19:03:08 -07:00
Vasco Correia
dd55346e98 Migrate to Python 3 2019-07-22 23:09:18 +01:00
Rob Heaton
d09545ff00 Update README.md 2019-07-21 07:35:53 -07:00
Rob Heaton
31133425f6 Update README.md 2019-03-09 11:25:25 -08:00
3 changed files with 25 additions and 24 deletions

37
LICENSE
View File

@@ -1,21 +1,24 @@
MIT License
This is free and unencumbered software released into the public domain.
Copyright (c) 2019 Rob Heaton
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
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:
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS 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 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.
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.
For more information, please refer to <https://unlicense.org>

View File

@@ -1,12 +1,10 @@
# Wavefunction Collapse
This is the example code for my blog post,
"The Wavefunction Collapse Algorithm explained
very clearly". To install dependencies:
This is the example code for my blog post, ["The Wavefunction Collapse Algorithm explained very clearly"](https://robertheaton.com/2018/12/17/wavefunction-collapse-algorithm/). To install dependencies:
```
virtualenv vendor
source vendor/bin/active
source vendor/bin/activate
pip install -r requirements.txt
```

View File

@@ -143,13 +143,13 @@ class Wavefunction(object):
"""
x, y = co_ords
opts = self.coefficients[x][y]
valid_weights = {tile: weight for tile, weight in self.weights.iteritems() if tile in opts}
valid_weights = {tile: weight for tile, weight in self.weights.items() if tile in opts}
total_weights = sum(valid_weights.values())
rnd = random.random() * total_weights
chosen = None
for tile, weight in valid_weights.iteritems():
for tile, weight in valid_weights.items():
rnd -= weight
if rnd < 0:
chosen = tile
@@ -272,7 +272,7 @@ def render_colors(matrix, colors):
color = colors[val]
output_row.append(color + val + colorama.Style.RESET_ALL)
print "".join(output_row)
print("".join(output_row))
def valid_dirs(cur_co_ord, matrix_size):