Removed spaces from top-level directory names.

Spaces tend to cause annoyances in a Unix-style shell environment.
This change fixes that.
This commit is contained in:
Chris Reuter
2021-11-21 18:30:21 -05:00
parent df2e7426eb
commit d26dbf036a
1725 changed files with 0 additions and 0 deletions

17
87_3-D_Plot/3dplot.bas Normal file
View File

@@ -0,0 +1,17 @@
1 PRINT TAB(32);"3D PLOT"
2 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
3 PRINT:PRINT:PRINT
5 DEF FNA(Z)=30*EXP(-Z*Z/100)
100 PRINT
110 FOR X=-30 TO 30 STEP 1.5
120 L=0
130 Y1=5*INT(SQR(900-X*X)/5)
140 FOR Y=Y1 TO -Y1 STEP -5
150 Z=INT(25+FNA(SQR(X*X+Y*Y))-.7*Y)
160 IF Z<=L THEN 190
170 L=Z
180 PRINT TAB(Z);"*";
190 NEXT Y
200 PRINT
210 NEXT X
300 END

7
87_3-D_Plot/README.md Normal file
View File

@@ -0,0 +1,7 @@
### 3-D Plot
As published in Basic Computer Games (1978)
https://www.atariarchives.org/basicgames/showpage.php?page=167
Downloaded from Vintage Basic at
http://www.vintage-basic.net/games.html

View File

@@ -0,0 +1,34 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plot", "Plot\Plot.csproj", "{8857AE83-F481-43B0-AA51-D78E1340BD93}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8857AE83-F481-43B0-AA51-D78E1340BD93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8857AE83-F481-43B0-AA51-D78E1340BD93}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8857AE83-F481-43B0-AA51-D78E1340BD93}.Debug|x64.ActiveCfg = Debug|Any CPU
{8857AE83-F481-43B0-AA51-D78E1340BD93}.Debug|x64.Build.0 = Debug|Any CPU
{8857AE83-F481-43B0-AA51-D78E1340BD93}.Debug|x86.ActiveCfg = Debug|Any CPU
{8857AE83-F481-43B0-AA51-D78E1340BD93}.Debug|x86.Build.0 = Debug|Any CPU
{8857AE83-F481-43B0-AA51-D78E1340BD93}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8857AE83-F481-43B0-AA51-D78E1340BD93}.Release|Any CPU.Build.0 = Release|Any CPU
{8857AE83-F481-43B0-AA51-D78E1340BD93}.Release|x64.ActiveCfg = Release|Any CPU
{8857AE83-F481-43B0-AA51-D78E1340BD93}.Release|x64.Build.0 = Release|Any CPU
{8857AE83-F481-43B0-AA51-D78E1340BD93}.Release|x86.ActiveCfg = Release|Any CPU
{8857AE83-F481-43B0-AA51-D78E1340BD93}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
namespace Plot
{
internal static class Function
{
internal static IEnumerable<IEnumerable<int>> GetRows()
{
for (var x = -30f; x <= 30f; x += 1.5f)
{
yield return GetValues(x);
}
}
private static IEnumerable<int> GetValues(float x)
{
var zPrevious = 0;
var yLimit = 5 * (int)(Math.Sqrt(900 - x * x) / 5);
for (var y = yLimit; y >= -yLimit; y -= 5)
{
var z = GetValue(x, y);
if (z > zPrevious)
{
zPrevious = z;
yield return z;
}
}
}
private static int GetValue(float x, float y)
{
var r = (float)Math.Sqrt(x * x + y * y);
return (int)(25 + 30 * Math.Exp(-r * r / 100) - 0.7f * y);
}
}
}

View File

@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,38 @@
using System;
namespace Plot
{
class Program
{
static void Main(string[] args)
{
PrintTitle();
foreach (var row in Function.GetRows())
{
foreach (var z in row)
{
Plot(z);
}
Console.WriteLine();
}
}
private static void PrintTitle()
{
Console.WriteLine(" 3D Plot");
Console.WriteLine(" Creative Computing Morristown, New Jersey");
Console.WriteLine();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine();
}
private static void Plot(int z)
{
var x = Console.GetCursorPosition().Top;
Console.SetCursorPosition(z, x);
Console.Write("*");
}
}
}

View File

@@ -0,0 +1,3 @@
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/)

View File

@@ -0,0 +1,97 @@
import java.lang.Math;
/**
* Game of 3-D Plot
* <p>
* Based on the BASIC game of 3-D Plot here
* https://github.com/coding-horror/basic-computer-games/blob/main/87%203-D%20Plot/3dplot.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.
*/
// Java class names cannot begin with a letter, so class name 3dplot cannot be used
public class Plot3D {
public void play() {
showIntro();
startGame();
} // End of method play
private void showIntro() {
System.out.println(" ".repeat(31) + "3D PLOT");
System.out.println(" ".repeat(14) + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY");
System.out.println("\n\n\n");
} // End of method showIntro
private void startGame() {
float row = 0;
int column = 0;
int limit = 0;
int plotVal = 0;
int root = 0;
String lineContent = "";
// Begin loop through all rows
for (row = -30; row <= 30; row += 1.5) {
limit = 0;
root = 5 * (int) Math.floor((Math.sqrt(900 - row * row) / 5));
// Begin loop through all columns
for (column = root; column >= -root; column += -5) {
plotVal = 25 + (int) Math.floor(func(Math.sqrt(row * row + column * column)) - 0.7 * column);
if (plotVal > limit) {
limit = plotVal;
// Add whitespace
while (lineContent.length() < (plotVal-1)) {
lineContent += " ";
}
lineContent += "*";
}
} // End loop through all columns
System.out.println(lineContent);
lineContent = "";
} // End loop through all rows
} // End of method startGame
// Function to be plotted
public double func(double inputVal) {
return (30 * Math.exp(-inputVal * inputVal / 100));
}
public static void main(String[] args) {
Plot3D plot = new Plot3D();
plot.play();
} // End of method main
} // End of class Plot3D

View File

@@ -0,0 +1,3 @@
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
Conversion to [Oracle Java](https://openjdk.java.net/)

View File

@@ -0,0 +1,9 @@
<html>
<head>
<title>3D PLOT</title>
</head>
<body>
<pre id="output" style="font-size: 8pt;"></pre>
<script src="3dplot.js"></script>
</body>
</html>

View File

@@ -0,0 +1,40 @@
// 3D PLOT
//
// Converted from BASIC to Javascript by Oscar Toledo G. (nanochess)
//
function print(str)
{
document.getElementById("output").appendChild(document.createTextNode(str));
}
function tab(space)
{
var str = "";
while (space-- > 0)
str += " ";
return str;
}
function equation(input)
{
return 30 * Math.exp(-input * input / 100);
}
print(tab(32) + "3D PLOT\n");
print(tab(15) + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n");
for (x = -30; x <= 30; x += 1.5) {
l = 0;
y1 = 5 * Math.floor(Math.sqrt(900 - x * x) / 5);
str = "";
for (y = y1; y >= -y1; y -= 5) {
z = Math.floor(25 + equation(Math.sqrt(x * x + y * y)) - .7 * y);
if (z > l) {
l = z;
while (str.length < z)
str += " ";
str += "*";
}
}
print(str + "\n");
}

View File

@@ -0,0 +1,3 @@
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)

View File

@@ -0,0 +1,3 @@
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
Conversion to [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language))

27
87_3-D_Plot/perl/3dplot.pl Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/perl
use strict;
use warnings;
print ' 'x32 ."3D PLOT\n";
print ' 'x15 ."CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n";
print "\n\n\n";
sub FNA {
my ($Z)= @_;
return 30*exp(-$Z*$Z/100);
}
print "\n";
for (my $X=-30; $X<=30; $X+=1.5) {
my $L=0;
my $Line=" "x80; #Empty buffer string;
my $Y1=5*int(sqrt(900-$X*$X)/5);
for (my $Y=$Y1; $Y>=-$Y1; $Y-=5) {
my $Z=int(25+&FNA(sqrt($X*$X+$Y*$Y))-.7*$Y);
if ($Z<=$L) { next; }
$L= $Z;
substr $Line, $Z, 1, "*"; #Plot on the line by sustitution.
}
print "$Line\n"; #Now print the line.
}

View File

@@ -0,0 +1,3 @@
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
Conversion to [Perl](https://www.perl.org/)

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env python3
# 3D PLOT
#
# Converted from BASIC to Python by Trevor Hobson
import math
def equation(input):
return 30 * math.exp(-input * input / 100)
print(" " * 32 + "3D PLOT")
print(" " * 15 + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n\n\n\n")
for x in range (-300, 315, 15):
x1 = x / 10
l = 0
y1 = 5 * math.floor(math.sqrt(900 - x1 * x1) / 5)
yPlot = [" "] * 80
for y in range (y1, -(y1 + 5), -5):
z = math.floor(25 + equation(math.sqrt(x1 * x1 + y * y)) - .7 * y)
if z > l:
l = z
yPlot[z] = "*"
print("".join(yPlot))

View File

@@ -0,0 +1,3 @@
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
Conversion to [Python](https://www.python.org/about/)

View File

@@ -0,0 +1,28 @@
def intro
puts " 3D PLOT
CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n\n\n\n\n"
end
def fna(z) = 30 * Math.exp(-z * z / 100)
def render
(-30..30).step(1.5).each do |x|
l = 0
y1 = 5 * (Math.sqrt(900 - x * x) / 5).to_i
y_plot = " " * 80
(y1..-y1).step(-5).each do |y|
z = (25 + fna(Math.sqrt(x * x + y * y)) - 0.7 * y).to_i
next if z <= l
l = z
y_plot[z] = '*'
end
puts y_plot
end
end
def main
intro
render
end
main

View File

@@ -0,0 +1,3 @@
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
Conversion to [Ruby](https://www.ruby-lang.org/en/)

View File

@@ -0,0 +1,3 @@
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)