Skip to content

Instantly share code, notes, and snippets.

View DustinAlandzes's full-sized avatar

Dustin Alandzes DustinAlandzes

View GitHub Profile
import pytest
from channels.generic.websocket import (
AsyncJsonWebsocketConsumer, AsyncWebsocketConsumer, JsonWebsocketConsumer, WebsocketConsumer,
)
from channels.testing import WebsocketCommunicator
import asyncio
from django.conf import settings
settings.configure(
DATABASES={

Generating Procedural Game Worlds with Wave Function Collapse

Wave Function Collapse (WFC) by @exutumno is a new algorithm that can generate procedural patterns from a sample image. It's especially exciting for game designers, letting us draw our ideas instead of hand coding them. We'll take a look at the kinds of output WFC can produce and the meaning of the algorithm's parameters. Then we'll walk through setting up WFC in javascript and the Unity game engine.

sprites

The traditional approach to this sort of output is to hand code algorithms that generate features, and combine them to alter your game map. For example you could sprinkle some trees at random coordinates, draw roads with a brownian motion, and add rooms with a Binary Space Partition. This is powerful but time consuming, and your original vision can someti

//single file version of https://github.com/kchapelier/wavefunctioncollapse
function randomIndice (array, r) {
var sum = 0,
i,
x;
for (i = 0; i < array.length; i++) {
sum += array[i];
}
from craigslist import CraigslistGigs, CraigslistJobs
sites = [
'sanantonio',
'sanmarcos',
'austin',
'dallas',
'houston',
'galveston',
'laredo',
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from django.conf.urls import url
from api.views import ... guest_signup ..
urlpatterns = [
url(r'^guest_signup/$', guest_signup),
]
from django.contrib.auth import authenticate, get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.utils.translation import ugettext as _
from rest_framework import serializers
from rest_framework_jwt.serializers import JSONWebTokenSerializer
from rest_framework_jwt.settings import api_settings
import jwt
jwt_payload_handler = api_settings.JWT_PAYLOAD_HANDLER
fileName="monoKeys.xml"
# check to see if the file exists
if [ ! -f $fileName ]; then
echo "File not found!"
if [ -e "$fileName.copy" ]; then
cp "$fileName.copy" $fileName
echo "Copy restored"
else
echo "No copy available"
from math import log
def arbitrage(table):
transformed_graph = [[-log(edge) for edge in row] for row in graph]
# Pick any source vertex -- we can run Bellman-Ford from any vertex and
# get the right result
source = 0
n = len(transformed_graph)
min_dist = [float('inf')] * n