diff --git a/.DS_Store b/.DS_Store index 8ae18a8..bb9ae5e 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Pong-Baptiste/main.py b/Pong-Baptiste/main.py index c5b9c34..fd82713 100644 --- a/Pong-Baptiste/main.py +++ b/Pong-Baptiste/main.py @@ -1,11 +1,13 @@ -#Pong +#!/usr/bin/env python + +"""Début de jeu de pong fait avec baptiste.""" import pygame pygame.init() -gameDisplay = pygame.display.set_mode((800,600)) -pygame.display.set_caption('baptiste') +gameDisplay = pygame.display.set_mode((800, 600)) +pygame.display.set_caption("baptiste") clock = pygame.time.Clock() running = True @@ -19,4 +21,4 @@ while running: print(event) pygame.display.update() - clock.tick(60) \ No newline at end of file + clock.tick(60) diff --git a/Puissance4/main.py b/Puissance4/main.py old mode 100644 new mode 100755 index 31fbbd3..1afaeb9 --- a/Puissance4/main.py +++ b/Puissance4/main.py @@ -1,3 +1,7 @@ +#!/usr/bin/env python + +"""Jeu d'échecs pour le TIPE de thibault.""" + from pygame.locals import * import pygame import random @@ -305,4 +309,4 @@ def deep_getsizeof(o, ids=set()): return r + sum(d(k, ids) + d(v, ids) for k, v in o.iteritems()) if isinstance(o, Container): return r + sum(d(x, ids) for x in o) - return r \ No newline at end of file + return r diff --git a/entretien.py b/entretien.py new file mode 100755 index 0000000..4d0c661 --- /dev/null +++ b/entretien.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +msgs = {} +n = 1 + + +def process_msg(msg): + global n, msgs + msgs[msg["seq_num"]] = msg + l = [] + while n in msgs: + l.append(msgs[n]) + del msgs[n] + n += 1 + return l + + +if __name__ == "__main__": + print(process_msg(dict(seq_num=4))) # => [] (4) n=1 + print(process_msg(dict(seq_num=2))) # => [] (4,2) n=1 + print(process_msg(dict(seq_num=1))) # => [1,2] (4) n=2 + print(process_msg(dict(seq_num=3))) # => [3,4] () n=4 diff --git a/fibonnaci-terminal.py b/fibonnaci-terminal.py new file mode 100755 index 0000000..7d253ba --- /dev/null +++ b/fibonnaci-terminal.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + + +def fibo(n, un1=1, un0=1): + if n <= 1: + return un0 + else: + return fibo(n - 1, un1 + un0, un1) + + +print(fibo(8)) +print(fibo(1)) diff --git a/quicksort.py b/quicksort.py new file mode 100755 index 0000000..ae6e366 --- /dev/null +++ b/quicksort.py @@ -0,0 +1,4 @@ +##!/usr/bin/env python + +# def quicksort(l, a, b): +# if