12 Jul 11, 06:32AM
I found this thread the other day: http://codegolf.stackexchange.com/questi...-ascii-art. And I thought, "Hmm, what if I implement this in CubeScript? Lol." I present, the cube script:
Also, the original script was more readable with readable aliases, more efficient, and along with the indentations. But I decided to just share my icky version.
So, if you type /cube 2, you will get an output something like this:
Similarly, if you type /cube 4, you will get an output something like this:
Of course, you can change around and make it like those intermission ASCII art.
// off topic
Also, the output looks ugly in-game; how would I change the font of the console in AssaultCube? Say, I want Courier as my font...
[SELECT ALL] Code:
cube = [ n = $arg1 ; if ( != (
mod $n 2 ) ) [ += n 1 ] ; d = (
div $n 2);h = +;b = []; loop i (
* $n 2) [ h = ( concatword $h - )
b = (concatword $b [ ] ) ] ; h = (
concatword $h + ); l = $h; loop i (
+ $d 1) [ l = (concatword [ ] $l ) ]
say $l; loop i $d [ l = [] ; loop j (
+ ( * ( + $i ) ( + -1 ) ) $d ) [ l = (
concatword $l [ ]) ];l = ( concatword (
concatword $l / ) $b / ) ; loop j $i [
l = ( concatword $l [ ] ) ] ; ( say (
concatword $l |) ) ]; l = $h; s = []
loop i $d [ s = ( concatword $s [ ] )
]; say ( concatword $l $s |); loop i (
getalias d ) [ alias [l] ( concatword (
concatword | (getalias b ) ) | $s ); (
if ( = ( getalias i ) ( + $d -1 ) ) [
l = (concatword (getalias l) +) ][ (
alias l (concatword $l | ) ) ] ); (
say $l) ]; loop i ( getalias d ) [
alias l ( concatword | $b | ) ; (
loop j (- (+ (* $i -1) $d) 1 ) [
alias l (concatword $l [ ]) ] )
say (concatword $l /)];say $h]
Also, the original script was more readable with readable aliases, more efficient, and along with the indentations. But I decided to just share my icky version.
So, if you type /cube 2, you will get an output something like this:
[SELECT ALL] Code:
|FOX|Yarukinasu: +----+
|FOX|Yarukinasu: / /|
|FOX|Yarukinasu: +----+ |
|FOX|Yarukinasu: | | +
|FOX|Yarukinasu: | |/
|FOX|Yarukinasu: +----+
Similarly, if you type /cube 4, you will get an output something like this:
[SELECT ALL] Code:
|FOX|Yarukinasu: +--------+
|FOX|Yarukinasu: / /|
|FOX|Yarukinasu: / / |
|FOX|Yarukinasu: +--------+ |
|FOX|Yarukinasu: | | |
|FOX|Yarukinasu: | | +
|FOX|Yarukinasu: | | /
|FOX|Yarukinasu: | |/
|FOX|Yarukinasu: +--------+
Of course, you can change around and make it like those intermission ASCII art.
// off topic
Also, the output looks ugly in-game; how would I change the font of the console in AssaultCube? Say, I want Courier as my font...