RE: 100 lines or less... - dbox - 10-24-2025
72 lines. Use arrow keys to move:
RE: 100 lines or less... - Dav - 10-24-2025
That's pretty cool for 72 lines, @dbox!
I may enter this challenge just to get out of the no coding slump I've been in.
- Dav
RE: 100 lines or less... - dbox - 10-25-2025
Thanks! I look forward to seeing a new @Dav creation!
RE: 100 lines or less... - bplus - 10-25-2025
(10-24-2025, 10:10 PM)madscijr Wrote: I like that there are no multi-statement lines, but let's make this a real challenge - no libraries either!
I agree, lets go rogue 
Unseen wants to show off his libs and why NOT I'm sure hes spent acres of time creating them.
dbox too, they are experienced with using their libs that pack a program with tons of power.
Hmm... maybe I will revisit my 100 line interpreter and port to QB64, its been years.
No themes, no deadlines, no promise of reward other than being a participant in a possible great event here at QB64pe.
Probably no to voting too!
RE: 100 lines or less... - dbox - 10-25-2025
(10-25-2025, 12:15 AM)bplus Wrote: (10-24-2025, 10:10 PM)madscijr Wrote: I like that there are no multi-statement lines, but let's make this a real challenge - no libraries either!
I agree, lets go rogue 
I actually agree with this sentiment. I’m always impressed by old school minimalist examples like Bubble Universe:
RE: 100 lines or less... - Unseen Machine - 10-25-2025
Thats freaking sweet!
And YES guys! Thats more like it! I look forward to seeing some more gems!
Thanks and happy coding!
Unseen
RE: 100 lines or less... - Unseen Machine - 11-01-2025
Here's my (GL) mod of the bubble universe...I am going to work on it more to try to get at least a few different colours for the spheres
Code: (Select All)
TYPE GL_Vertex_F
X AS SINGLE
Y AS SINGLE
Z AS SINGLE
END TYPE
TYPE GL_Triangle
Vertex1 AS GL_Vertex_F
Vertex2 AS GL_Vertex_F
Vertex3 AS GL_Vertex_F
END TYPE
DIM SHARED xmax AS INTEGER, ymax AS INTEGER, n AS INTEGER, r AS DOUBLE, x AS DOUBLE, y AS DOUBLE, v AS DOUBLE, t AS DOUBLE, hw, hh, sphere_list_handle AS _UNSIGNED LONG, initialized AS INTEGER ' Flag to run setup only once
xmax = 800
ymax = 600
n = 100
r = (_PI * 2) / 235
hw = (xmax / 2)
hh = (ymax / 2)
SCREEN _NEWIMAGE(xmax, ymax, 32)
_TITLE "Bubble Universe 3D Spheres Unseen Edit"
DO
LOOP UNTIL _KEYDOWN(27)
SUB _GL
STATIC first_run AS INTEGER ' Static variable retains value between calls
_GLCLEARCOLOR 0, 0, 0, 1
_GLMATRIXMODE _GL_MODELVIEW
_GLSHADEMODEL _GL_SMOOTH
_GLENABLE _GL_DEPTH_TEST
_GLMATRIXMODE _GL_PROJECTION
_GLLOADIDENTITY
_GLUPERSPECTIVE 120, 800 / 600, .01, 1000
_GLMATRIXMODE _GL_MODELVIEW
_GLLOADIDENTITY
IF first_run = 0 THEN
sphere_list_handle = GL_CreateColorSphereList(3, 10, 10, .1, .1, .7)
first_run = 1
ELSE
_GLCLEAR _GL_COLOR_BUFFER_BIT OR _GL_DEPTH_BUFFER_BIT
_GLLOADIDENTITY
_GLTRANSLATEF -400, 300, -180
FOR i = 0 TO n
FOR j = 0 TO n
u = SIN(i + v) + SIN(r * i + x)
v = COS(i + v) + COS(r * i + x)
x = u + t
_GLPUSHMATRIX
_GLTRANSLATEF hw + u * hw * .5, -(hh + v * hh * .5), 0
_GLCALLLIST sphere_list_handle
_GLPOPMATRIX
NEXT
NEXT
t = t + 0.01 ' Update the time variable
_DISPLAY
END IF
END SUB
FUNCTION GL_CreateColorSphereList~& (Rad!, Slices%, Stacks%, r!, g!, b!)
DIM AS GL_Vertex_F p1, p2, p3, p4
DIM tri AS GL_Triangle
list_handle~& = _GLGENLISTS(1)
_GLNEWLIST list_handle~&, _GL_COMPILE
_GLCOLOR3F r!, g!, b!
lon_step! = (2 * _PI) / Slices%
lat_step! = _PI / Stacks%
_GLBEGIN _GL_TRIANGLES
FOR j = 0 TO Stacks% - 1
lat_rad! = -_PI / 2 + j * lat_step!
next_lat_rad! = -_PI / 2 + (j + 1) * lat_step!
FOR i = 0 TO Slices% - 1
lon_rad! = i * lon_step!
next_lon_rad! = (i + 1) * lon_step!
p1.X = Rad! * COS(lat_rad!) * COS(lon_rad!)
p1.Y = Rad! * SIN(lat_rad!)
p1.Z = Rad! * COS(lat_rad!) * SIN(lon_rad!)
p2.X = Rad! * COS(lat_rad!) * COS(next_lon_rad!)
p2.Y = Rad! * SIN(lat_rad!)
p2.Z = Rad! * COS(lat_rad!) * SIN(next_lon_rad!)
p3.X = Rad! * COS(next_lat_rad!) * COS(next_lon_rad!)
p3.Y = Rad! * SIN(next_lat_rad!)
p3.Z = Rad! * COS(next_lat_rad!) * SIN(next_lon_rad!)
p4.X = Rad! * COS(next_lat_rad!) * COS(lon_rad!)
p4.Y = Rad! * SIN(next_lat_rad!):
p4.Z = Rad! * COS(next_lat_rad!) * SIN(lon_rad!)
tri.Vertex1 = p1
tri.Vertex2 = p2
tri.Vertex3 = p3
_GLVERTEX3F p1.X, p1.Y, p1.Z
_GLVERTEX3F p2.X, p2.Y, p2.Z
_GLVERTEX3F p3.X, p3.Y, p3.Z
tri.Vertex1 = p1
tri.Vertex2 = p3
tri.Vertex3 = p4
_GLVERTEX3F p1.X, p1.Y, p1.Z
_GLVERTEX3F p3.X, p3.Y, p3.Z
_GLVERTEX3F p4.X, p4.Y, p4.Z
NEXT i
NEXT j
_GLEND
_GLENDLIST
GL_CreateColorSphereList~& = list_handle~&
END FUNCTION
John
RE: 100 lines or less... - MasterGy - 11-01-2025
like a plasma ball. spectacular! very good!
|