Skip to content

Instantly share code, notes, and snippets.

View gangsterveggies's full-sized avatar

Pedro Paredes gangsterveggies

  • Princeton
  • New Jersey
View GitHub Profile
#include <stdio.h>
#define INF 1000000000
struct node
{
node *left, *right;
int l, r;
int vl;
} typedef node;
#include <stdio.h>
#include <stdlib.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/wait.h>
@gangsterveggies
gangsterveggies / mcint2
Created September 10, 2013 15:33
Monte Carlo Integral Calculator
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
double f(double x)
{
return exp(x) * x;
}
@gangsterveggies
gangsterveggies / mcint
Created September 10, 2013 15:30
A Monte Carlo Integral calculator
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
double f(double x)
{
return exp(x) * x;
}
@gangsterveggies
gangsterveggies / mcpi
Last active December 22, 2015 18:09
A Monte Carlo Method to estimate the value of PI
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
int main(int argc, char** argv)
{
if (argc != 2)
{
printf("Arguments error...\n Correct form: ./mcpi <n>\n");
@gangsterveggies
gangsterveggies / SuperTicTacToe
Created November 27, 2012 19:31
Tic-Tac-Toe game to show the Alpha-Beta-Prune strategy
/*
*
* Copyright (c) Pedro Paredes (DCC/FCUP) 2012
*
* SuperTicTacToe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SuperTicTacToe is distributed in the hope that it will be useful,