|
|
import java.io.*;
import java.util.*;
class IslamicRantGenerator
{
public String generateRant()
{
final StringBuffer rant = new StringBuffer();
addOneSentenceToRant(rant);
while(satisfies(CHANCE_OF_ANOTHER_SENTENCE))
{
rant.append(" ");
addOneSentenceToRant(rant);
}
return rant.toString();
}
private void addOneSentenceToRant(final StringBuffer rant)
{
rant.append("O God, ");
if(satisfies(CHANCE_OF_PHRASE_SUPPORTING_ISLAM))
addPhraseSupportingIslam(rant);
else
addPhraseCursingInfidel(rant);
if(satisfies(CHANCE_OF_FLOURISH))
{
rant.append(" ");
addFlourish(rant);
}
rant.append(".");
}
private void addPhraseSupportingIslam(final StringBuffer rant)
{
rant.append(chooseRandomItemFromArray(PHRASES_SUPPORTING_ISLAM));
while(satisfies(CHANCE_OF_RUN_ON_SENTENCE))
{
rant.append(", ");
rant.append(chooseRandomItemFromArray(PHRASES_SUPPORTING_ISLAM));
}
}
private void addPhraseCursingInfidel(final StringBuffer rant)
{
rant.append(chooseRandomItemFromArray(PHRASES_CURSING_THE_INFIDEL));
while(satisfies(CHANCE_OF_RUN_ON_SENTENCE))
{
rant.append(", ");
rant.append(chooseRandomItemFromArray(PHRASES_CURSING_THE_INFIDEL));
}
}
private void addFlourish(final StringBuffer rant)
{
rant.append(chooseRandomItemFromArray(FLOURISHES));
}
private String chooseRandomItemFromArray(final String[] choices)
{
return choices[generator.nextInt(choices.length)];
}
private boolean satisfies(final double chance)
{
return generator.nextDouble() <= chance;
}
public static void main(String[] args)
{
System.out.println(new IslamicRantGenerator().generateRant());
}
private final Random generator = new Random();
private static final double CHANCE_OF_ANOTHER_SENTENCE = 0.6;
private static final double CHANCE_OF_PHRASE_SUPPORTING_ISLAM = 0.5;
private static final double CHANCE_OF_RUN_ON_SENTENCE = 0.5;
private static final double CHANCE_OF_FLOURISH = 0.1;
private static final String[] PHRASES_SUPPORTING_ISLAM = {
"support those supporting Islam",
"support the mujahidin in Palestine and elsewhere",
"give us victory over your enemies",
"give us victory over the infidels",
"give victory to Muslims everywhere",
"free Al-Aqsa Mosque from the Zionist hands",
"spare Muslims of the plots that are being hatched against them",
"support the mujahidin for your sake everywhere",
"preserve Iraq and the people of Iraq from the oppression of the oppressors",
"support and strengthen the Palestinian mujahidin",
"strengthen and support these struggler people",
"give success and mercy to the nation of Muhammad",
"make them steadfast and strengthen their hearts",
"close the ranks of faithful Arabs and Muslims",
"help the Muslims' leaders support Islam and liberate Al-Aqsa Mosque",
"extend support to them",
"strengthen them",
"help them score victory over their enemies",
"strengthen Islam and Muslims",
"give them victory over the fanatic, oppressive atheists",
"give them victory over all their enemies"};
private static final String[] PHRASES_CURSING_THE_INFIDEL = {
"destroy the Zionist aggressors",
"destroy the unjust Americans and their supporters",
"protect us from their evils",
"weaken them",
"wipe them out",
"destroy their power",
"prevent them from committing aggression against your servants",
"destroy the aggressor",
"destroy the aggressor Americans",
"destroy the fanatic pagans",
"destroy the tyrannical Crusaders",
"put pressure on them and their supporters",
"deal with the occupier and usurper Jews",
"deal with our enemies and make their plans destroy them",
"disappoint the criminal Zionists",
"disperse their assemblies",
"unleash your might on them",
"deal with these criminals",
"avenge for your faithful subjects",
"destroy your enemies, the enemies of Islam",
"destroy the extremist, unfair Crusaders",
"instill fear in their hearts",
"freeze the blood in their veins",
"make fate turn against them"};
private static final String[] FLOURISHES = {
"for they are within your power",
"for the sake of the blood of the innocent children"};
}
|