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
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<canvas id="gameCanvas" width="800" height="600"></canvas> | |
<script> | |
var canvas; |
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
''' | |
Created on Feb 24, 2015 | |
Sample text is an excerpt from Chapter 2 of the Adventures of Huckleberry Finn | |
''' | |
import operator, string | |
class TextParser: | |
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
''' | |
Created on Feb 24, 2015 | |
''' | |
# Recursive Method calculating Fibonacci Number for n | |
def fibRecursion(n): | |
if (n == 0) : | |
return 0 | |
elif (n == 1): | |
return 1 |
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
''' | |
Created on Feb 24, 2015 | |
''' | |
# Method to determine if a number is a prime number | |
def isPrime(num): | |
if num <= 0 : | |
print("Number must be a positive integer greater than zero") | |
return False | |
elif (num == 1): |
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
''' | |
Created on Feb 24, 2015 | |
''' | |
import re | |
# Create a dictionary to store the cipher | |
cipher = { | |
'A':'N','B':'O','C':'P','D':'Q','E':'R','F':'S','G':'T','H':'U','I':'V','J':'W','K':'X','L':'Y','M':'Z', | |
'N':'A','O':'B','P':'C','Q':'D','R':'E','S':'F','T':'G','U':'H','V':'I','W':'J','X':'K','Y':'L','Z':'M', | |
'a':'n','b':'o','c':'p','d':'q','e':'r','f':'s','g':'t','h':'u','i':'v','j':'w','k':'x','l':'y','m':'z', |
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
''' | |
Created on Feb 24, 2015 | |
''' | |
import sys | |
# Recursive method to create the mathematical series | |
def pascal(col,row): | |
if(col == 0) or (col == row): | |
return 1 | |
else: |
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
cipher = "10101111" -- must be eight digit binary number | |
--Returns the XOR of two binary numbers | |
function xor(a,b) | |
local r = 0 | |
local f = math.floor | |
for i = 0, 31 do | |
local x = a / 2 + b / 2 | |
if x ~= f(x) then | |
r = r + 2^i |
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
--Create a table to store the cipher | |
cipher = { | |
A="N",B="O",C="P",D="Q",E="R",F="S",G="T",H="U",I="V",J="W",K="X",L="Y",M="Z", | |
N="A",O="B",P="C",Q="D",R="E",S="F",T="G",U="H",V="I",W="J",X="K",Y="L",Z="M", | |
a="n",b="o",c="p",d="q",e="r",f="s",g="t",h="u",i="v",j="w",k="x",l="y",m="z", | |
n="a",o="b",p="c",q="d",r="e",s="f",t="g",u="h",v="i",w="j",x="k",y="l",z="m" | |
} | |
--Function encrypts and decrypts using ROT13 | |
function ROT13(str) |
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
--Recursive function to create the mathemeatical series | |
function pascal(col,row) | |
if(col == 0) or (col == row) then return 1 | |
else return pascal(col-1,row-1) + pascal(col,row-1) | |
end | |
end | |
--Prints Pascal's Triangle to the 'n'th row | |
function PascalTriangle(num) | |
if (num <= 0) then print("Number must be greater than zero") return end |
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
---Function to determine if a number is a prime number | |
function isPrime(num) | |
if num <= 0 then | |
print("Number must be a positive integer greater than zero") | |
return false | |
elseif num == 1 then return true end | |
--[[Prime number is divisable by itself and one, | |
so we check for other factors between the prime number and one. (1 < x < num) | |
]] | |
for x = num-1,2,-1 do |
NewerOlder