Skip to content

Instantly share code, notes, and snippets.

View ProfAndreaPollini's full-sized avatar
🎯
Focusing

Andrea Pollini ProfAndreaPollini

🎯
Focusing
View GitHub Profile
@ProfAndreaPollini
ProfAndreaPollini / game_loop.cpp
Created January 15, 2024 10:38 — forked from mariobadr/game_loop.cpp
A basic game loop using std::chrono
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 Mario Badr
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@ProfAndreaPollini
ProfAndreaPollini / entity.rs
Created July 27, 2023 18:30
Entity and Item for a Rust Roguelike
use std::fmt::Display;
#[derive(Debug)]
pub struct Entity {
// id: Option<EntityKey>,
name: String,
health: i32,
xp: i32,
// inventory: Option<Inventory>,
}
package autonoleggio;
public class App {
public static void main(String[] args) {
var autoNoleggio = new AutoNoleggio();
System.out.println("all'inizio le auto sono zero");
var auto = autoNoleggio.elencoAuto();
System.out.println(auto.size() == 0);
@ProfAndreaPollini
ProfAndreaPollini / Articolo.java
Created February 23, 2023 08:49
Esercizio Bar e panini
package com.ap.test.sol2;
public class Articolo {
}
@ProfAndreaPollini
ProfAndreaPollini / app.py
Created February 2, 2023 17:33
GLOBAL TEMPERATURE ANOMALIES. #python data visualization
from typing import List, Tuple
from colors import hsl_to_rgb
import pygame as pg
import glm
from perlin_noise import PerlinNoise
import moviepy.editor as mp
import numpy as np
import csv
@ProfAndreaPollini
ProfAndreaPollini / colors.py
Created January 31, 2023 15:34
Pygame + taichi fire graphic effect
def hsl_to_rgb(h: float, s: float, l: float):
r, g, b = 0.0, 0.0, 0.0
h = h / 256.0
s = s / 256.0
l = l / 256.0
if s == 0:
r = g = b = l
import taichi as ti
import taichi.math as tm
import pygame as pg
ti.init(arch=ti.gpu, default_fp=ti.f64, fast_math=False)
pg.init()
clock = pg.time.Clock()
.......#..............................................#.#..#.#..#.....#.........#.....#.............
......................#..........................#.#.....................##.........................
......#...#.#...........#...#..........#...........#.........................#..........#..#........
..........#.....#.....##..#..#..............#....#..........................##.#..#......#.....##...
.......#....#...#.......#..#......#...#..........#...........................####...................
...#.....#....#............#..#.#.....#.#................#..#........#.........#....................
..............#...#....#....................#.#....#.##....#...#.#.#
@ProfAndreaPollini
ProfAndreaPollini / tetris.py
Created December 21, 2022 17:14
Tetris python3 implementation with pygame
from typing import List, Tuple
import pygame as pg
pg.init()
pg.font.init()
clock = pg.time.Clock()
SCREEN = (720, 1280)
@ProfAndreaPollini
ProfAndreaPollini / Ball.java
Created November 22, 2022 07:53
Pong - 20221122
package pong;
import processing.core.PGraphics;
import processing.core.PVector;
public class Ball extends GameObject {
private PVector vel;
private int mag;
public Ball(PVector pos, int mag) {