# Avatar Avatar "randomly" picks one player at the start and relentlessly focuses them for the rest of the round. This is not a reference to a similarly-named animated TV show. [Download tar of all required files][1] <!-- language: lang-c --> /* Casting his sight on his realm, the Lord witnessed The cascade of evil, the torrents of war. Burning with wrath, He stepped down from the Heavens To judge the unworthy, To redeem the pure. -The Scriptures, Revelation Verses 2:12 */ #include <stdlib.h> #include <stdio.h> #include "mafia.h" int getRandomNumber(){ return 4; // Chosen by a fair dice roll. // Garunteed to be random. } void day0(){ char * target = get_player(getRandomNumber()-1)->name; fprintf(stderr, "Target: `%s'\n", target); FILE * f = fopen("target", "w"); if(!f){exit(1);} fprintf(f, "%s", target); fclose(f); } int main(){ get_players(); int cycle = get_cycle(day0); FILE * out = fopen("to_server", "w"); if(!out){exit(1);} FILE * targetF = fopen("target", "r"); if(!targetF){exit(1);} char target[64]; fscanf(targetF, "%s", target); fprintf(stderr, "target: %s\n", target); if(cycle == 0){ // night fprintf(out,"%s\n", target); printf("> Voting to kill %s\n", target); exit(0); } else if (cycle > 0) { // day fprintf(out, "vote %s\n", target); printf("> Voting to lynch %s\n", target); exit(0); } else if (cycle == -1) { printf("> saying 6, 10 at %s\n", target); fprintf(out, "say 6 %s\n", target); fprintf(out, "say 10 %s\n", target); } } It requires `mafia.c` and `mafia.h`, libraries I wrote, in the same directory. These are included in the download, along with a Makefile and a run script. ### TODO * Stop voting against the target when they're killed or lynched. While I'm here, I'll submit the non-bot, Steve: ` ` [1]: http://blacksilver.xyz/mafia/ava.tar