Skip to content

Instantly share code, notes, and snippets.

View wasi0013's full-sized avatar
💤

Wasi wasi0013

💤
View GitHub Profile
@wasi0013
wasi0013 / send_more_money.cpp
Created May 10, 2015 12:32
SEND MORE MONEY riddle in Artificial Intelligence
#include"bits/stdc++.h"
/*
Problem Name: SEND MORE MONEY riddle in Artificial Intelligence
Problem Category:
-----------------
Constraint Optimisation Problem
Problem Description:
--------------------
SEND
+ MORE
@wasi0013
wasi0013 / crypto.py
Last active August 29, 2015 14:14
Various crypto algorithims simple implementations
__author__ = 'wasi0013'
#Algorithm resources: http://crypto.interactive-maths.com/introduction-to-cryptography.html
def caeser_encrypt(text, key):
"""
Takes string as text and encrypts it with the key
>>> caeser_encrypt("Hello World",2)
'JGNNQ YQTNF'
>>> caeser_encrypt("Hello World",0)
'HELLO WORLD'
@wasi0013
wasi0013 / Sudoku.py
Last active August 29, 2015 14:06
Naive sudoku solver
import cProfile
def row_check(i,j): return i//9==j//9
def col_check(i,j): return (i-j)%9==0
def blocks_check(i,j): return i//27==j//27 and (i%9)//3==(j%9)//3
def show(grid):
print "".join(num+" "+" "*((i+1)%3==0)+"\n"*((i+1)%9==0) for i,num in enumerate(grid))
def solve(grid):
@wasi0013
wasi0013 / N-Queen.cpp
Last active August 29, 2015 14:05
This is a simple 8-Queen puzzle solution written in C++
#include"bits/stdc++.h"
using namespace std;
main(){
int vec[]={0,1,2,3,4,5,6,7},n=8,c=0;
set <int> mset,nset;
set<int>::iterator it;
do{
mset.clear();
nset.clear();