/*
  7DRL PUZZLE CHALLENGE
  
  Build with something like:
  gcc -lcurses dildocrew.c -o dildo

  This source code is in the public domain.
*/

                                                    #include "stdlib.h"
                                                     #include "stdio.h"
                                                      #include "math.h"
                                                    #include "string.h"
                                                    #include "unistd.h"
                                                      #include "time.h"
                                                   #include "ncurses.h"

#define MEH ()
#define masturbate() getch MEH
#define anal(x) printw(x)
#define __XNSTLSR(a,b,c) a();b();c();
#define DO_IT(a,b) a();b();
#define DEAD (some_guy[you].erection <= 0)
#define F(a,b,c,d) a(b,c,d);
#define dildo() erase()
#define ohyeah() refresh()
#define GUYS struct hhhhhhhhhhhhhhh
#define PSTRT ohyeah();masturbate();
#define WHO "YOUR "
#define HEY(x,n) {attrset(COLOR_PAIR(1) | A_BLINK);mvaddstr(20,0,x);if(n)addstr(" (MORE)");clrtoeol MEH;if(n)while(getch MEH !=' ');refresh();}
#define WTF (LINES<24||COLS < 80)
#define OH_FUCK {endwin MEH ;return 1;}
#define SHIT {endwin MEH ;return 0;}
#define MINUS :
#define THE_PRODUCT "well what the hell did you expect"
#define ___ "                      "
#define DASHES "--"
#define EDATH DEATH
#define ENDGAME ENDAGME
#define WON (enemas<=0)
#define FOR(v,r) for(v=0;v<r;v++)
#define FOREVER while(1!=2)
#define NUMBER 331
#define WALK(e,f) FORif ()

char the_map[20][80] =
{
  "         ###################################################....................",
  " #########                                                 #...################.",
  " #......#                      ...                         #...#              #.",
  "  ......#                .    ..                           #####              #.",
  "#   ....#                .  .. ..   ..                                       ##.",
  "#   ..###                ..#######################################           #..",
  "   #..#                                                          #           #.#",
  "####..#####            ..                                      ###           ..#",
  "#                      ...                                       #             #",
  "                          #     ###     ##########################.            #",
  " #                        #    ## ##    #                          .           #",
  " #                     ...#   ##  ... ###                                      #",
  " #                        ##  #    ####..                          .           #",
  " #                        .####  ... .                                         #",
  " #                        .   .      .                              .          #",
  " #                      ...   .      .                              .          #",
  " #             #######         ..               # #####          .......       #",
  " #             #     #                          #     #         ... .....      #",
  " ###############     #                          #     #######    ......        #",
  "                     ############################           ####################",
};

GUYS { int n, p, thief; char letter; };

int main(void)
{
  int huh, HUH, damn_it, you, guy, what, where[2], variable;
  char cocks, ass[100];
  int enemas, bombz, LOL, LOLZ, gggg;
  GUYS some_guy[26];

  srand(time(NULL));

  damn_it = 600;

  you = 0;
  enemas = 25;
  bombz = 25;

  goto SKIP;TMPJMP1:goto TMPJMP2;SKIP:

  FOR(guy,26)
  {
    some_guy[guy].letter = 64 + guy;
    some_guy[guy].n = rand MEH % 20;
    some_guy[guy].p = rand MEH % 80;
    some_guy[guy].thief = NUMBER;
  }

  __XNSTLSR(initscr,cbreak,noecho);
  start_color();
  for(huh=1;huh<10;huh++) init_pair(huh,1+rand()%4,4+rand()%4);

  curs_set((gggg = 0));

  if WTF OH_FUCK
  
  dildo();
  anal(  """""  """"""  ""     ""  """""" """   "" "      DILDO CREW\n\n"            ); PSTRT
  anal( ""      ""      """" """"  ""     """"  "" "                    PRESENTS\n\n"); PSTRT
  anal(  """"   """"    "" """ ""  """"   "" "" ""      " THE_PRODUCT "\n\n "        ); PSTRT
  anal(     ""  ""      ""  "  ""  ""     ""  """"    " " 7DRL PUZZLE CHALLENGE\n\n" ); PSTRT
  anal( """""   """"""  ""     ""  """""" ""   """    "(or something)"               ); PSTRT

  MAP:

  if (gggg && !(--gggg)) goto BOMB;
  if WON goto ENDGAME;
  if (damn_it--) ; else goto FUCK_THIS;

  FOR(huh, 20){FOR(HUH, 80){
      cocks = the_map[huh][HUH];
      if (gggg && huh==LOL && HUH==LOLZ) cocks = '!';
      FOR(variable, 26)
	if (some_guy[variable].thief &&
	    some_guy[variable].n == huh &&
	    some_guy[variable].p == HUH) cocks = some_guy[variable].letter;

      attrset((cocks=='#'?COLOR_PAIR(1):(cocks=='.' ? COLOR_PAIR(2)MINUS(cocks>='A' && cocks <='Z' ? COLOR_PAIR(3)MINUS(cocks=='!' ? COLOR_PAIR(rand()%10)MINUS COLOR_PAIR(0))))));
      mvaddch(huh,HUH,cocks);
    }
  }
  
  attrset(COLOR_PAIR(2));
  mvprintw(21, 0, WHO " REMAINING BOMBZ: %d" ___ "REMAINING ENEMAS: %d", bombz, enemas);
  clrtoeol();
  mvaddstr(22, 0, WHO " WEAPON: YOUR COCK          CONTROLS [ DOWN: 2  LEFT: 3   QUIT: q ]");
  clrtoeol();
  mvaddstr(23, 0, WHO " MISSION: ANNIHILATE                 [ UP:   1  RIGHT: 4  BOMB: b ] ");
  clrtoeol();
  
  ohyeah();

  FOREVER
  {
    guy = you;

    variable = masturbate();
    
    switch(variable)
    {
      case '1':
	where[0] = some_guy[you].n - 1;
	where[1] = some_guy[you].p;
	strcpy(ass, "U GO NORTH");
	goto WALK;
	
      case '2':
	where[0] = some_guy[you].n + 1;
	where[1] = some_guy[you].p;
	strcpy(ass, "U GO SOUTH");
	goto WALK;
	
      case '3':
	where[0] = some_guy[you].n;
	where[1] = some_guy[you].p - 1;
	strcpy(ass, "U GO WEST");
	goto WALK;
	
      case '4':
	where[0] = some_guy[you].n;
	where[1] = some_guy[you].p + 1;
	strcpy(ass, "U GO EAZT");
	goto WALK;
	
      case 'b':
	if (bombz < 1)
	{
	  HEY("U HAVE NO MORE BOMBZ",0);
	  goto MAP;
	}

	strcpy(ass,"U SET UP THE BOMB");
	
	if (gggg)
	{
	  strcat(ass, " " DASHES " NO WAIT U DID NOT!!");
	}
	else
	{
	  LOL = some_guy[you].n;
	  LOLZ = some_guy[you].p;
	  gggg = 5;
	  bombz--;
	}

	HEY(ass,0);

	goto MAP;
	
      case 'q':
	SHIT /* let's get out of here */
	  
      default:
	HEY("WHAT??",0);
    }
  }

  goto MAP;

BOMB:
  FOR(what,24) FOR(HUH,80) {attrset(COLOR_PAIR(rand()%10));mvaddch(what,HUH,'#');}refresh();sleep(1);

  FOR(huh,26)
  {
    if (abs(some_guy[huh].n-LOL)<2&&abs(some_guy[huh].p-LOLZ)<2)
    {
      goto TMPJMP1;
    TMPJMP2:
      if (huh == you) goto DEATH;

      if (some_guy[huh].thief)
      {
	sprintf(ass, "ENEMA ''%c'' HAS BEEN DESTROYED!!", some_guy[huh].letter);
	HEY(ass,NUMBER);
	some_guy[huh].thief = 0;
	enemas--;
      }
    }
  }
  
  goto MAP;

WALK:
  what = (the_map[where[0]][where[1]] == '#')||(where[0]<0)||(where[0]>=20)||(where[1]<0)||(where[1]>=80);

  if (what) strcat(ass, " " DASHES " NO WAIT U CANT");
  else
  {
    some_guy[guy].n = where[0];
    some_guy[guy].p = where[1];
  }

  for (huh=HUH=1;huh<26;huh+=HUH)
  {
    if (some_guy[huh].thief&&some_guy[huh].n==some_guy[you].n&&some_guy[huh].p==some_guy[you].p) goto CAUGHT;
  }

  HEY(ass,0);

  goto MAP;



FUCK_THIS MINUS endwin(); printf("\n\nfuck this\n\n"); return 0;
ENDAGME:
 endwin();
  printf("CIVILIZATION IS IN RUINES!!\n\n\n\n" DASHES " YOU HAVE WON!! " DASHES "\n\n\n\n");
  printf("LOLOLOLOLOLOLOLOLOLOLOL\n\n");
  return 0;

CAUGHT: HEY("YOU GOT CAUGHT",20); goto EDATH;
  
DEATH MINUS HEY("YOU CAN NO LONGER MAINTAIN AN ERECTION",200); HEY("YOU DIE!!!",55);

  SHIT SHIT SHIT SHIT SHIT
  SHIT SHIT SHIT SHIT SHIT
  SHIT SHIT      SHIT SHIT
  SHIT SHIT      SHIT SHIT
  SHIT SHIT      SHIT SHIT
  SHIT SHIT      SHIT SHIT
  SHIT SHIT      SHIT SHIT
  SHIT SHIT      SHIT SHIT
  SHIT SHIT      SHIT SHIT
  SHIT SHIT      SHIT SHIT
  SHIT                SHIT
  SHIT                SHIT
  SHIT SHIT      SHIT SHIT
  SHIT SHIT      SHIT SHIT
  SHIT SHIT      SHIT SHIT
  SHIT SHIT SHIT SHIT SHIT
  SHIT SHIT SHIT SHIT SHIT
}

