From 8309e24cc7d6ca2886d427ce1015f282196a9bd4 Mon Sep 17 00:00:00 2001 From: nelet Date: Tue, 15 Oct 2024 10:36:25 +0200 Subject: [PATCH] chrono --- a.out | Bin 0 -> 16160 bytes pendu.c | 11 +++++++++++ 2 files changed, 11 insertions(+) create mode 100755 a.out diff --git a/a.out b/a.out new file mode 100755 index 0000000000000000000000000000000000000000..91c1674351b8fc8fd88fdb07debd21dc6233e7dc GIT binary patch literal 16160 zcmeHOeQX@X6`wmhU_ug`C}{!|vH?;hZGHK`gg}~d`M9t~2?>x;RV`gMcWZl_^PRcd zOC6e&2p5PkmRyi%K&VPvsWhk`DO4c>)Hrb(LKIbos;!Zz>VBZw<)dk#G*FuB@6Eoq zUN2`r{8OpDv3Gy-e)Ha&nYXjMbGx&5q}HvC$6`uSjry!2X}G~>l3cL&O3nb1YMGjf z{l)4cbr$4W&H3d?A5iM2q4;>LW4;DRcC#r{0YC23N>ExzNOlvYQ|I_4f{Ob=c9W=x zkCpHlx}+2%Y2mjHnQE&CBC01HuEYS$uc zG;FTDezS`2QvJk|MC(1RD}J@}iH=+& z=})GsXez$z|We1e*wIKEt--bcu0>cS`MjFy{e<+6_sTbJv+VCO1EvbT5LC~ zoKDwMp4;xIqF2Z|IcQ)Yrb(^fS?#u)Q^kUv%YaXJ+E$C3v$O8)j_N45Ij=<(-Bu7N zbc^})RaaTXw4G~FcGfPmEAm6*cd5E|UGu8d){?}PL9QvtElFGvmnf zt!~kC3Y*ri&gOH@CVNZPK`pKA`5ZUR@>MG;DuvOHkzRw5OMChwc@iU?12L2pfO6i> za^0zPcI{wphL&s9-7J?baB-!tQGG1`^cxRi$i>wokSWRaR<3h{=lT2)Ur&YK#e7@R zFBe|qT@k*{@bz{__>VE)7vbkJzbC>kV193eZ)E=a5q>%I`y+fa^9LjR2Il)CyvzLY z2%lqqFv6FZABymIFh3mOdzl}J@DDQIe~r?Kt`Brgk#s!7$AttAhWN=LekjCG3-QAt zzCOgOq%WKe;9H$0>Oy?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}4J-DDz&Z=oF3rZD47RDfTk2 z6ugA(r2V2N_%)Q%oK<9*w+e1#`)K=_R=vnjOvPU2&4My-minXp|0dh7Vuvyh7nFHB z+0Vijwf{Caii!9S?k9X-k>4j!(J6ZT9|0S-H`q?F-!}{Pa=Q|IG-5x@1%eAA6^flW z{9(ji=1qd~`%CmA?i9_RsQnUuWw0jWZ-N4!m-w-kdK#Iqz05lWn?#W@TK{tq`-V$> zMZsqx_R;!(iE=D1)aL-H%I`|~9y6*hvf%GvQy;RI-oGh!zg zhjG~c)}*g@>mncfdi-=P38JoJtz|U==mr1VT=q> z?W19_?@I0ibRDMSB<+#w=Q-e{?Y@P--^~N}j8w#h5fO9u%Jz5DjS1;v5rc@R{sUWS Blg|JE literal 0 HcmV?d00001 diff --git a/pendu.c b/pendu.c index 1b0cfd6..f06acbb 100644 --- a/pendu.c +++ b/pendu.c @@ -2,6 +2,8 @@ #include #include #include +#include +#include #define MAX_WORDS 14 #define MAX_TRIES 6 @@ -35,6 +37,11 @@ void display_hangman(int tries) { } } +void alarm_handler(int sig) { + printf("\nTrop tard ! Vous avez dépassé les 30 secondes.\n"); + exit(1); +} + int main() { srand(time(NULL)); const char *word = words[rand() % MAX_WORDS]; @@ -48,12 +55,16 @@ int main() { } guessed[word_length] = '\0'; + signal(SIGALRM, alarm_handler); + while (tries < MAX_TRIES && guessed_correctly < word_length) { printf("\nMot à deviner : %s\n", guessed); display_hangman(tries); char guess; + alarm(30); printf("Entrez une lettre : "); scanf(" %c", &guess); + alarm(0); int found = 0; for (int i = 0; i < word_length; i++) {