Skip to content

Instantly share code, notes, and snippets.

View smwhr's full-sized avatar

Ju/Smwhr smwhr

View GitHub Profile
@smwhr
smwhr / 01_inheritance.py
Last active July 26, 2023 09:42
Julien Raconte : la composition
class Vehicle:
def drive(self):
print("Vroum Vroum")
class Bike (Vehicle):
def drive(self):
print("Swissssh")
class Car (Vehicle):
pass
-- An online type checker for the Haskell programming language (see haskell.org).
-- Fix the typo to get rid of the compilation error.
val = filter (divides 3) [1..10]
where divides n x = (x `mod` n) == 0
main = putStrLn (show val)
-- Click the button below the code editor to evaluate 'main'.
-- That was easy!
// KNOWLEDGE FUNCTIONS
VAR knowledgeState = ()
=== function learn(x) ===
// learn this fact
~ knowledgeState += x
=== function learnt(x) ===
// have you learnt this fact, or indeed a stronger one
~ return highest_state_for_set_of_state(x) >= x
@smwhr
smwhr / folded.cartdrige.json
Created September 14, 2022 12:01
Engine.lol folded
{"scene_count":1,"start_scene":{"x":"0","y":"2"},"cartridge":null,"audio":null,"audio_loop":true,"font":"default","s":[{"x":0,"y":0,"active":true,"color":"#000000","textoverlay":"\n\n\n\n\n\n\n\n end 1\n","object_count":0,"objects":[]},null,{"x":0,"y":2,"active":true,"color":"#000000","textoverlay":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n down","object_count":0,"objects":[]},null,{"x":0,"y":4,"active":true,"color":"#000000","textoverlay":"\n\n\n\n\n\n\n\n end 4\n","object_count":0,"objects":[]},{"x":1,"y":0,"active":true,"color":"#000000","textoverlay":" consequence","object_count":0,"objects":[]},{"x":1,"y":1,"active":true,"color":"#000000","textoverlay":"\n\n\n\n\n\n\nsucceed\n\n\n\n\n\n\n\n\n fail","object_count":0,"objects":[]},{"x":1,"y":2,"active":true,"color":"#000000","textoverlay":"\n\n\n\n\n\n\n\nleft right","object_count":0,"o
@smwhr
smwhr / crime-scene.ink
Last active June 17, 2022 08:19
Crime Scene from Inkle to Binksi
Crime Scene -- Script by Inkle, adapted by @smwhr for binksi#TITLE
SPAWN_AT(lamp-on-desk, lamp)
-> murder_scene
// Helper function: popping elements from lists
=== function pop(ref list)
~ temp x = LIST_MIN(list)
@smwhr
smwhr / vocal.js
Last active January 28, 2021 16:48
Parseur vocal pour Parchment
var SpeechRecognition = SpeechRecognition || webkitSpeechRecognition
var SpeechGrammarList = SpeechGrammarList || webkitSpeechGrammarList
var SpeechRecognitionEvent = SpeechRecognitionEvent || webkitSpeechRecognitionEvent
var commands = [ 'nord', 'sud', 'est', 'ouest', 'examiner', 'regarder', 'inventaire', 'encore', 'prendre'];
var grammar = '#JSGF V1.0; grammar commands; public <command> = ' + commands.join(' | ') + ' ;'
var recognition = new SpeechRecognition();
var speechRecognitionList = new SpeechGrammarList();
speechRecognitionList.addFromString(grammar, 1);
@smwhr
smwhr / map.php
Created November 26, 2020 22:39
Pirate map
<?php
const TY_PATH = "https://troisyaourts.com/~smwhr/supinternet/tileset";
class Tile{
protected $char;
protected $img_url;
protected $css_class="";
@smwhr
smwhr / algo_plus_court.md
Last active December 10, 2020 15:44
Graphe trajets SNCF

Algorithme du plus court chemin

On souhaite aller de Lyon à Toulouse On commence par écrire une table de toutes les destinations possibles (on va utiliser Reachable)

Lyon            # 0 (depuis Lyon)  
Paris           # 107 (depuis Lyon)  
Rennes          # 107 + 114 = 221 (depuis Paris)
Londres         # 280 + 61  = 341 (depuis Calais)
 # 107 + 146 = 253 (depuis Paris)
[
["name" => "Départ", "color" => "no", "special" => "start"],
["name" => "Boulevard de Belleville", "color" => "pink", "price" => 6],
["name" => "Caisse de Communauté", "color" => "no", "special" => "community"],
["name" => "Rue Lecourbe", "color" => "pink", "price" => 6],
["name" => "Impots sur le revenue", "color" => "no", "special" => "revenue_tax"],
["name" => "Gare Montparnasse", "color" => "black", "price" => 20],
["name" => "Rue de Vaugirard", "color" => "blue", "price" => 10],
["name" => "Chance", "color" => "no", "special" => "luck"],
["name" => "Rue de Courcelles", "color" => "blue", "price" => 10],
@smwhr
smwhr / Character.php
Created March 11, 2019 11:56
POO 101
<?php
require_once("DoorOpening.php");
class Character{
var $health = 100; //int
var $strength = 5; //int
var $defence = 3; //int
var $age = 1; //int
var $name; //string