mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-12 05:06:05 -08:00
add 00_Alternate_Langage folder and move alternate ports there
This commit is contained in:
28
00_Alternate_Languages/87_3-D_Plot/python/3dplot.py
Normal file
28
00_Alternate_Languages/87_3-D_Plot/python/3dplot.py
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# 3D PLOT
|
||||
#
|
||||
# Converted from BASIC to Python by Trevor Hobson
|
||||
|
||||
from math import exp, floor, sqrt
|
||||
|
||||
|
||||
def equation(x: float) -> float:
|
||||
return 30 * exp(-x * x / 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
|
||||
max_column = 0
|
||||
y1 = 5 * floor(sqrt(900 - x1 * x1) / 5)
|
||||
y_plot = [" "] * 80
|
||||
|
||||
for y in range(y1, -(y1 + 5), -5):
|
||||
column = floor(25 + equation(sqrt(x1 * x1 + y * y)) - 0.7 * y)
|
||||
if column > max_column:
|
||||
max_column = column
|
||||
y_plot[column] = "*"
|
||||
print("".join(y_plot))
|
||||
3
00_Alternate_Languages/87_3-D_Plot/python/README.md
Normal file
3
00_Alternate_Languages/87_3-D_Plot/python/README.md
Normal 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/)
|
||||
Reference in New Issue
Block a user