This file contains hidden or 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 turtle | |
import math | |
import time | |
def drawTriangle(tur, xy1: tuple, xy2: tuple, xy3: tuple, color:str, fill:str): | |
tur.up() | |
tur.color(color, fill) | |
tur.goto(xy1[0], xy1[1]) | |
tur.begin_fill() | |
tur.down() |
This file contains hidden or 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 turtle | |
import math | |
def drawCircle(tur, center:tuple, rayon:int, color:str="black", fill:str="white", thickness:int=1): | |
tur.width(thickness) | |
tur.up() | |
tur.color(color, fill) | |
tur.goto(center[0], center[1] + rayon) |
This file contains hidden or 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 turtle | |
import math | |
def drawRect(tur, xy1: tuple, xy2: tuple, color:str, fill:str): | |
tur.up() | |
tur.color(color, fill) | |
tur.goto(xy1[0], xy1[1]) | |
tur.begin_fill() | |
tur.down() |
This file contains hidden or 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 turtle | |
import turtle | |
import math | |
def drawStar(tur, pos: tuple, size: int, rot: int, color: str): | |
tur.up() | |
tur.goto(pos[0], pos[1]) | |
tur.color(color, color) |
This file contains hidden or 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 turtle | |
import math | |
def drawStar(tur, center, rayon, rot, color): | |
tur.up() | |
tur.color(color, color) | |
tur.goto(center[0] + (rayon * math.sin(math.radians(rot))), | |
center[1] + (rayon * math.cos(math.radians(rot)))) | |
branche = rayon * 2 * math.cos(math.radians(18)) |
This file contains hidden or 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 "vigenere.h" | |
void vigenereEnc(const char * text, const char * key, char * ciphertext){ | |
unsigned int i, size = strlen(key); | |
for(i = 0; text[i] != '\0'; i++){ | |
if( (text[i] >= 'a') && (text[i] <= 'z') ){ | |
int rang = (text[i] + key[i % size] - 2 * 'a') % 26; | |
ciphertext[i] = 'a' + rang; | |
} |
This file contains hidden or 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 <stdbool.h> | |
#include "substitution.h" | |
void genkey(char * key){ | |
int i; | |
strncpy(key, "abcdefghijklmnopqrstuvwxyz", 27); | |
srand(time(NULL)); | |
for(i = 0; i < 100; i++){ | |
int k, l; | |
k = rand()%26; l = rand()%26; |
This file contains hidden or 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 "ceasar.h" | |
void caesarEnc(const char * message, short key, char * ciphertext){ | |
unsigned int i = 0; | |
short rang; | |
while( message[i] != '\0'){ | |
if( ( message[i] >= 'a') && (message[i] <= 'z') ){ | |
rang = (message[i] - 'a' + key) % 26; | |
if( rang < 0) rang += 26; | |
ciphertext[i] = 'a' + rang; |
This file contains hidden or 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 turtle | |
turtle.bgcolor("cyan") | |
t = turtle.Turtle() | |
t.speed(1) | |
width = 600 | |
height = 300 | |
t.up() |