author | date | company | department | institute |
---|---|---|---|---|
Pascal Albert Zosso |
2020-08-25 |
HEIG-VD |
TIN |
IAI |
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 <regex.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdbool.h> | |
/** | |
* Convert a regex match into an integer | |
*/ | |
int to_integer(regmatch_t match, const char* str) { |
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
#!/usr/bin/env python3 | |
import yaml | |
def note(got, total): | |
return round(got / total * 5. + 1., 1) | |
def get_points(u): | |
got = 0 | |
total = 0 | |
for k, v in u.items(): |
Dans l'ensemble vous faites du bon travail. Le code est minimaliste, propre et souvent fonctionnel.
Rappelez-vous que c'est le résultat qui compte. Donc si vous avez un joli code mais qu'il ne passe pas les tests, vous perdez des points.
Voici quelques points d'amélioration utiles pour les futures labos.
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
/** | |
* Boid (Bird-oid). An artificial life simulation of a single | |
* boid initially developed by Craig Reynolds in 1986 and based | |
* on three rules: Separation, Cohesion and Alignment. | |
*/ | |
#include <cmath> | |
#include <functional> | |
#include <random> |
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
#define _POSIX_SOURCE | |
#include <stdlib.h> | |
#include <curses.h> | |
#include <signal.h> | |
#include <sys/time.h> | |
#include <errno.h> | |
#include <time.h> | |
#include <string.h> | |
#include <stdbool.h> |
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 <SFML/Graphics.hpp> | |
#include <SFML/Graphics/Color.hpp> | |
#include <algorithm> | |
#include <cmath> | |
struct HSL { | |
double Hue; | |
double Saturation; | |
double Luminance; |
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
""" Monty Hall Problem - The Game | |
https://fr.wikipedia.org/wiki/Probl%C3%A8me_de_Monty_Hall | |
Supposez que vous êtes sur le plateau d'un jeu télévisé, face à trois portes | |
et que vous devez choisir d'en ouvrir une seule, en sachant que derrière l'une | |
d'elles se trouve une voiture et derrière les deux autres des chèvres. | |
Vous choisissez une porte, disons la numéro 1, et le présentateur, qui sait, | |
lui, ce qu'il y a derrière chaque porte, ouvre une autre porte, disons la numéro 3, | |
porte qui une fois ouverte découvre une chèvre. |
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
/** | |
* Generate a Sudoku grid. | |
* Author: Y. Chevallier <yves.chevallier@heig-vd.ch> | |
*/ | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <time.h> |
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
#pragma once | |
#include <iostream> | |
#include <cmath> | |
template <class T> | |
class Vector2 { | |
public: | |
using value_type = T; |