Acme-ConspiracyTheory-Random

 view release on metacpan or  search on metacpan

lib/Acme/ConspiracyTheory/Random.pm  view on Meta::CPAN

	);

	_MERGE_( $redstring, clone => $x );
	return $x;
}

sub lies {
	my $redstring = shift // {};

	my $x = _RANDOM_(
		'obvious lies',
		'a big coverup',
		'a fairy tale',
		'disinformation',
		'the Big Lie',
		'fake news',
	);
	
	_MERGE_( $redstring, lies => $x );
	return $x;
}

sub evidence {
	my $redstring = shift // {};
	
	my @x = (
		"there's a video about it on YouTube",
		sub { 'there was something about it on ' . website() },
		"the voices told me",
		"I had a dream",
		sub { website() . ' is censoring me' },
		sub { website() . ' was down this morning' },
	);

	if ( my $c = $redstring->{disease_cause} ) {
		push @x, (
			"$c is addictive",
		);
	}
	
	if ( my $m = $redstring->{misinformation} ) {
		push @x, (
			"they indoctrinate people about '$m' at schools and if it were the truth they wouldn't need to",
			"'$m' gets pushed down our throats by mass media",
			"'$m' is a false-flag operation",
		);
	}
	
	if ( my $auth = $redstring->{authority} ) {
		push @x, (
			"$auth are the obvious people to go to",
			"$auth are the only ones with the power to stop them",
			"$auth are able to save us",
		);
	}

	if ( my $p = $redstring->{myth_place} ) {
		push @x, (
			"there are clues about $p in the Bible",
			"there are clues about $p in the Voynich manuscript",
			"$p is on some old maps",
			"$p is on Google Maps",
		);
	}

	if ( my $art = $redstring->{artifact} ) {
		push @x, (
			"$art isn't in any museum",
			"$art must be somewhere",
			"$art is out there",
			"$art can be found with GPS",
		);
	}

	if ( my $proj = $redstring->{shady_project} ) {
		push @x, (
			"everybody knows $proj is happening soon",
			"$proj is well-funded",
			"$proj is an open secret",
			"there is so much evidence for $proj",
		);
	}
	
	if ( my $dl = $redstring->{dark_lord} ) {
		push @x, (
			"$dl is known to be growing in power",
			"$dl has never seemed more powerful",
			"$dl needs to be getting power from somewhere",
			"$dl told me",
			"I have seen signs from $dl",
		);
	}
	
	if ( my $v = $redstring->{victim} // $redstring->{physicist} // $redstring->{biologist} ) {
		push @x, (
			"$v died too young",
			"$v sent a letter containing the truth before dying",
			sub {
				my $clone = clone( $redstring );
				"when they did an autopsy on $v it turned out it was $clone",
			},
			"they never did an autopsy on $v",
			"$v wrote a will",
			sub {
				my $g = shady_group( $redstring );
				"$v was secretly one of $g";
			},
			sub {
				my $animal = real_animal( $redstring );
				"when they did an autopsy on $v it turned out they were secretly a $animal in a human suit";
			},
		);
	}

	if ( my $v = $redstring->{physicist} // $redstring->{biologist} ) {
		push @x, (
			"$v isn't mentioned in Aristotle's writing",
			"$v hasn't given a lecture in months",
			"$v isn't taken seriously by TRUE SCIENTISTS",
		);
	}

lib/Acme/ConspiracyTheory/Random.pm  view on Meta::CPAN

			"$f make me feel sick",
			"I don't like $f",
		);
	}

	if ( my $chem = $redstring->{chemicals} ) {
		push @x, (
			"$chem isn't on the periodic table",
			"$chem isn't real",
			"$chem isn't natural",
			"you'd have to be stupid to think $chem is real",
		);
	}

	if ( my $r = $redstring->{precious_resource} ) {
		my ( $bad, $are, $r_are );
		$redstring->{shady_group}{name} or shady_group( $redstring );
		foreach ( qw/ antagonist protagonist shady_group / ) {
			if ( $redstring->{$_}{name} ) {
				$bad = $redstring->{$_}{name};
				$are = $redstring->{$_}{plural} ? 'are' : 'is';
				$r_are = ($r =~ /s$/) ? 'are' : 'is';
			}
		}
		push @x, (
			"the Wikipedia entry for $r keeps getting edited by $bad",
			"$bad keeps buying $r secretly on the stock market",
			"the global supply of $r is at an all time low",
			"have you ever seen $r for real with your own eyes",
			"$r $r_are so damn expensive",
			"$r $r_are really rare",
			"Alex Jones says $bad $are linked to $r",
		);
	}

	if ( my $topic = $redstring->{topic} ) {
		my $topicname = $topic->{name};
		my $have      = $topic->{plural} ? 'have' : 'has';
		push @x, (
			"there's hidden clues in the Wikipedia page about $topicname",
			"THEY let it slip during an edit war in a Wikipedia page about $topicname",
			"Bible numerology has clues about $topicname",
			"the Voynich manuscript has clues about $topicname",
			"$topicname $have always been suspicious",
			"$topicname $have connections to THEM",
			"nobody really understands $topicname",
			"all my posts about $topicname keep getting taken down by Tumblr",
		);
	}

	if ( my $p = $redstring->{random_place} // $redstring->{bad_place} ) {
		my $bad = $redstring->{antagonist}{name}
			// $redstring->{protagonist}{name}
			// $redstring->{shady_group}{name}
			// shady_group( $redstring );
		push @x, (
			"the Wikipedia entry for $p keeps getting edited by $bad",
			# This has singular/plural problems - how to solve?
			"$bad has ties to $p",
			"$p probably isn't a real place anyway",
			"$p isn't shown on any maps",
		);
	}

	for my $actor ( qw/ protagonists antagonists / ) {
		next unless $redstring->{$actor}{name};
		
		my $name   = $redstring->{$actor}{shortname} // $redstring->{$actor}{name};
		my $have   = splural( $redstring->{$actor} ) ? 'have' : 'has';
		my $are    = splural( $redstring->{$actor} ) ? 'are'  : 'is';
		my $s      = splural( $redstring->{$actor} ) ? ''     : 's';
		my $ies    = splural( $redstring->{$actor} ) ? 'y'    : 'ies';
		
		( my $fbname = $name ) =~ s/^the //i;
		$fbname = _UCFIRST_ $fbname;

		my $lies = lies();
		
		push @x, (
			"$name $have included it in their manifesto",
			"$name $have been strangely quiet about it",
			"$name $are always untrustworthy",
			"$name $are controlling everything",
			"if you Google for $name there's loads of info",
			"the '$fbname Truth' Facebook page says so",
			"the '$fbname Exposed' website says so",
			"$name even admit$s it",
			"$name den$ies it but that is $lies",
		);
		
		if ( my $animal = $redstring->{real_animal} // $redstring->{fake_animal} ) {
			push @x, "$name $have a picture of the $animal on their Wikipedia entry";
		}
		
		if ( my $place  = $redstring->{random_place} ) {
			push @x, "$name $have a secret base in $place";
		}
		
		if ( my $topic = $redstring->{topic} ) {
			my $topicname = $topic->{name};
			push @x, (
				"$name ${( $redstring->{$actor}{plural} ? \'keep' : \'keeps' )} editing the Wikipedia page about $topicname",
				"$name $are known to have ties to $topicname",
				"'$name' is almost an anagram of '$topicname'",
				"'$name' is the Hebrew word for '$topicname'",
				"'$name' is an anagram of '$topicname' (if you spell it wrong)",
			);
		}
	}

	my @evidences = List::Util::uniq( map { _RANDOM_(@x) } 1..2 );
	
	if ( @evidences == 2 ) {
		my ( $e1, $e2 ) = @evidences;
		return _RANDOM_(
			"You can tell this is the truth because $e1, and $e2.",
			( ( "I know because $e1, and $e2." ) x 6 ),
			"You just need to connect the dots. " . _UCFIRST_( "$e1 and $e2." ),
			"I used to be asleep like you, but then I saw the clues. " . _UCFIRST_( "$e1, and $e2. WAKE UP!" ),
			"THEY HIDE THE TRUTH IN PLAIN SIGHT. " . _UCFIRST_( "$e1, and $e2." ),
			"You won't believe how deep the rabbit hole goes. " . _UCFIRST_( "$e1, and $e2." ),
			sub { _UCFIRST_("$e1, and $e2. " . fatuous()) },
			sub {
				my $e3 = uc _RANDOM_(@x);
				my $fatuous = fatuous();
				_UCFIRST_( "$e1, and $e2. $fatuous $e3!" );
			},
			sub {
				my $e3 = uc _RANDOM_(@x);
				_UCFIRST_( "$e1, and $e2. They leave clues to mock us! $e3! MOCK! MOCK!" );
			},
			sub {
				my $t = {};
				theory($t);
				_UCFIRST_( "$e1, and $e2. Isn't it obvious? Also: " . $t->{base_theory} );
			},
		);
	}
	elsif ( @evidences == 1 ) {
		my ( $e1 ) = @evidences;
		return _RANDOM_(
			"You can tell the truth because $e1.",
			_UCFIRST_("$e1 and that reveals the truth."),
			"The truth is obvious if you're not a sheep, $e1.",
		);
	}
	
	return _RANDOM_(
		'The truth is plain to see.',
		"You're blind if you can't see the truth.",
		"The truth is obvious if you're not a sheep.",
	);
}

sub hidden_truth {
	my $redstring = shift // {};
	
	my $truth = _RANDOM_(
		sub { # wrap classics in a sub so they don't come up too often
			_RANDOM_(
				sub {
					$redstring->{topic} = { name => 'geology', plural => 0 };
					'the Earth is flat';
				},
				sub {
					$redstring->{topic} = { name => 'Inner Space (1987)', plural => 0 };
					'space is fake';
				},
				sub {
					$redstring->{topic} = { name => 'theology', plural => 0 };
					'God is real';

lib/Acme/ConspiracyTheory/Random.pm  view on Meta::CPAN

		my $group1 = $redstring->{protagonists}{shortname} // $redstring->{protagonists}{name};
		my $group2 = shady_group( $redstring );
		$redstring->{antagonists} = $redstring->{shady_group};
		my $know = splural ($redstring->{antagonists}) ? 'know' : 'knows';
		$theory .= " " . _UCFIRST_ _RANDOM_(
			sub {
				my $bribe = precious_resource_with_quantity( $redstring );
				"$group2 $know the truth but $group1 have paid them off with $bribe.";
			},
			"$group2 $know the truth but $group1 have threatened them to keep them silent.",
			"$group2 were helping them until $group1 betrayed them.",
			"$group2 were helping them for a while.",
			"$group2 were originally opposed to this but they're now in on it.",
			"$group2 are trying to get evidence to prove it.",
		);
	}

	_MERGE_( $redstring, base_theory => $theory );
	
	my $evidence = evidence( $redstring );
	$theory .= " $evidence" if $evidence;

	my $numerology = numerology( $redstring );
	$theory .= " $numerology" if $numerology;

	_MERGE_( $redstring, theory => $theory );

	return $theory;
}

my %special_numbers = (
	19   => [ qr/COVID/,             '19 is the coronavirus number' ],
	24   => [ qr/TINTIN/,            'There are 24 Tintin comics' ],
	33   => [ qr/MASON/,             '33 is associated with the masons' ],
	35   => [ qr/ELVIS/,             'Elvis was born in 1935' ],
	44   => [ qr/OBAMA/,             'Barack Obama was the 44th President of the USA' ],
	45   => [ qr/TRUMP|QANON|USA/,   'Donald Trump was the 45th President of the USA',
	          qr/UNITEDNATIONS/,     'The United Nations was founded in 1945' ],
	46   => [ qr/BIDEN/,             'Joe Biden was the 46th President of the USA' ],
	47   => [ qr/THECIA/,            'The CIA was founded in 1947',
	          qr/SILVER/,            'Silver has atomic number 47' ],
	49   => [ qr/NATO/,              'NATO was founded in 1949' ],
	51   => [ qr/KFC/,               'Area 51 is the fifty-first area' ],
	52   => [ qr/KFC/,               'KFC was founded in 1952' ],
	55   => [ qr/BIGMAC|MCDONALDS/,  'McDonalds was founded in 1955' ],
	63   => [ qr/JFK|OSWALD/,        'JFK was shot in 1963' ],
	79   => [ qr/GOLD/,              'Gold has the atomic number 79' ],
	81   => [ qr/HIV/,               'AIDS was discovered in 1981' ],
	82   => [ qr/COKE/,              'Diet Coke first came out in 1982' ],
	86   => [ qr/RADON/,             'The atomic number for radon is 86' ],
	92   => [ qr/URANIUM/,           'The atomic number for uranium is 92' ],
	322  => [ qr/SKULL/,             'Skull and Bones is Order 322' ],
	666  => [ qr/DEVIL|DEMON|SATAN/, '666 is the number of the beast' ],
);

sub numerology {
	my $redstring = shift // {};
	
	my @strings = List::Util::uniq(
		grep { length }
		map { my $letters = uc( $_ ); $letters =~ s/[^A-Z0-9]//g; $letters }
		map {
			/^(the )(.+)$/i ? $2 : $_
		}
		map {
			ref( $_ ) ? grep( defined, $_->{name}, $_->{shortname}, $_->{title}, $_->{author} ) : $_
		}
		values( %$redstring )
	);
	
	my %calcs;
	foreach my $string ( @strings ) {
		next if length($string) >= 20;
		my @letters = split //, $string;
		my @numbers = map /[A-Z]/ ? ( ord($_) - 0x40 ) : $_, @letters;
		my $sum     = List::Util::sum( @numbers );
		
		push @{ $calcs{$sum} ||= [] }, sprintf(
			'%s = %s = %s',
			join( '+', @letters ),
			join( '+', @numbers ),
			$sum,
		);
	}
	
	foreach my $key ( %special_numbers ) {
		if ( $calcs{$key} ) {
			my @copy = @{ $special_numbers{$key} };
			while ( @copy ) {
				my ( $test, $statement ) = splice( @copy, 0 , 2 );
				next unless "@strings" =~ $test;
				push @{ $calcs{$key} }, "And guess what? " . $statement;
			}
		}
	}
	
	my @wow = map { @$_ > 1 ? @$_ : () } values %calcs;
	
	if ( @wow ) {
		return sprintf(
			"%s %s",
			_RANDOM_(
				'The numbers never lie.',
				'Trust the numbers.',
				'You can see the truth in the numbers.',
			),
			join(
				'',
				map( "$_. ", @wow ),
			)
		);
	}
	
	return '';
}

sub bad_punctuation {
	my ( $string, $cancel ) = @_;
	unless ( $cancel ) {
		$string =~ s/ ([A-Za-z]) ([,!?]) / $1 . _RANDOM_(    $2, " $2", " $2", " $2$2") /exg;
		$string =~ s/ ([A-Za-z]) ([.])   / $1 . _RANDOM_($2, $2, " $2", " ", " $2$2$2") /exg;
		$string =~ s/\!/_RANDOM_('!', '!', '!!',  "!!!!")/ex;
	}
	return $string;
}

1;

__END__

=pod

=encoding utf-8

=head1 NAME

Acme::ConspiracyTheory::Random - random theories

=head1 SYNOPSIS

  use feature 'say';
  use Acme::ConspiracyTheory::Random -all;
  
  say bad_punctuation( theory() );

=head1 DESCRIPTION

This module exports a function, C<< theory() >> which returns a string.

=for html <p><img src="https://raw.githubusercontent.com/tobyink/p5-acme-conspiracytheory-random/master/assets/pepe-silvia.jpeg" alt=""></p>

There is also a function C<< bad_punctuation >> which, given a string, might
make the punctuation worse.

=head1 BUGS

Please report any bugs to
L<https://github.com/tobyink/p5-acme-conspiracytheory-random/issues>.

=head1 SEE ALSO

REDACTED

=head1 AUTHOR

Toby Inkster E<lt>tobyink@cpan.orgE<gt>.

=head1 CONTRIBUTORS



( run in 0.539 second using v1.01-cache-2.11-cpan-140bd7fdf52 )