mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-09 11:46:24 -08:00
remove copy/pasted ports from alternate languages
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30114.105
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hello", "Hello.csproj", "{8ECD89E1-D9E1-4FA5-97B6-B1E68FE1CA16}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8ECD89E1-D9E1-4FA5-97B6-B1E68FE1CA16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8ECD89E1-D9E1-4FA5-97B6-B1E68FE1CA16}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8ECD89E1-D9E1-4FA5-97B6-B1E68FE1CA16}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8ECD89E1-D9E1-4FA5-97B6-B1E68FE1CA16}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,3 +0,0 @@
|
||||
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [Microsoft C#](https://docs.microsoft.com/en-us/dotnet/csharp/)
|
||||
@@ -1,216 +0,0 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* Game of Hello
|
||||
* <p>
|
||||
* Based on the BASIC game of Hello here
|
||||
* https://github.com/coding-horror/basic-computer-games/blob/main/45%20Hello/hello.bas
|
||||
* <p>
|
||||
* Note: The idea was to create a version of the 1970's BASIC game in Java, without introducing
|
||||
* new features - no additional text, error checking, etc has been added.
|
||||
*
|
||||
* Converted from BASIC to Java by Darren Cardenas.
|
||||
*/
|
||||
|
||||
public class Hello {
|
||||
|
||||
private static final int MONEY_WAIT_MS = 3000;
|
||||
|
||||
private final boolean goodEnding = false;
|
||||
|
||||
private final Scanner scan; // For user input
|
||||
|
||||
public Hello() {
|
||||
|
||||
scan = new Scanner(System.in);
|
||||
|
||||
} // End of constructor Hello
|
||||
|
||||
public void play() {
|
||||
|
||||
showIntro();
|
||||
startGame();
|
||||
|
||||
} // End of method play
|
||||
|
||||
private static void showIntro() {
|
||||
|
||||
System.out.println(" ".repeat(32) + "HELLO");
|
||||
System.out.println(" ".repeat(14) + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY");
|
||||
System.out.println("\n\n");
|
||||
|
||||
} // End of method showIntro
|
||||
|
||||
private void startGame() {
|
||||
|
||||
boolean moreProblems = true;
|
||||
|
||||
String userCategory = "";
|
||||
String userName = "";
|
||||
String userResponse = "";
|
||||
|
||||
// Name question
|
||||
System.out.println("HELLO. MY NAME IS CREATIVE COMPUTER.\n\n");
|
||||
System.out.print("WHAT'S YOUR NAME? ");
|
||||
userName = scan.nextLine();
|
||||
System.out.println("");
|
||||
|
||||
// Enjoyment question
|
||||
System.out.print("HI THERE, " + userName + ", ARE YOU ENJOYING YOURSELF HERE? ");
|
||||
|
||||
while (true) {
|
||||
userResponse = scan.nextLine();
|
||||
System.out.println("");
|
||||
|
||||
if (userResponse.toUpperCase().equals("YES")) {
|
||||
System.out.println("I'M GLAD TO HEAR THAT, " + userName + ".\n");
|
||||
break;
|
||||
}
|
||||
else if (userResponse.toUpperCase().equals("NO")) {
|
||||
System.out.println("OH, I'M SORRY TO HEAR THAT, " + userName + ". MAYBE WE CAN");
|
||||
System.out.println("BRIGHTEN UP YOUR VISIT A BIT.");
|
||||
break;
|
||||
}
|
||||
else {
|
||||
System.out.println(userName + ", I DON'T UNDERSTAND YOUR ANSWER OF '" + userResponse + "'.");
|
||||
System.out.print("PLEASE ANSWER 'YES' OR 'NO'. DO YOU LIKE IT HERE? ");
|
||||
}
|
||||
}
|
||||
|
||||
// Category question
|
||||
System.out.println("");
|
||||
System.out.println("SAY, " + userName + ", I CAN SOLVE ALL KINDS OF PROBLEMS EXCEPT");
|
||||
System.out.println("THOSE DEALING WITH GREECE. WHAT KIND OF PROBLEMS DO");
|
||||
System.out.print("YOU HAVE (ANSWER SEX, HEALTH, MONEY, OR JOB)? ");
|
||||
|
||||
while (moreProblems) {
|
||||
userCategory = scan.nextLine();
|
||||
System.out.println("");
|
||||
|
||||
// Sex advice
|
||||
if (userCategory.toUpperCase().equals("SEX")) {
|
||||
System.out.print("IS YOUR PROBLEM TOO MUCH OR TOO LITTLE? ");
|
||||
userResponse = scan.nextLine();
|
||||
System.out.println("");
|
||||
|
||||
while (true) {
|
||||
if (userResponse.toUpperCase().equals("TOO MUCH")) {
|
||||
System.out.println("YOU CALL THAT A PROBLEM?!! I SHOULD HAVE SUCH PROBLEMS!");
|
||||
System.out.println("IF IT BOTHERS YOU, " + userName + ", TAKE A COLD SHOWER.");
|
||||
break;
|
||||
}
|
||||
else if (userResponse.toUpperCase().equals("TOO LITTLE")) {
|
||||
System.out.println("WHY ARE YOU HERE IN SUFFERN, " + userName + "? YOU SHOULD BE");
|
||||
System.out.println("IN TOKYO OR NEW YORK OR AMSTERDAM OR SOMEPLACE WITH SOME");
|
||||
System.out.println("REAL ACTION.");
|
||||
break;
|
||||
}
|
||||
else {
|
||||
System.out.println("DON'T GET ALL SHOOK, " + userName + ", JUST ANSWER THE QUESTION");
|
||||
System.out.print("WITH 'TOO MUCH' OR 'TOO LITTLE'. WHICH IS IT? ");
|
||||
userResponse = scan.nextLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Health advice
|
||||
else if (userCategory.toUpperCase().equals("HEALTH")) {
|
||||
System.out.println("MY ADVICE TO YOU " + userName + " IS:");
|
||||
System.out.println(" 1. TAKE TWO ASPRIN");
|
||||
System.out.println(" 2. DRINK PLENTY OF FLUIDS (ORANGE JUICE, NOT BEER!)");
|
||||
System.out.println(" 3. GO TO BED (ALONE)");
|
||||
}
|
||||
// Money advice
|
||||
else if (userCategory.toUpperCase().equals("MONEY")) {
|
||||
System.out.println("SORRY, " + userName + ", I'M BROKE TOO. WHY DON'T YOU SELL");
|
||||
System.out.println("ENCYCLOPEADIAS OR MARRY SOMEONE RICH OR STOP EATING");
|
||||
System.out.println("SO YOU WON'T NEED SO MUCH MONEY?");
|
||||
}
|
||||
// Job advice
|
||||
else if (userCategory.toUpperCase().equals("JOB")) {
|
||||
System.out.println("I CAN SYMPATHIZE WITH YOU " + userName + ". I HAVE TO WORK");
|
||||
System.out.println("VERY LONG HOURS FOR NO PAY -- AND SOME OF MY BOSSES");
|
||||
System.out.println("REALLY BEAT ON MY KEYBOARD. MY ADVICE TO YOU, " + userName + ",");
|
||||
System.out.println("IS TO OPEN A RETAIL COMPUTER STORE. IT'S GREAT FUN.");
|
||||
}
|
||||
else {
|
||||
System.out.println("OH, " + userName + ", YOUR ANSWER OF " + userCategory + " IS GREEK TO ME.");
|
||||
}
|
||||
|
||||
// More problems question
|
||||
while (true) {
|
||||
System.out.println("");
|
||||
System.out.print("ANY MORE PROBLEMS YOU WANT SOLVED, " + userName + "? ");
|
||||
userResponse = scan.nextLine();
|
||||
System.out.println("");
|
||||
|
||||
if (userResponse.toUpperCase().equals("YES")) {
|
||||
System.out.print("WHAT KIND (SEX, MONEY, HEALTH, JOB)? ");
|
||||
break;
|
||||
}
|
||||
else if (userResponse.toUpperCase().equals("NO")) {
|
||||
moreProblems = false;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
System.out.println("JUST A SIMPLE 'YES' OR 'NO' PLEASE, " + userName + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Payment question
|
||||
System.out.println("");
|
||||
System.out.println("THAT WILL BE $5.00 FOR THE ADVICE, " + userName + ".");
|
||||
System.out.println("PLEASE LEAVE THE MONEY ON THE TERMINAL.");
|
||||
|
||||
// Pause
|
||||
try {
|
||||
Thread.sleep(MONEY_WAIT_MS);
|
||||
} catch (Exception e) {
|
||||
System.out.println("Caught Exception: " + e.getMessage());
|
||||
}
|
||||
|
||||
System.out.println("\n\n");
|
||||
|
||||
while (true) {
|
||||
System.out.print("DID YOU LEAVE THE MONEY? ");
|
||||
userResponse = scan.nextLine();
|
||||
System.out.println("");
|
||||
|
||||
if (userResponse.toUpperCase().equals("YES")) {
|
||||
System.out.println("HEY, " + userName + "??? YOU LEFT NO MONEY AT ALL!");
|
||||
System.out.println("YOU ARE CHEATING ME OUT OF MY HARD-EARNED LIVING.");
|
||||
System.out.println("");
|
||||
System.out.println("WHAT A RIP OFF, " + userName + "!!!\n");
|
||||
break;
|
||||
}
|
||||
else if (userResponse.toUpperCase().equals("NO")) {
|
||||
System.out.println("THAT'S HONEST, " + userName + ", BUT HOW DO YOU EXPECT");
|
||||
System.out.println("ME TO GO ON WITH MY PSYCHOLOGY STUDIES IF MY PATIENTS");
|
||||
System.out.println("DON'T PAY THEIR BILLS?");
|
||||
break;
|
||||
}
|
||||
else {
|
||||
System.out.println("YOUR ANSWER OF '" + userResponse + "' CONFUSES ME, " + userName + ".");
|
||||
System.out.println("PLEASE RESPOND WITH 'YES' OR 'NO'.");
|
||||
}
|
||||
}
|
||||
|
||||
// Legacy included unreachable code
|
||||
if (goodEnding) {
|
||||
System.out.println("NICE MEETING YOU, " + userName + ", HAVE A NICE DAY.");
|
||||
}
|
||||
else {
|
||||
System.out.println("");
|
||||
System.out.println("TAKE A WALK, " + userName + ".\n");
|
||||
}
|
||||
|
||||
} // End of method startGame
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Hello hello = new Hello();
|
||||
hello.play();
|
||||
|
||||
} // End of method main
|
||||
|
||||
} // End of class Hello
|
||||
@@ -1,3 +0,0 @@
|
||||
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [Oracle Java](https://openjdk.java.net/)
|
||||
@@ -1,3 +0,0 @@
|
||||
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Shells)
|
||||
@@ -1,9 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>HELLO</title>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="output" style="font-size: 12pt;"></pre>
|
||||
<script src="hello.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,163 +0,0 @@
|
||||
// HELLO
|
||||
//
|
||||
// Converted from BASIC to Javascript by Oscar Toledo G. (nanochess)
|
||||
//
|
||||
|
||||
function print(str)
|
||||
{
|
||||
document.getElementById("output").appendChild(document.createTextNode(str));
|
||||
}
|
||||
|
||||
function input()
|
||||
{
|
||||
var input_element;
|
||||
var input_str;
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
input_element = document.createElement("INPUT");
|
||||
|
||||
print("? ");
|
||||
input_element.setAttribute("type", "text");
|
||||
input_element.setAttribute("length", "50");
|
||||
document.getElementById("output").appendChild(input_element);
|
||||
input_element.focus();
|
||||
input_str = undefined;
|
||||
input_element.addEventListener("keydown", function (event) {
|
||||
if (event.keyCode == 13) {
|
||||
input_str = input_element.value;
|
||||
document.getElementById("output").removeChild(input_element);
|
||||
print(input_str);
|
||||
print("\n");
|
||||
resolve(input_str);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function tab(space)
|
||||
{
|
||||
var str = "";
|
||||
while (space-- > 0)
|
||||
str += " ";
|
||||
return str;
|
||||
}
|
||||
|
||||
// Main control section
|
||||
async function main()
|
||||
{
|
||||
print(tab(33) + "HELLO\n");
|
||||
print(tab(15) + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n");
|
||||
print("\n");
|
||||
print("\n");
|
||||
print("\n");
|
||||
print("HELLO. MY NAME IS CREATIVE COMPUTER.\n");
|
||||
print("\n");
|
||||
print("\n");
|
||||
print("WHAT'S YOUR NAME");
|
||||
ns = await input();
|
||||
print("\n");
|
||||
print("HI THERE, " + ns + ", ARE YOU ENJOYING YOURSELF HERE");
|
||||
while (1) {
|
||||
bs = await input();
|
||||
print("\n");
|
||||
if (bs == "YES") {
|
||||
print("I'M GLAD TO HEAR THAT, " + ns + ".\n");
|
||||
print("\n");
|
||||
break;
|
||||
} else if (bs == "NO") {
|
||||
print("OH, I'M SORRY TO HEAR THAT, " + ns + ". MAYBE WE CAN\n");
|
||||
print("BRIGHTEN UP YOUR VISIT A BIT.\n");
|
||||
break;
|
||||
} else {
|
||||
print("PLEASE ANSWER 'YES' OR 'NO'. DO YOU LIKE IT HERE");
|
||||
}
|
||||
}
|
||||
print("\n");
|
||||
print("SAY, " + ns + ", I CAN SOLVED ALL KINDS OF PROBLEMS EXCEPT\n");
|
||||
print("THOSE DEALING WITH GREECE. WHAT KIND OF PROBLEMS DO\n");
|
||||
print("YOU HAVE (ANSWER SEX, HEALTH, MONEY, OR JOB)");
|
||||
while (1) {
|
||||
cs = await input();
|
||||
print("\n");
|
||||
if (cs != "SEX" && cs != "HEALTH" && cs != "MONEY" && cs != "JOB") {
|
||||
print("OH, " + ns + ", YOUR ANSWER OF " + cs + " IS GREEK TO ME.\n");
|
||||
} else if (cs == "JOB") {
|
||||
print("I CAN SYMPATHIZE WITH YOU " + ns + ". I HAVE TO WORK\n");
|
||||
print("VERY LONG HOURS FOR NO PAY -- AND SOME OF MY BOSSES\n");
|
||||
print("REALLY BEAT ON MY KEYBOARD. MY ADVICE TO YOU, " + ns + ",\n");
|
||||
print("IS TO OPEN A RETAIL COMPUTER STORE. IT'S GREAT FUN.\n");
|
||||
} else if (cs == "MONEY") {
|
||||
print("SORRY, " + ns + ", I'M BROKE TOO. WHY DON'T YOU SELL\n");
|
||||
print("ENCYCLOPEADIAS OR MARRY SOMEONE RICH OR STOP EATING\n");
|
||||
print("SO YOU WON'T NEED SO MUCH MONEY?\n");
|
||||
} else if (cs == "HEALTH") {
|
||||
print("MY ADVICE TO YOU " + ns + " IS:\n");
|
||||
print(" 1. TAKE TWO ASPRIN\n");
|
||||
print(" 2. DRINK PLENTY OF FLUIDS (ORANGE JUICE, NOT BEER!)\n");
|
||||
print(" 3. GO TO BED (ALONE)\n");
|
||||
} else {
|
||||
print("IS YOUR PROBLEM TOO MUCH OR TOO LITTLE");
|
||||
while (1) {
|
||||
ds = await input();
|
||||
print("\n");
|
||||
if (ds == "TOO MUCH") {
|
||||
print("YOU CALL THAT A PROBLEM?!! I SHOULD HAVE SUCH PROBLEMS!\n");
|
||||
print("IF IT BOTHERS YOU, " + ns + ", TAKE A COLD SHOWER.\n");
|
||||
break;
|
||||
} else if (ds == "TOO LITTLE") {
|
||||
print("WHY ARE YOU HERE IN SUFFERN, " + ns + "? YOU SHOULD BE\n");
|
||||
print("IN TOKYO OR NEW YORK OR AMSTERDAM OR SOMEPLACE WITH SOME\n");
|
||||
print("REAL ACTION.\n");
|
||||
break;
|
||||
} else {
|
||||
print("DON'T GET ALL SHOOK, " + ns + ", JUST ANSWER THE QUESTION\n");
|
||||
print("WITH 'TOO MUCH' OR 'TOO LITTLE'. WHICH IS IT");
|
||||
}
|
||||
}
|
||||
}
|
||||
print("\n");
|
||||
print("ANY MORE PROBLEMS YOU WANT SOLVED, " + ns);
|
||||
es = await input();
|
||||
print("\n");
|
||||
if (es == "YES") {
|
||||
print("WHAT KIND (SEX, MONEY, HEALTH, JOB)");
|
||||
} else if (es == "NO") {
|
||||
print("THAT WILL BE $5.00 FOR THE ADVICE, " + ns + ".\n");
|
||||
print("PLEASE LEAVE THE MONEY ON THE TERMINAL.\n");
|
||||
print("\n");
|
||||
// d = new Date().valueOf();
|
||||
// while (new Date().valueOf() - d < 2000) ;
|
||||
print("\n");
|
||||
print("\n");
|
||||
while (1) {
|
||||
print("DID YOU LEAVE THE MONEY");
|
||||
gs = await input();
|
||||
print("\n");
|
||||
if (gs == "YES") {
|
||||
print("HEY, " + ns + "??? YOU LEFT NO MONEY AT ALL!\n");
|
||||
print("YOU ARE CHEATING ME OUT OF MY HARD-EARNED LIVING.\n");
|
||||
print("\n");
|
||||
print("WHAT A RIP OFF, " + ns + "!!!\n");
|
||||
print("\n");
|
||||
break;
|
||||
} else if (gs == "NO") {
|
||||
print("THAT'S HONEST, " + ns + ", BUT HOW DO YOU EXPECT\n");
|
||||
print("ME TO GO ON WITH MY PSYCHOLOGY STUDIES IF MY PATIENT\n");
|
||||
print("DON'T PAY THEIR BILLS?\n");
|
||||
break;
|
||||
} else {
|
||||
print("YOUR ANSWER OF '" + gs + "' CONFUSES ME, " + ns + ".\n");
|
||||
print("PLEASE RESPOND WITH 'YES' OR 'NO'.\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
print("\n");
|
||||
print("TAKE A WALK, " + ns + ".\n");
|
||||
print("\n");
|
||||
print("\n");
|
||||
// Line 390 not used in original
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -1,3 +0,0 @@
|
||||
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language))
|
||||
@@ -1,3 +0,0 @@
|
||||
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [Perl](https://www.perl.org/)
|
||||
@@ -1,136 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
print ' ' x 33 . "HELLO\n";
|
||||
print ' ' x 15 . "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n";
|
||||
print "\n\n\n";
|
||||
|
||||
print "HELLO. MY NAME IS CREATIVE COMPUTER.\n\n\n";
|
||||
print "WHAT'S YOUR NAME?\n";
|
||||
chomp( my $N = uc <STDIN> );
|
||||
|
||||
print "\nHI THERE, $N, ARE YOU ENJOYING YOURSELF HERE?\n";
|
||||
|
||||
GREET:
|
||||
{
|
||||
chomp( my $B = uc <STDIN> );
|
||||
print "\n";
|
||||
|
||||
if ( $B eq 'YES' ) {
|
||||
print "I'M GLAD TO HEAR THAT, $N.\n\n";
|
||||
}
|
||||
elsif ( $B eq 'NO' ) {
|
||||
print "OH, I'M SORRY TO HEAR THAT, $N. MAYBE WE CAN\n";
|
||||
print "BRIGHTEN UP YOUR VISIT A BIT.\n";
|
||||
}
|
||||
else {
|
||||
print "$N, I DON'T UNDERSTAND YOUR ANSWER OF '$B'.\n";
|
||||
print "PLEASE ANSWER 'YES' OR 'NO'. DO YOU LIKE IT HERE?\n";
|
||||
redo GREET;
|
||||
}
|
||||
}
|
||||
|
||||
print "\nSAY, $N, I CAN SOLVE ALL KINDS OF PROBLEMS EXCEPT\n";
|
||||
print "THOSE DEALING WITH GREECE. WHAT KIND OF PROBLEMS DO\n";
|
||||
print "YOU HAVE (ANSWER SEX, HEALTH, MONEY, OR JOB)?\n";
|
||||
|
||||
ADVICE:
|
||||
{
|
||||
chomp( my $C = uc <STDIN> );
|
||||
print "\n";
|
||||
|
||||
if ( $C eq 'SEX' ) {
|
||||
print "IS YOUR PROBLEM TOO MUCH OR TOO LITTLE?\n";
|
||||
|
||||
SEX:
|
||||
{
|
||||
chomp( my $D = uc <STDIN> );
|
||||
print "\n";
|
||||
|
||||
if ( $D eq 'TOO MUCH' ) {
|
||||
print "YOU CALL THAT A PROBLEM?!! I SHOULD HAVE SUCH PROBLEMS!\n";
|
||||
print "IF IT BOTHERS YOU, $N, TAKE A COLD SHOWER.\n";
|
||||
}
|
||||
elsif ( $D eq 'TOO LITTLE' ) {
|
||||
print "WHY ARE YOU HERE IN SUFFERN, $N? YOU SHOULD BE\n";
|
||||
print "IN TOKYO OR NEW YORK OR AMSTERDAM OR SOMEPLACE WITH SOME\n";
|
||||
print "REAL ACTION.\n";
|
||||
}
|
||||
else {
|
||||
print "DON'T GET ALL SHOOK, $N, JUST ANSWER THE QUESTION\n";
|
||||
print "WITH 'TOO MUCH' OR 'TOO LITTLE'. WHICH IS IT?\n";
|
||||
redo SEX;
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $C eq 'HEALTH' ) {
|
||||
print "MY ADVICE TO YOU $N IS:\n";
|
||||
print " 1. TAKE TWO ASPRIN\n";
|
||||
print " 2. DRINK PLENTY OF FLUIDS (ORANGE JUICE, NOT BEER!)\n";
|
||||
print " 3. GO TO BED (ALONE)\n";
|
||||
}
|
||||
elsif ( $C eq 'MONEY' ) {
|
||||
print "SORRY, $N, I'M BROKE TOO. WHY DON'T YOU SELL\n";
|
||||
print "ENCYCLOPEADIAS OR MARRY SOMEONE RICH OR STOP EATING\n";
|
||||
print "SO YOU WON'T NEED SO MUCH MONEY?\n";
|
||||
}
|
||||
elsif ( $C eq 'JOB' ) {
|
||||
print "I CAN SYMPATHIZE WITH YOU $N. I HAVE TO WORK\n";
|
||||
print "VERY LONG HOURS FOR NO PAY -- AND SOME OF MY BOSSES\n";
|
||||
print "REALLY BEAT ON MY KEYBOARD. MY ADVICE TO YOU, $N,\n";
|
||||
print "IS TO OPEN A RETAIL COMPUTER STORE. IT'S GREAT FUN.\n";
|
||||
}
|
||||
else {
|
||||
print "OH, $N, YOUR ANSWER OF '$C' IS GREEK TO ME.\n";
|
||||
}
|
||||
|
||||
MORE:
|
||||
{
|
||||
print "\nANY MORE PROBLEMS YOU WANT SOLVED, $N?\n";
|
||||
chomp( my $E = uc <STDIN> );
|
||||
print "\n";
|
||||
|
||||
if ( $E eq 'YES' ) {
|
||||
print "WHAT KIND (SEX, MONEY, HEALTH, JOB)?\n";
|
||||
redo ADVICE;
|
||||
}
|
||||
elsif ( $E eq 'NO' ) {
|
||||
print "\nTHAT WILL BE \$5.00 FOR THE ADVICE, $N.\n";
|
||||
print "PLEASE LEAVE THE MONEY ON THE TERMINAL.\n";
|
||||
}
|
||||
else {
|
||||
print "JUST A SIMPLE 'YES' OR 'NO' PLEASE, $N.\n";
|
||||
redo MORE;
|
||||
}
|
||||
}
|
||||
|
||||
sleep 2;
|
||||
print "\n\n\n";
|
||||
|
||||
MONEY:
|
||||
{
|
||||
print "DID YOU LEAVE THE MONEY?\n";
|
||||
chomp( my $G = uc <STDIN> );
|
||||
print "\n";
|
||||
|
||||
if ( $G eq 'YES' ) {
|
||||
print "HEY, $N??? YOU LEFT NO MONEY AT ALL!\n";
|
||||
print "YOU ARE CHEATING ME OUT OF MY HARD-EARNED LIVING.\n";
|
||||
print "\nWHAT A RIP OFF, $N!!!\n\n";
|
||||
}
|
||||
elsif ( $G eq 'NO' ) {
|
||||
print "THAT'S HONEST, $N, BUT HOW DO YOU EXPECT\n";
|
||||
print "ME TO GO ON WITH MY PSYCHOLOGY STUDIES IF MY PATIENTS\n";
|
||||
print "DON'T PAY THEIR BILLS?\n";
|
||||
}
|
||||
else {
|
||||
print "YOUR ANSWER OF '$G' CONFUSES ME, $N.\n";
|
||||
print "PLEASE RESPOND WITH 'YES' OR 'NO'.\n";
|
||||
redo MONEY;
|
||||
}
|
||||
|
||||
print "\nTAKE A WALK, $N.\n\n\n";
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [Python](https://www.python.org/about/)
|
||||
@@ -1,206 +0,0 @@
|
||||
"""
|
||||
HELLO
|
||||
|
||||
A very simple "chat" bot.
|
||||
|
||||
Warning, the advice given here is bad.
|
||||
|
||||
Ported by Dave LeCompte
|
||||
"""
|
||||
|
||||
import time
|
||||
|
||||
|
||||
def print_with_tab(space_count, msg):
|
||||
if space_count > 0:
|
||||
spaces = " " * space_count
|
||||
else:
|
||||
spaces = ""
|
||||
print(spaces + msg)
|
||||
|
||||
|
||||
def get_yes_or_no():
|
||||
msg = input()
|
||||
if msg.upper() == "YES":
|
||||
return True, True, msg
|
||||
elif msg.upper() == "NO":
|
||||
return True, False, msg
|
||||
else:
|
||||
return False, None, msg
|
||||
|
||||
|
||||
def ask_enjoy_question(user_name):
|
||||
print(f"HI THERE, {user_name}, ARE YOU ENJOYING YOURSELF HERE?")
|
||||
|
||||
while True:
|
||||
valid, value, msg = get_yes_or_no()
|
||||
|
||||
if valid:
|
||||
if value:
|
||||
print(f"I'M GLAD TO HEAR THAT, {user_name}.")
|
||||
print()
|
||||
else:
|
||||
print(f"OH, I'M SORRY TO HEAR THAT, {user_name}. MAYBE WE CAN")
|
||||
print("BRIGHTEN UP YOUR VISIT A BIT.")
|
||||
break
|
||||
else:
|
||||
print(f"{user_name}, I DON'T UNDERSTAND YOUR ANSWER OF '{msg}'.")
|
||||
print("PLEASE ANSWER 'YES' OR 'NO'. DO YOU LIKE IT HERE?")
|
||||
|
||||
|
||||
def prompt_for_problems(user_name):
|
||||
print()
|
||||
print(f"SAY, {user_name}, I CAN SOLVE ALL KINDS OF PROBLEMS EXCEPT")
|
||||
print("THOSE DEALING WITH GREECE. WHAT KIND OF PROBLEMS DO")
|
||||
print("YOU HAVE? (ANSWER SEX, HEALTH, MONEY, OR JOB)")
|
||||
|
||||
problem_type = input().upper()
|
||||
return problem_type
|
||||
|
||||
|
||||
def prompt_too_much_or_too_little():
|
||||
answer = input().upper()
|
||||
if answer == "TOO MUCH":
|
||||
return True, True
|
||||
elif answer == "TOO LITTLE":
|
||||
return True, False
|
||||
return False, None
|
||||
|
||||
|
||||
def solve_sex_problem(user_name):
|
||||
print("IS YOUR PROBLEM TOO MUCH OR TOO LITTLE?")
|
||||
while True:
|
||||
valid, too_much = prompt_too_much_or_too_little()
|
||||
if valid:
|
||||
if too_much:
|
||||
print("YOU CALL THAT A PROBLEM?!! I SHOULD HAVE SUCH PROBLEMS!")
|
||||
print(f"IF IT BOTHERS YOU, {user_name}, TAKE A COLD SHOWER.")
|
||||
else:
|
||||
print(f"WHY ARE YOU HERE IN SUFFERN, {user_name}? YOU SHOULD BE")
|
||||
print("IN TOKYO OR NEW YORK OR AMSTERDAM OR SOMEPLACE WITH SOME")
|
||||
print("REAL ACTION.")
|
||||
return
|
||||
else:
|
||||
print(f"DON'T GET ALL SHOOK, {user_name}, JUST ANSWER THE QUESTION")
|
||||
print("WITH 'TOO MUCH' OR 'TOO LITTLE'. WHICH IS IT?")
|
||||
|
||||
|
||||
def solve_money_problem(user_name):
|
||||
print(f"SORRY, {user_name}, I'M BROKE TOO. WHY DON'T YOU SELL")
|
||||
print("ENCYCLOPEADIAS OR MARRY SOMEONE RICH OR STOP EATING")
|
||||
print("SO YOU WON'T NEED SO MUCH MONEY?")
|
||||
|
||||
|
||||
def solve_health_problem(user_name):
|
||||
print(f"MY ADVICE TO YOU {user_name} IS:")
|
||||
print(" 1. TAKE TWO ASPRIN")
|
||||
print(" 2. DRINK PLENTY OF FLUIDS (ORANGE JUICE, NOT BEER!)")
|
||||
print(" 3. GO TO BED (ALONE)")
|
||||
|
||||
|
||||
def solve_job_problem(user_name):
|
||||
print(f"I CAN SYMPATHIZE WITH YOU {user_name}. I HAVE TO WORK")
|
||||
print("VERY LONG HOURS FOR NO PAY -- AND SOME OF MY BOSSES")
|
||||
print(f"REALLY BEAT ON MY KEYBOARD. MY ADVICE TO YOU, {user_name},")
|
||||
print("IS TO OPEN A RETAIL COMPUTER STORE. IT'S GREAT FUN.")
|
||||
|
||||
|
||||
def alert_unknown_problem_type(user_name, problem_type):
|
||||
print(f"OH, {user_name}, YOUR ANSWER OF {problem_type} IS GREEK TO ME.")
|
||||
|
||||
|
||||
def ask_question_loop(user_name):
|
||||
while True:
|
||||
problem_type = prompt_for_problems(user_name)
|
||||
if problem_type == "SEX":
|
||||
solve_sex_problem(user_name)
|
||||
elif problem_type == "HEALTH":
|
||||
solve_health_problem(user_name)
|
||||
elif problem_type == "MONEY":
|
||||
solve_money_problem(user_name)
|
||||
elif problem_type == "JOB":
|
||||
solve_job_problem(user_name)
|
||||
else:
|
||||
alert_unknown_problem_type(user_name, problem_type)
|
||||
|
||||
while True:
|
||||
print()
|
||||
print(f"ANY MORE PROBLEMS YOU WANT SOLVED, {user_name}?")
|
||||
|
||||
valid, value, msg = get_yes_or_no()
|
||||
if valid:
|
||||
if value:
|
||||
print("WHAT KIND (SEX, MONEY, HEALTH, JOB)")
|
||||
break
|
||||
else:
|
||||
return
|
||||
print(f"JUST A SIMPLE 'YES' OR 'NO' PLEASE, {user_name}.")
|
||||
|
||||
|
||||
def ask_for_fee(user_name):
|
||||
print()
|
||||
print(f"THAT WILL BE $5.00 FOR THE ADVICE, {user_name}.")
|
||||
print("PLEASE LEAVE THE MONEY ON THE TERMINAL.")
|
||||
time.sleep(4)
|
||||
print()
|
||||
print()
|
||||
print()
|
||||
print("DID YOU LEAVE THE MONEY?")
|
||||
|
||||
while True:
|
||||
valid, value, msg = get_yes_or_no()
|
||||
if valid:
|
||||
if value:
|
||||
print(f"HEY, {user_name}, YOU LEFT NO MONEY AT ALL!")
|
||||
print("YOU ARE CHEATING ME OUT OF MY HARD-EARNED LIVING.")
|
||||
print()
|
||||
print(f"WHAT A RIP OFF, {user_name}!!!")
|
||||
print()
|
||||
else:
|
||||
print(f"THAT'S HONEST, {user_name}, BUT HOW DO YOU EXPECT")
|
||||
print("ME TO GO ON WITH MY PSYCHOLOGY STUDIES IF MY PATIENTS")
|
||||
print("DON'T PAY THEIR BILLS?")
|
||||
return
|
||||
else:
|
||||
print(f"YOUR ANSWER OF '{msg}' CONFUSES ME, {user_name}.")
|
||||
print("PLEASE RESPOND WITH 'YES' or 'NO'.")
|
||||
|
||||
|
||||
def unhappy_goodbye(user_name):
|
||||
print()
|
||||
print(f"TAKE A WALK, {user_name}.")
|
||||
print()
|
||||
print()
|
||||
|
||||
|
||||
def happy_goodbye(user_name):
|
||||
print(f"NICE MEETING YOU, {user_name}, HAVE A NICE DAY.")
|
||||
|
||||
|
||||
def main():
|
||||
print_with_tab(33, "HELLO")
|
||||
print_with_tab(15, "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY")
|
||||
print()
|
||||
print()
|
||||
print()
|
||||
print("HELLO. MY NAME IS CREATIVE COMPUTER.")
|
||||
print()
|
||||
print()
|
||||
print("WHAT'S YOUR NAME?")
|
||||
user_name = input()
|
||||
print()
|
||||
|
||||
ask_enjoy_question(user_name)
|
||||
|
||||
ask_question_loop(user_name)
|
||||
|
||||
ask_for_fee(user_name)
|
||||
|
||||
if False:
|
||||
happy_goodbye(user_name)
|
||||
else:
|
||||
unhappy_goodbye(user_name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,3 +0,0 @@
|
||||
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [Ruby](https://www.ruby-lang.org/en/)
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30114.105
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Hello", "Hello.vbproj", "{7E2BDA03-A9F7-4DE5-AB8F-222DD87C833D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{7E2BDA03-A9F7-4DE5-AB8F-222DD87C833D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7E2BDA03-A9F7-4DE5-AB8F-222DD87C833D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7E2BDA03-A9F7-4DE5-AB8F-222DD87C833D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7E2BDA03-A9F7-4DE5-AB8F-222DD87C833D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,8 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Hello</RootNamespace>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<LangVersion>16.9</LangVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,3 +0,0 @@
|
||||
Original BASIC source [downloaded from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [Visual Basic .NET](https://en.wikipedia.org/wiki/Visual_Basic_.NET)
|
||||
Reference in New Issue
Block a user