This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "LedControl.h" | |
#define SIZE 8 | |
#define PIN_MATRIX_DATA 55 | |
#define PIN_MATRIX_CLK 56 | |
#define PIN_MATRIX_CS 54 | |
#define PIN_BUTTON 57 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val f: Double => Double = x => x * x // Une fonction, peu importe | |
println(f(_)) // Il s'agit bien d'une fonction (anonyme) | |
val g: Double => Double = f(_) // On peut vérifier qu'elle typecheck | |
// On peut lui appliquer des valeurs normalement (ne pas oublier les parenthèses !) | |
println((f(_))(3)) // Affiche 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Color | |
import java.awt.image.BufferedImage | |
import java.io.File | |
import javax.imageio.ImageIO | |
object RayTracing extends App { | |
private def sq(x: Double): Double = x * x | |
case class Point(x: Double, y: Double, z: Double) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.util.Random | |
import Fiddle.draw._ | |
import org.scalajs.dom.{Event, EventTarget, MouseEvent} | |
import scala.collection.mutable.ArrayBuffer | |
val square = 50 | |
val (width, height) = (Fiddle.canvas.width, Fiddle.canvas.height) | |
val (mapWidth, mapHeight) = (20 * square, 20 * square) | |
val (borderLeft, borderRight, borderTop, borderBottom) = (0, mapWidth, 0, mapHeight) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object CompteBonCombinations extends App { | |
val plates = { | |
val small = (1 to 10).toList | |
val big = List(25, 50, 75, 100) | |
small ++ small ++ big | |
} | |
val grouped = plates.groupBy(identity).mapValues(_.size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reproduction of "Self-Description" by xkcd (https://xkcd.com/688). | |
// @author Florian Cassayre | |
final int PANEL_WIDTH = 500, PANEL_HEIGHT = 400, PADDING = 50, WEIGHT = 4; | |
PFont font; | |
void setup() | |
{ | |
surface.setSize(PANEL_WIDTH * 3 + PADDING * 2, PANEL_HEIGHT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final int INITIAL_K = 0; | |
int k = INITIAL_K; | |
final int POINTS_PER_CLUSTER = 100; | |
final float POINTS_DEVIATION = 50; | |
final int INTERVAL = 100; | |
final ArrayList<Point> points = new ArrayList<Point>(); | |
final ArrayList<Point> centroids = new ArrayList<Point>(); | |
final HashMap<Point, Point> map = new HashMap<Point, Point>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"layers":[{"out_depth":1,"out_sx":24,"out_sy":24,"layer_type":"input"},{"sx":5,"sy":5,"stride":1,"in_depth":1,"out_depth":8,"out_sx":24,"out_sy":24,"layer_type":"conv","l1_decay_mul":0,"l2_decay_mul":1,"pad":2,"filters":[{"sx":5,"sy":5,"depth":1,"w":{"0":-0.002005437436999499,"1":0.11800762769429841,"2":0.15288575246122227,"3":0.17926717613376164,"4":-0.08993469726722844,"5":-0.20254829450417103,"6":0.15791114405597814,"7":0.31846451260019604,"8":0.01467962792660115,"9":-0.13848296305157726,"10":0.10341788356249301,"11":-0.06268045391638183,"12":0.6978074481239207,"13":-0.2938077242420065,"14":-0.5089319294176927,"15":-0.12264368305380181,"16":0.44763879656035277,"17":0.3359516007279942,"18":-0.06184286836783794,"19":-0.482255823490501,"20":0.3677897224446566,"21":0.10207491930585594,"22":0.21835092856908758,"23":-0.02092531346874951,"24":0.13842120306943864}},{"sx":5,"sy":5,"depth":1,"w":{"0":-0.43289539339825756,"1":-0.5130859925805419,"2":0.02528701695327489,"3":0.3359550133438127,"4":0.218543747256232,"5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final int HIDDEN_LAYERS = 1; | |
final int INPUTS = 4 * 2; | |
final int OUTPUTS = 4; | |
final int NEURONS_PER_LAYER = 16; | |
final float LEARNING_RATE = 0.1; | |
final float[][] neurons = new float[2 + HIDDEN_LAYERS][]; // [layer][neuron] | |
final float[][][] axons = new float[1 + HIDDEN_LAYERS][][]; // [layer][previous_neuron][next_neuron] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum BrainfuckInstruction | |
{ | |
INCREMENT('+'), | |
DECREMENT('-'), | |
CURSOR_RIGHT('>'), | |
CURSOR_LEFT('<'), | |
LOOP_START('['), | |
LOOP_END(']'), | |
INPUT(','), | |
OUTPUT('.'); |