Skip to content

Instantly share code, notes, and snippets.

@rymate1234
rymate1234 / ai.js
Last active August 29, 2015 13:57 — forked from bbarry/ai.js
var log2 = Math.log2;
if(!log2) {
log2 = function (x) { return Math.log(x) / Math.LN2; };
}
function Ai() {
var score = function (grid, previous) {
var total = 0, count = 0, ptotal = 0, pcount = 0;
grid.eachCell(function (x, y, tile) {
if (tile) { total += (log2(tile.value)-1)*tile.value; count += 1; }
/*
* Blur.js
* Copyright Jacob Kelley
* MIT License
*/
(function ($) {
$.fn.blurjs = function (options) {
var canvas = document.createElement('canvas');
var isCached = false;
@rymate1234
rymate1234 / wormy.py
Created December 23, 2012 13:41 — forked from anonymous/wormy.py
# Wormy (a Nibbles clone)
# By Al Sweigart al@inventwithpython.com
# http://inventwithpython.com/pygame
# Released under a "Simplified BSD" license
# This comment serves to tets git commiting with gist. Ignore me.
#KRT 14/06/2012 modified Start Screen and Game Over screen to cope with mouse events
#KRT 14/06/2012 Added a non-busy wait to Game Over screen to reduce processor loading from near 100%
import random, pygame, sys