Skip to content

Instantly share code, notes, and snippets.

View Paul-cbt's full-sized avatar
🖥️
Coding

Paul Caubet Paul-cbt

🖥️
Coding
View GitHub Profile
@Paul-cbt
Paul-cbt / doudouFrench.dart
Created October 25, 2021 17:16
doudouFrench
import 'dart:math';
int nombreExecution = 1000000;
void main(List<String> arguments) {
Status getNextStatus(Status currentStatus) {
var random = Random();
switch (currentStatus) {
case Status.dormir:
if (random.nextInt(10) == 1) {
@Paul-cbt
Paul-cbt / doudouEnglish.dart
Created October 25, 2021 17:18
doudouEnglish
import 'dart:math';
int numberOfRuns = 1000000;
void main(List<String> arguments) {
Status getNextStatus(Status currentStatus) {
var random = Random();
switch (currentStatus) {
case Status.sleep:
if (random.nextInt(10) == 1) {
enum Status {
dormir,
reveil,
manger,
exercice,
}
class Resultat {
int numberOfDormir;
int numberOfMangeoire;
int numberOfRoue;
Resultat({
required this.numberOfDormir,
required this.numberOfMangeoire,
required this.numberOfRoue,
});
Status getNextStatus(Status currentStatus) {
var random = Random();
switch (currentStatus) {
case Status.dormir:
if (random.nextInt(10) == 1) {
//une chance sur dix
//one in ten chance
return Status.reveil;
} else {
Resultat run(Status baseStatus) {
var currentStatus = baseStatus;
var numberOfDormir = 0;
var numberOfMangeoire = 0;
var numberOfRoue = 0;
return Resultat(
numberOfDormir: numberOfDormir,
numberOfMangeoire: numberOfMangeoire,
Resultat run(Status baseStatus) {
var currentStatus = baseStatus;
var numberOfDormir = 0;
var numberOfMangeoire = 0;
var numberOfRoue = 0;
for (var i = 0; i < nombreExecution; i++) {
switch (currentStatus) {
case Status.dormir:
const int nombreExecution = 10000000;
void start() {
var endResult =
Resultat(numberOfDormir: 0, numberOfMangeoire: 0, numberOfRoue: 0);
var resultDormir = run(Status.dormir);
endResult = endResult.add(
resultDormir); //faire tourner une fois avec situation intitale dormir
var resultReveil = run(Status.reveil);
class Resultat {
int numberOfDormir;
int numberOfMangeoire;
int numberOfRoue;
//à ajouter
Resultat add(Resultat currentResult) {
return Resultat(
numberOfDormir: numberOfDormir + currentResult.numberOfDormir,
numberOfMangeoire: numberOfMangeoire + currentResult.numberOfMangeoire,