Skip to content

Instantly share code, notes, and snippets.

@kmdupr33
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmdupr33/7df17204478aa27f53c0 to your computer and use it in GitHub Desktop.
Save kmdupr33/7df17204478aa27f53c0 to your computer and use it in GitHub Desktop.
package com.philosophicalhacker.philosopy;
/**
* This class contains some methods for evaluating arguments that
* attempt to defend the moral permissibility of pirating.
*
* It also contains a <code>main()</code> method that uses
* this class to show that several of the arguments made in
* defense of pirating aren't really that compelling.
*
* @author PhilosophicalHacker
* @see <a href="www.philosophicalhacker.com">The PhilosophicalHacker Blog<a/>
* @version 1.0
*/
public class PiratingIsProbablyWrong {
public static final String NO_HARM_ARGUMENT = "No harm argument";
public static final String NO_OTHER_ALTERNATIVE_ARGUMENT = "No other alternative argument";
//===========================================
// Introduction
//===========================================
public static int main(String[] args) {
World ourWorld = World.getSharedInstance();
if (ourWorld.getNumberOfPeopleWhoBelievePiratingIsMorallyDefensible() > 0) {
Internet internet = ourWorld.getInternet();
PiratingDefenseArgument[] piratingArgs = internet.getArgumentsInDefenseOfPirating();
for (PiratingDefenseArgument argument : piratingArgs) {
boolean isArgumentSound = PiratingIsProbablyWrong.isArgumentSound(argument);
if (isArgumentSound) {
return 1;
}
}
}
return 0;
}
/**
*
* @param argument
* @return true if an argument is valid and if its premises are true
* @see <a href="http://en.wikipedia.org/wiki/Soundness"></a>
*/
private static boolean isArgumentSound(PiratingDefenseArgument argument) {
if (!PiratingIsProbablyWrong.isArgumentValid(argument)) {
return false;
}
//Arguments we consider are valid, so we check for soundness:
for (Premise premise : argument.getPremises()) {
if (!PiratingIsProbablyWrong.isTrue(premise)) {
return false;
}
}
return true;
}
private static boolean isArgumentValid(PiratingDefenseArgument argument) {
String argumentName = argument.getName();
boolean isArgumentValid = true;
if (argumentName.equals(NO_HARM_ARGUMENT)) {
isArgumentValid = PiratingIsProbablyWrong.isNoHarmArgumentValid(argument);
} else if (argumentName.equals(NO_OTHER_ALTERNATIVE_ARGUMENT)) {
isArgumentValid = PiratingIsProbablyWrong.isNoOtherChoiceArgumentValid(argument);
} else {
throw new UnsupportedOperationException("Cannot determine validity of other arguments" +
"at this time");
}
return isArgumentValid;
}
//===========================================
// Are these arguments even valid?
//===========================================
private static boolean isNoHarmArgumentValid(PiratingDefenseArgument argument) {
Premise[] premises = argument.getPremises();
for (Premise premise : premises) {
System.out.println(premise);
}
/*
Output:
1) If my actions cause no harm, then my actions are morally permissible.
2) Pirating does not harm anyone. It harms no one because it merely copies
an already existing resource instead of 'stealing' a scarce resource.
*/
System.out.println(argument.getConclusion());
/*
Output:
Therefore, pirating software is morally permissible.
*/
/*
returns true
*/
return Logic.isArgumentValid(argument);
}
private static boolean isNoOtherChoiceArgumentValid(PiratingDefenseArgument argument) {
Premise[] premises = argument.getPremises();
for (Premise premise : premises) {
System.out.println(premise);
}
/*
Output:
1) If someone has no other means of obtaining a good, then she is
permitted to obtain the good without compensating the creator of that good.
2) When I pirate, I only do so when I do not have any other means to obtain
what I want.
*/
System.out.println(argument.getConclusion());
/*
Output:
Therefore, pirating is morally permissible as long as I have no legal means
of obtaining what I want.
*/
/*
returns true
*/
return Logic.isArgumentValid(argument);
}
//===========================================
// So, both arguments are valid. Let's check
// for soundness by examining whether the
// premises are true
//===========================================
private static boolean isTrue(Premise premise) {
String premiseArgumentName = premise.getArgument().getName();
String premiseString = premise.toString();
//Premises for No Harm Argument
if (premiseArgumentName.equals(NO_HARM_ARGUMENT)) {
if (premiseString.equals("1) If my actions cause no harm, then my actions are " +
"morally permissible.")) {
/*
False because of counterexample:
Suppose that your mother's dying wish is to be buried next to your already
deceased father. Suppose further that you promised to deliver on your mother's
wish. You have an obligation to deliver on your promise, even if it doesn't
harm your mother or anyone else.
*/
return false;
}
//Considering the other premises is unnecessary...
} else if (premiseArgumentName.equals(NO_OTHER_ALTERNATIVE_ARGUMENT)) {
if (premiseString.equals("1)If someone has no other means of obtaining a good, then " +
"she is permitted to obtain the good without compensating the " +
"creator of that good.")) {
/*
False because of counterexample:
Suppose I create a video game. Suppose further that my target market cannot
currently afford my game but that, if they saved money for a month, they'd
be able to afford my game. If that happened, I make lots of money from
sales. Now, suppose that everyone pirates my game because they have no
other means of obtaining my game. Finally, suppose that my indie game
studio goes bankrupt merely because people were unwilling to save money
for a month to purchase my game.
TODO: Consider and reply to retort, "But we pirate from people who have plenty of money."
*/
return false;
}
//Considering the other premises is unnecessary...
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment