Skip to content

Instantly share code, notes, and snippets.

View SohanChy's full-sized avatar

Sohan Chowdhury SohanChy

View GitHub Profile
#include <iostream>
#include <GL/gl.h>
#include <GL/glut.h>
#include <math.h>
#define PI 3.14159265
using namespace std;
int a,b,r;
#include <stdio.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <math.h>
void eightSideDisp(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (0.0, 0.0, 1.0);
glPointSize(5.0);
@SohanChy
SohanChy / scaling.cpp
Last active March 1, 2018 19:48
scaling glut mat mul
#include <stdio.h>
#include<GL/gl.h>
#include <GL/glut.h>
#include <iostream>
using namespace std;
int x[4],y[4];
int trans[2][1];
@SohanChy
SohanChy / linealgo.cpp
Created February 20, 2018 06:55
linealgo
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include<GL/gl.h>
#include <GL/glut.h>
using namespace std;
double pointX1, pointY1, pointX2, pointY2;
#include <stdio.h>
#include<GL/gl.h>
#include <GL/glut.h>
void myDisplay(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3ub(0, 0, 0);
glPointSize(4.0);
@SohanChy
SohanChy / ga_base.py
Last active November 29, 2017 19:40
Basic Genetic Algorithm _ Writes "The Road Not Taken" by Robert Frost
import copy
import random
class Individual:
"""Individual Gene"""
def __init__(self, gene_length, filler, fitness_func, random_func, rand=True):
self.gene_length = gene_length
self.fitness_func = fitness_func
self.random_func = random_func
self.filler = filler
@SohanChy
SohanChy / nqeeun.py
Last active November 22, 2017 09:47
NQueen
def is_under_attack(nq_arr,y,x):
for i in range(y):
#print(nq_arr,i,y,x)
if(nq_arr[i] == x):
return True
if( abs(y - i) == abs (x - nq_arr[i]) ):
return True
return False
def draw_board(nq_arr):
@SohanChy
SohanChy / n_puzzle_solvability
Created November 15, 2017 09:43
N Puzzle Solvability
first_prob_arr =[
[6,1,10,2],
[7,11,4,14],
[5,None,9,15],
[8,12,13,3]
]
ex_prob_1 =[
[7,1,2],
[5,None,4],
@SohanChy
SohanChy / Astar.py
Created November 14, 2017 19:12
AI Book Searching Algorithms
romania_map = {
"Arad": {"Zerind": 75, "Timisoara": 118, "Sibiu": 140},
"Zerind": {"Arad": 75, "Oradea": 71},
"Oradea": {"Zerind": 71, "Sibiu": 151},
"Timisoara": {"Arad": 118, "Lugoj": 111},
"Lugoj": {"Timisoara": 111, "Mehadia":70},
"Mehadia": {"Lugoj": 70, "Dobreta": 75},
"Dobreta": {"Mehadia":75, "Craiova":120},
"Craiova": {"Dobreta": 120, "RimnicuVilcea": 146, "Pitesi": 138},
"RimnicuVilcea": {"Craiova": 146, "Pitesi": 97, "Sibiu":80},
@SohanChy
SohanChy / result_checker.py
Created May 6, 2017 17:35
A python script to periodically check if SSC resulthas been published or not
from urllib.parse import urlencode
from urllib.request import Request, urlopen
from os import popen
import threading
def check_result():
"""A python script to periodically check if SSC resulthas been published or not"""
timer = 5.0 #seconds
print("checking...")