Basics of Lobster
Description of the page content
Conversion of old BASIC programs to Lobster in order to learn the basics of this language.
3D Plot
Original version in BASIC:
Creative Computing (Morristown, New Jersey, USA), ca. 1980.
This version in Lobster:
Copyright (c) 2023, Marcos Cruz (programandala.net)
SPDX-License-Identifier: Fair
Written on 2023-09-16.
Last modified 20250318T1528+0100.
*/
def clear():
print("\x1B[0;0H\x1B[2J")
def showCredits():
print("3D Plot\n")
print("Original version in BASIC:")
print(" Creative computing (Morristown, New Jersey, USA), ca. 1980.\n")
print("This version in Lobster:")
print(" Copyright (c) 2023, Marcos Cruz (programandala.net)")
print(" SPDX-License-Identifier: Fair\n")
get_line("Press Enter to start the program.")
def exp(n: float) -> float:
let E = 2.71828
return pow(E, n)
def a(z: float) -> float:
return 30.0 * exp(-z * z / 100.0)
def draw():
let WIDTH = 56
let SPACE = " "
let DOT = "*"
var l = 0
var y1 = 0
var z = 0
var x = -30.0
while x <= 30.0:
let line = []
var pos = 0
while pos < WIDTH:
push(line, SPACE)
pos += 1
l = 0
y1 = 5 * int(sqrt(900.0 - x * x) / 5.0)
var y = y1
while y >= -y1:
z = int(25.0 + a(sqrt(x * x + float(y * y))) - 0.7 * float(y))
if z > l:
l = z
line[z] = DOT
y -= 5
print(concat_string(line, ""))
x += 1.5
clear()
showCredits()
clear()
draw()
Diamond
Original version in BASIC:
Example included in Vintage BASIC 1.0.3.
http:
This version in Lobster:
Copyright (c) 2023, Marcos Cruz (programandala.net)
SPDX-License-Identifier: Fair
Written on 2023-09-16.
Last modified 20250318T1528+0100.
*/
let LINES = 17
var i = 1
while i <= int(LINES / 2 + 1):
let indent = repeat_string(" ", int((LINES + 1) / 2) - i + 1)
let stars = repeat_string("*", i * 2 - 1)
print(concat_string([ indent, stars ], ""))
i += 1
i = 1
while i <= int(LINES / 2):
let indent = repeat_string(" ", i + 1)
let stars = repeat_string("*", (int((LINES + 1) / 2) - i) * 2 - 1)
print(concat_string([ indent, stars ], ""))
i += 1
Related pages
- Basics off
- Metaproject about the "Basics of…" projects.
- Basics of 8th
- Conversion of old BASIC programs to 8th in order to learn the basics of this language.
- Basics of Ada
- Conversion of old BASIC programs to Ada in order to learn the basics of this language.
- Basics of Arturo
- Conversion of old BASIC programs to Arturo in order to learn the basics of this language.
- Basics of C#
- Conversion of old BASIC programs to C# in order to learn the basics of this language.
- Basics of C3
- Conversion of old BASIC programs to C3 in order to learn the basics of this language.
- Basics of Chapel
- Conversion of old BASIC programs to Chapel in order to learn the basics of this language.
- Basics of Clojure
- Conversion of old BASIC programs to Clojure in order to learn the basics of this language.
- Basics of Crystal
- Conversion of old BASIC programs to Crystal in order to learn the basics of this language.
- Basics of D
- Conversion of old BASIC programs to D in order to learn the basics of this language.
- Basics of Elixir
- Conversion of old BASIC programs to Elixir in order to learn the basics of this language.
- Basics of F#
- Conversion of old BASIC programs to F# in order to learn the basics of this language.
- Basics of Factor
- Conversion of old BASIC programs to Factor in order to learn the basics of this language.
- Basics of FreeBASIC
- Conversion of old BASIC programs to FreeBASIC in order to learn the basics of this language.
- Basics of Gleam
- Conversion of old BASIC programs to Gleam in order to learn the basics of this language.
- Basics of Go
- Conversion of old BASIC programs to Go in order to learn the basics of this language.
- Basics of Hare
- Conversion of old BASIC programs to Hare in order to learn the basics of this language.
- Basics of Haxe
- Conversion of old BASIC programs to Haxe in order to learn the basics of this language.
- Basics of Icon
- Conversion of old BASIC programs to Icon in order to learn the basics of this language.
- Basics of Io
- Conversion of old BASIC programs to Io in order to learn the basics of this language.
- Basics of Janet
- Conversion of old BASIC programs to Janet in order to learn the basics of this language.
- Basics of Julia
- Conversion of old BASIC programs to Julia in order to learn the basics of this language.
- Basics of Kotlin
- Conversion of old BASIC programs to Kotlin in order to learn the basics of this language.
- Basics of Lua
- Conversion of old BASIC programs to Lua in order to learn the basics of this language.
- Basics of Nature
- Conversion of old BASIC programs to Nature in order to learn the basics of this language.
- Basics of Neat
- Conversion of old BASIC programs to Neat in order to learn the basics of this language.
- Basics of Neko
- Conversion of old BASIC programs to Neko in order to learn the basics of this language.
- Basics of Nelua
- Conversion of old BASIC programs to Nelua in order to learn the basics of this language.
- Basics of Nim
- Conversion of old BASIC programs to Nim in order to learn the basics of this language.
- Basics of Nit
- Conversion of old BASIC programs to Nit in order to learn the basics of this language.
- Basics of Oberon-07
- Conversion of old BASIC programs to Oberon-07 in order to learn the basics of this language.
- Basics of OCaml
- Conversion of old BASIC programs to OCaml in order to learn the basics of this language.
- Basics of Odin
- Conversion of old BASIC programs to Odin in order to learn the basics of this language.
- Basics of Pike
- Conversion of old BASIC programs to Pike in order to learn the basics of this language.
- Basics of Pony
- Conversion of old BASIC programs to Pony in order to learn the basics of this language.
- Basics of Python
- Conversion of old BASIC programs to Python in order to learn the basics of this language.
- Basics of Racket
- Conversion of old BASIC programs to Racket in order to learn the basics of this language.
- Basics of Raku
- Conversion of old BASIC programs to Raku in order to learn the basics of this language.
- Basics of Retro
- Conversion of old BASIC programs to Retro in order to learn the basics of this language.
- Basics of Rexx
- Conversion of old BASIC programs to Rexx in order to learn the basics of this language.
- Basics of Ring
- Conversion of old BASIC programs to Ring in order to learn the basics of this language.
- Basics of Rust
- Conversion of old BASIC programs to Rust in order to learn the basics of this language.
- Basics of Scala
- Conversion of old BASIC programs to Scala in order to learn the basics of this language.
- Basics of Scheme
- Conversion of old BASIC programs to Scheme in order to learn the basics of this language.
- Basics of Styx
- Conversion of old BASIC programs to Styx in order to learn the basics of this language.
- Basics of Swift
- Conversion of old BASIC programs to Swift in order to learn the basics of this language.
- Basics of V
- Conversion of old BASIC programs to V in order to learn the basics of this language.
- Basics of Vala
- Conversion of old BASIC programs to Vala in order to learn the basics of this language.
- Basics of Zig
- Conversion of old BASIC programs to Zig in order to learn the basics of this language.
External related links