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
/* | |
colors.h: very simple text coloring functions for linux shell | |
Author: Antonio Mancuso - 2022 - | |
Usage: just include color.h in your source code | |
bg_color(color): set background color for following printf | |
fg_color(color, bold): set text color and bold flag | |
fg_bold(): print in bold font |
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 empty_grid(grid): | |
count = 0 | |
for row in grid: | |
count = count + sum(row) | |
return count | |
def distance(x1, y1, x2, y2, grid): | |
if grid[y2][x2] == 0: | |
return 72 | |
else: |
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 <stdlib.h> | |
#include <string.h> | |
#include <math.h> | |
#define EMPTY_SIMBOL 0 | |
#define MAX_SEQUENCE 20 | |
// definisco il tipo simbolo | |
typedef struct { |
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 NDIGIT 4 | |
char int2hex(int n) { | |
if(n < 10) | |
return n + '0'; | |
else | |
return n + 'A' - 10; | |
} |
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 DIGIT 4 | |
void dec2hex(int n){ | |
int resto = 0, carattere = 0, i = 0; | |
char hex[DIGIT] = {'0', '0', '0', '0'}; | |
printf("0x"); |
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> | |
void dec2hex(int n) | |
{ | |
int hex[4] = {0, 0, 0, 0}, i = 0; | |
while(n != 0) { | |
hex[i++] = n % 16; | |
n /= 16; | |
} |
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> | |
int ricercaBinaria(int vettore[], int ricercato, int n) | |
{ | |
int inizio = 0; | |
int centro = 0; | |
int fine = n - 1; | |
/* Inserisci qui il tuo codice */ | |
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 N 8 | |
int ricercaSequenziale(int vettore[], int ricercato, int n) { | |
/* Inserisci qui il tuo codice */ | |
} | |
int main() { | |
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 N 8 | |
int ricercaSequenziale(int vettore[], int ricercato, int n) { | |
int * da_confrontare; | |
int num_confronti = 0; | |
for (int i = 0; i < n; ++i) { | |
da_confrontare = & vettore[i]; |
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 PP 3 | |
#define PM 2 | |
#define LED 6 | |
int temp = 0; | |
void setup() | |
{ | |
Serial.begin(9600); | |
pinMode(LED, OUTPUT); |
NewerOlder