Files
deck_in_a_dash/engine/src/tarot.h
T
ml a93e5d4cdc Add core engine: tarot + astrology reading generator with CLI and i18n
Plain-C, dependency-free engine that produces a personalized daily
Celtic Cross tarot spread and natal-chart/transit astrology reading,
plus a standalone CLI (dist/deck-engine) and run.sh wrapper. Includes
English/German output via a simple key=value translation format, and
docs/diagrams describing the architecture and I/O.
2026-07-04 06:49:18 +02:00

74 lines
2.0 KiB
C

#ifndef DECK_TAROT_H
#define DECK_TAROT_H
#include <stdbool.h>
#define TAROT_DECK_SIZE 22
#define TAROT_SPREAD_SIZE 10
typedef enum {
CARD_FOOL = 0,
CARD_MAGICIAN,
CARD_HIGH_PRIESTESS,
CARD_EMPRESS,
CARD_EMPEROR,
CARD_HIEROPHANT,
CARD_LOVERS,
CARD_CHARIOT,
CARD_STRENGTH,
CARD_HERMIT,
CARD_WHEEL_OF_FORTUNE,
CARD_JUSTICE,
CARD_HANGED_MAN,
CARD_DEATH,
CARD_TEMPERANCE,
CARD_DEVIL,
CARD_TOWER,
CARD_STAR,
CARD_MOON,
CARD_SUN,
CARD_JUDGEMENT,
CARD_WORLD
} TarotCard;
/* Waite's original ten positions from "An Ancient Celtic Method of
* Divination" (The Pictorial Key to the Tarot, Part III §7), in his
* original drawing order. */
typedef enum {
POSITION_PRESENT = 0, /* "This covers him." */
POSITION_CHALLENGE, /* "This crosses him." */
POSITION_CROWN, /* "This crowns him." */
POSITION_FOUNDATION, /* "This is beneath him." */
POSITION_RECENT_PAST, /* "This is behind him." */
POSITION_NEAR_FUTURE, /* "This is before him." */
POSITION_ATTITUDE, /* "Himself." */
POSITION_ENVIRONMENT, /* "His house." */
POSITION_HOPES_AND_FEARS,
POSITION_OUTCOME
} CelticCrossPosition;
typedef struct {
TarotCard card;
bool reversed;
} TarotDraw;
typedef struct {
/* Indexed by CelticCrossPosition. */
TarotDraw positions[TAROT_SPREAD_SIZE];
} CelticCrossSpread;
/* Deterministic: the same seed string always produces the same ten
* cards, in the same positions, with the same orientations. */
void tarot_draw_celtic_cross(const char *seed, CelticCrossSpread *out);
/* Card content, sourced from A. E. Waite's Pictorial Key to the Tarot
* (1911, public domain). Defined in tarot_data.c. */
const char *tarot_card_name(TarotCard card);
const char *tarot_card_image_file(TarotCard card); /* matches res/img/ */
const char *tarot_card_meaning(TarotCard card, bool reversed);
const char *tarot_position_name(CelticCrossPosition position);
const char *tarot_position_description(CelticCrossPosition position);
#endif