Skip to content

Instantly share code, notes, and snippets.

View bhugueney's full-sized avatar

bhugueney

View GitHub Profile
@bhugueney
bhugueney / chaos-game.py
Created January 2, 2018 21:24
Chaos game en python
import sys
import math
import random
def midpoint(p0, p1):
(x0, y0)= p0
(x1, y1)= p1
return ((x0 + x1)/2, (y0 + y1)/2)
@bhugueney
bhugueney / pendu.cxx
Created January 2, 2018 21:19
Pendu en C++ (traduction de python)
#include <iostream>
#include <string>
#include <vector>
std::string initialiser_mot_mystere(std::string const& mot){
std::string res;
for(std::size_t i=0; i != mot.size(); ++i){
res.push_back('_');
}
return res;
This file has been truncated, but you can view the full file.
nom_commune;latitude;longitude
Attignat;46.283333;5.166667
Beaupont;46.4;5.266667
Bény;46.333333;5.283333
Béreyziat;46.366667;5.05
Bohas-Meyriat-Rignat;46.133333;5.4
Bourg-en-Bresse;46.2;5.216667
Buellas;46.2;5.133333
Certines;46.133333;5.266667
Ceyzériat;46.166667;5.316667
@bhugueney
bhugueney / ExampleReadFile.java
Last active May 18, 2017 22:19
Reading lines from a file in Java
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
public class ExampleReadFile{
@bhugueney
bhugueney / GoGUI.java
Created January 24, 2017 13:37
minimal Goban
public class GoGUI {
final static int SIZE= 8;
final static double EMPTY_RADIUS=0.1;
final static double STONE_RADIUS=0.45;
final static String PASS_STRING= "PASS";
final static int PASS_X=0;
public static void main(String args[]){
StdDraw.setXscale(-1, SIZE);
StdDraw.setYscale(-1, SIZE);
@bhugueney
bhugueney / Test-org-reveal-Klipse.org
Created September 11, 2016 14:21
Trying to use Klipse in org reveal

Trying to use Klipse

With code tag

test

(ns physics-demos.fractals
(:require
[thi.ng.geom.core :as g]
[thi.ng.geom.core.vector :as v :refer [vec2 vec3]]
[thi.ng.geom.core.matrix :as mat :refer [M32 M44]]
[thi.ng.geom.circle :as c]
[thi.ng.geom.spatialtree :as accel]
[thi.ng.geom.svg.core :as svg]
[thi.ng.geom.physics.core :as phys]
[thi.ng.geom.webgl.animator :refer [animate]]
@bhugueney
bhugueney / loco_example.clj
Created April 14, 2016 15:28
arithmetic constraints puzzle with Clojure / Loco
;; cf https://github.com/aengelberg/loco/blob/master/test/loco/integer/sendmoremoney1.clj
(ns constrained-grouping.core
(:use loco.constraints
loco.core))
(defn initialize-digits [vars]
(for [v vars]
($in v 0 9)))
(def letters
import math
import turtle
def rotate(a, v):
(x, y)= v
return (math.cos(a)*x - math.sin(a)*y, math.sin(a)*x + math.cos(a)*y)
def demo0(n):
angle_step= 2*math.pi/n
p= (0,100)
import turtle
import math
import random
import sys
# point is (x,y,z) float cooords
# polygon is ([points], color) is oriented for vector product to know if facing
# object is [polygons] is convex (cf. orientation)
# rotating_object is (object, (a,(u,v,w)) angle and axis of rotation (center of rotation is barycenter of object)
# figure is [rotating_objects]