Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ASCII cube
#5
^
|
Cool program, but I think Danilin was presenting this as a challenge. Cannot use ```LOCATE```. This must work even in many 8-bit and limited BASICs.

I was going to use a 2D array of bytes and treat it like a graphics screen instead of ```LOCATE``` but with some BASICs offered on computers with 4KB RAM or less that's cheating. Anyway, I'm going by the first post of this topic.

I came up with something but requires specific values for ```a```, ```b``` and ```c```. I made a few adjustments to the routine. But sometimes the cube is weirdly drawn.

Code: (Select All)

'by Danilin QB64 Phoenix forums
'changed a bit so it accepts parameters
'the middle one is the only one that draws correctly
' according to my modifications
$CONSOLE:ONLY
danilincube 7, 5, 8
danilincube 10, 6, 12
danilincube 12, 10, 14
system

sub danilincube (a as integer, b as integer, c as integer)
dim as integer i, j, k, m, n, p
For i = 1 To c: Print "*";: Next
Print "x";: For i = 1 To a - 2: Print "=";: Next: Print "x 1"

For i = 1 To c - b - 1
For j = c - i To 1 Step -1: Print ".";: Next:

Print "/";: For k = 1 To a - 2: Print "-";: Next: Print "/";
For n = 1 To i - 1: Print "o";: Next: Print "| 2"
Next

For j = c - i To 1 Step -1: Print ".";: Next:
Print "/";: For k = 1 To a - 2: Print "-";: Next: Print "/";
For n = 1 To i - 1: Print "o";: Next: Print "x 3"

For m = i To 2 Step -1
For j = m - 1 To 1 Step -1: Print ".";: Next:
Print "/";: For k = 1 To a - 2: Print "-";: Next: Print "/";
For n = 1 To i - 1: Print "o";: Next: Print "/ 4"
Next

Print "x";: For i = 1 To a - 2: Print "=";: Next: Print "x";
For n = 1 To i - 4: Print "o";: Next: Print "/ 5"

For p = 1 To b - 1: Print "|";
For k = 1 To a - 2: Print "-";: Next: Print "|";
For n = 1 To b - p - 1: Print "o";: Next: Print "/ 6"
Next

Print "x";: For i = 1 To a - 2: Print "=";: Next: Print "x 7"
end sub
Reply


Messages In This Thread
ASCII cube - by DANILIN - 11-05-2023, 06:29 AM
RE: ASCII cube - by DANILIN - 11-05-2023, 04:05 PM
RE: ASCII cube - by bplus - 11-05-2023, 08:03 PM
RE: ASCII cube - by bplus - 11-06-2023, 07:37 PM
RE: ASCII cube - by mnrvovrfc - 11-06-2023, 11:19 PM
RE: ASCII cube - by bplus - 11-07-2023, 12:49 AM
RE: ASCII cube - by bplus - 11-07-2023, 01:06 AM



Users browsing this thread: 7 Guest(s)