This file contains 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
import Image,sys,struct,time,os | |
BLACK,WHITE = 0,1 | |
def rasterToImg(name,width,height,directions): | |
name,ext = os.path.splitext(name) | |
arr = [WHITE for j in range(0,width*height)] | |
x,y = 0,0 | |
size = width,height | |
dic = {"N":(0,-1), "S" : (0,1) , "E" : (1,0), "W" : (-1,0)} |
This file contains 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
def encodingDict(scrambledAlphabet): | |
adfgvxIndex = ['A','D','F','G','V','X'] | |
encodeDict = {} | |
for i in range(0,6): | |
for j in range(0,6): | |
encodeDict[scrambledAlphabet[i*6+j]] = adfgvxIndex[i]+adfgvxIndex[j] | |
return encodeDict | |
def DecryptOnSpace(encryptedString,codeWord): |
This file contains 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
def normalize(plainString,scrambledAlphabet): | |
plainString = plainString.upper().replace("J","I") | |
for letter in plainString: | |
if letter not in scrambledAlphabet: | |
plainString = plainString.replace(letter,'') | |
#print(plainString) | |
return plainString |
This file contains 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
"""CONVENTIONS: | |
positions are done row-column from the bottom left and are both numbers. This corresponds to the alpha-number system in traditional chess while being computationally useful. they are specified as tuples | |
""" | |
import itertools | |
WHITE = "white" | |
BLACK = "black" | |
This file contains 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
from __future__ import division | |
import sys, pygame, time | |
import numpy as N | |
import pygame.surfarray as surfarray | |
pygame.init() | |
size = width, height = 1024,768 | |
xlength,xoffset = 3.5, -2.5 |
NewerOlder