If this sentence is true, then gamedev.net does not exist.
Considering that A is the sentence itself, and "gamedev.net does not exist" is B:
if A then B
The correct result is true or false?
If this sentence is true, then gamedev.net does not exist.
Considering that A is the sentence itself, and "gamedev.net does not exist" is B:
if A then B
The correct result is true or false?
Creator and only composer at Poisone Wein and Übelkraft dark musical projects:
Edit:
String a = "If this sentence is true, then gamedev.net does not exist.";
String gamedev;
public boolean getExisting(String s){
if (s != null){
gamedev = null;
return true;
}
else{
return false;
}
}
boolean answer = getExisting(a);
I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.
~ Ralph Waldo Emerson
1: GameDev.Net exists. (premise)
2: A => B (premise)
3: ~A v B (definition of =>)
4: Either this sentence is false or GameDev.Net does not exist. (definitions of A, B, v)
5: Either the sentence "Either this sentence is false or GameDev.Net does not exist" is false, or GameDev.Net does not exist (definition of A, again)
6: Therefore, the sentence "Either this sentence is false or GameDev.Net does not exist." is true. (or elimination on 4)
7: Therefore, GameDev.net does not exist. (implication elimination by way of 2,6)
8: Contradiction. (by 1,7)
9: Contradiction. (by way of 2, 8; since GameDev.net DOES in fact exist, and if we assume that the relation A => B is true then we get a contradiction)
10: Therefore, ~(A => B) (by 2,9)
In other words, the sentence "If this sentence is true, then gamedev.net does not exist." is false.
if ("this sentence is true, then gamedev.net does not exist.") {
printf("Oh teh noes!!!1");
}
In Python, any string is true by default (For just existing, I suppose). The problem is with the result, for it can't be true just because the sentence is true, but, it is the case.
if "this sentence is true":
print "Gamedev.net does not exist."
Creator and only composer at Poisone Wein and Übelkraft dark musical projects:
#include <iostream>
#include <string>
#include <logic>
using namespace std;
void answer(bool yesOrNo);
int main(int argc, char const *argv[])
{
bool isLifeGoingOn = true;
bool isThisSentenceTrue;
bool gamedevDotNetExists = true;
initBrain();
leaveBed();
eatPizzaOrWhateversInTheFridgeThatsNotSpoiledAndWithinValidityAndIsMinimallyApetizing();
drinkCoffee();
while (isLifeGoingOn)
{
cout << "is this sentence true?" << endl;
if (gamedevDotNetExists)
{
isThisSentenceTrue = false;
answer(false);
}
else
{
isThisSentenceTrue = true;
answer(true);
}
cout << "Gamedev.net exits?" << endl;
if (isThisSentenceTrue)
{
gamedevDotNetExists = false;
answer(false);
isLifeGoingOn = false;
}
else
{
answer(true);
}
}
return 0;
}
void answer(bool yesOrNo)
{
if (yesOrNo) cout << "Yes!" << endl << endl;
else cout << "No..." << endl << endl;
}
I created a pointer of type Toilet so I don't have to go to the bathroom as often.
A version with lambda and list comprehension :).
import sys
sentence = True
answer = lambda x: [sys.stdout.write("Gamedev.net does not exist.") for x in [0] if sentence is True]
answer(sentence)
Creator and only composer at Poisone Wein and Übelkraft dark musical projects:
+1 for the time you took to write this (in your other thread)
No praise for a highly descriptive function name?
I created a pointer of type Toilet so I don't have to go to the bathroom as often.