Skip to content

Instantly share code, notes, and snippets.

View razimantv's full-sized avatar

Raziman T V razimantv

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@razimantv
razimantv / population_evolution.cpp
Last active November 20, 2018 21:50
Dependence of population evolution on age of giving birth
#include <fstream>
#include <iostream>
#include <random>
#include <set>
#include <string>
#include <tuple>
// Birth/death events
// If birth: time, +1, 0
// If death: time, -1, birthday
@razimantv
razimantv / Pi_MC.ipynb
Created October 4, 2018 12:37
Monte Carlo estimation of Pi
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@razimantv
razimantv / ImpossiblePuzzle.ipynb
Last active October 4, 2018 00:50
Programmatic solution to the "Impossible puzzle"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@razimantv
razimantv / battleship.cpp
Created February 25, 2018 23:19
Given the shape of a ship and the location of one cell, bomb the remaining cells in minimum attempts
#include <iostream>
#include <map>
#include <random>
#include <tuple>
#include <vector>
std::random_device rd;
std::mt19937 gen(rd());
typedef std::vector<std::string> pattern;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@razimantv
razimantv / covfefe.ipynb
Created January 5, 2018 10:51
Solving the covfefe problem
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@razimantv
razimantv / unruly.cpp
Last active July 13, 2021 08:06
Solution for the "Unruly" game from Simon Tatham's puzzle collection
#include <iostream>
#include <iterator>
#include <numeric>
#include <queue>
#include <string>
#include <vector>
bool notblocked(const std::string& str, char c) {
int L = str.size();
if (L < 2) return true;
@razimantv
razimantv / circles.cpp
Created December 30, 2017 11:52
Convert an image into one made out of coloured circles with mean pixel values
#include <algorithm>
#include <cmath>
#include <iostream>
#include <random>
#include <string>
#include <vector>
// RGB values
// Add arithmetic operations to take means squared deviations
struct rgb {
@razimantv
razimantv / primes.py
Created December 10, 2017 21:44
Prime tree elements
primes = [2, 3, 5, 7]
parent = [-1, -1, -1, -1]
digits = [1, 3, 7, 9]
def isprime(N):
i = 2
while i * i <= N:
if N % i == 0:
return False
i += 1