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 <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#define MEM_MAX 2024 | |
#define PROG_MAX 16384 | |
#define NAME_MAX 256 | |
void getprog(char *prg, char fname[NAME_MAX]) { | |
FILE *fp; |
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 <stdio.h> | |
#include <math.h> | |
#define ERR -1 | |
int hua2dec(char *str) { | |
long int res = 0; | |
int len = strlen(str); | |
if (str[0] != 'h' || str[len-1] != 'a') return ERR; | |
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 <stdio.h> | |
#define STACK_MAX 256 | |
#define PROGRAM_MAX 512 | |
#define DEBUG 1 | |
// define DEBUG 1 for all output, 0 for no output. | |
#define FINAL 1 | |
// define FINAL 1 for final output, 0 for no output. | |
enum codes { |
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
import random, sys | |
def safeNumInput(string): | |
while True: | |
res = input(string+"\n>>>") | |
if res == "q": | |
input("Merci d'avoir jouer avec nous! [enter pour quitter le programme]") | |
sys.exit() | |
try: | |
res = int(res) |
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
################################################################################ | |
## python battle ship program ################################################## | |
################################################################################ | |
import random | |
class Grid: | |
def __init__(self, height, width): | |
self.height = height | |
self.width = width |
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
function hex_time() | |
time = os.date("*t", os.time()) | |
return {time.hour, time.min, time.sec} | |
end | |
function hex2dec(n) | |
return tonumber("0x"..n) | |
end | |
function hex2love(t) |
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
def collatz(num): | |
num = float(num) | |
# base case | |
if num == 1 : | |
print(num) | |
return | |
# even | |
if num%2 == 0 : |