This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Wormy (a Nibbles clone) | |
# By Al Sweigart [email protected] | |
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Blur.js | |
* Copyright Jacob Kelley | |
* MIT License | |
*/ | |
(function ($) { | |
$.fn.blurjs = function (options) { | |
var canvas = document.createElement('canvas'); | |
var isCached = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } |