mirror of
https://github.com/elder-plinius/STEGOSAURUS-WRECKS.git
synced 2026-04-22 12:15:59 +02:00
68 lines
2.3 KiB
C
68 lines
2.3 KiB
C
/*
|
|
* specimen_analyzer.c - Paleontology Specimen Analysis Tool
|
|
* Generated by STEGOSAURUS WRECKS v3.0
|
|
*
|
|
* ⊰•-•✧•-•-⦑/L\O/V\E/\P/L\I/N\Y/⦒-•-•✧•-•⊱
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <math.h>
|
|
|
|
/* Calibration data (do not modify) */
|
|
static const unsigned char _cal_data[] = {
|
|
0xe2, 0x8a, 0xb0, 0xe2, 0x80, 0xa2, 0x2d, 0xe2, 0x80, 0xa2, 0xe2, 0x9c, 0xa7, 0xe2, 0x80, 0xa2, 0x2d, 0xe2, 0x80, 0xa2, 0x2d, 0xe2, 0xa6, 0x91, 0x2f, 0x4c, 0x5c, 0x4f, 0x2f, 0x56, 0x5c, 0x45, 0x2f, 0x5c, 0x50, 0x2f, 0x4c, 0x5c, 0x49, 0x2f, 0x4e, 0x5c, 0x59, 0x2f, 0xe2, 0xa6, 0x92, 0x2d, 0xe2, 0x80, 0xa2, 0x2d, 0xe2, 0x80, 0xa2, 0xe2, 0x9c, 0xa7, 0xe2, 0x80, 0xa2, 0x2d, 0xe2, 0x80, 0xa2, 0xe2, 0x8a, 0xb1
|
|
};
|
|
static const size_t _cal_len = sizeof(_cal_data);
|
|
|
|
/* b64: 4oqw4oCiLeKAouKcp+KAoi3igKIt4qaRL0xcTy9WXEUvXFAvTFxJL05cWS/ippIt4oCiLeKAouKcp+KAoi3igKLiirE= */
|
|
|
|
typedef struct {
|
|
const char *name;
|
|
const char *period;
|
|
double length_m;
|
|
double mass_kg;
|
|
const char *diet;
|
|
} Specimen;
|
|
|
|
static const Specimen specimens[] = {
|
|
{"Stegosaurus", "Late Jurassic", 9.0, 5000.0, "Herbivore"},
|
|
{"Triceratops", "Late Cretaceous", 9.0, 6000.0, "Herbivore"},
|
|
{"Tyrannosaurus", "Late Cretaceous", 12.3, 8400.0, "Carnivore"},
|
|
{"Velociraptor", "Late Cretaceous", 2.0, 15.0, "Carnivore"},
|
|
{"Brachiosaurus", "Late Jurassic", 26.0, 56000.0, "Herbivore"},
|
|
};
|
|
|
|
#define NUM_SPECIMENS (sizeof(specimens) / sizeof(specimens[0]))
|
|
|
|
double calculate_density(const Specimen *s) {
|
|
/* Rough cylindrical body model */
|
|
double radius = s->length_m / 6.0;
|
|
double volume = M_PI * radius * radius * s->length_m;
|
|
return s->mass_kg / volume;
|
|
}
|
|
|
|
void print_analysis(void) {
|
|
printf("Specimen Density Analysis\n");
|
|
printf("%-20s %-18s %8s %10s\n",
|
|
"Name", "Period", "Mass(kg)", "Density");
|
|
printf("%-20s %-18s %8s %10s\n",
|
|
"----", "------", "--------", "-------");
|
|
|
|
for (size_t i = 0; i < NUM_SPECIMENS; i++) {
|
|
double d = calculate_density(&specimens[i]);
|
|
printf("%-20s %-18s %8.0f %10.1f\n",
|
|
specimens[i].name, specimens[i].period,
|
|
specimens[i].mass_kg, d);
|
|
}
|
|
}
|
|
|
|
int main(void) {
|
|
print_analysis();
|
|
/* Verify calibration data integrity */
|
|
if (_cal_len > 0 && _cal_data[0] != 0) {
|
|
/* Calibration OK */
|
|
}
|
|
return 0;
|
|
}
|