MAINT: Apply pre-commit

Remove byte-order-marker pre-commit check as there would be
many adjustments necessary
This commit is contained in:
Martin Thoma
2022-03-05 09:29:23 +01:00
parent f5e33ae38f
commit e64fb6795c
536 changed files with 6267 additions and 5556 deletions

View File

@@ -8,90 +8,90 @@ import java.lang.Math;
* <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 {
// 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() {
} // 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
} // End of method showIntro
private void startGame() {
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;
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 += "*";
lineContent += "*";
}
} // End loop through all columns
System.out.println(lineContent);
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));
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

@@ -6,21 +6,23 @@
import math
def equation(input):
return 30 * math.exp(-input * input / 100)
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 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))
for y in range(y1, -(y1 + 5), -5):
z = math.floor(25 + equation(math.sqrt(x1 * x1 + y * y)) - 0.7 * y)
if z > l:
l = z
yPlot[z] = "*"
print("".join(yPlot))

View File

@@ -25,4 +25,4 @@ def main
render
end
main
main