Page 21 of 40

Re: The End

Posted: Wed Jun 12, 2019 12:00 am
by BFett
That would be cool. I'd be completely behind him releasing the code only to backers so that the community can make the call on developing their own branches of the base game.

Re: The End

Posted: Wed Jun 12, 2019 5:00 am
by FormalMoss
Talvieno wrote:
Tue Jun 11, 2019 9:20 am
Of course, we haven't heard from him in three months,
That sounds familiar too.. :D :ghost:

Re: The End

Posted: Wed Jun 12, 2019 5:12 am
by ResultsMayDiffer
Obviously, the chance of anyone picking it up and making something happen is highly unlikely, but every day this is not done only puts the project at greater risk. Release the source code Josh.

Re: The End

Posted: Wed Jun 12, 2019 5:20 pm
by IronDuke
it can't possible be messier than Silver's code :ghost:

Re: The End

Posted: Wed Jun 12, 2019 5:22 pm
by Silverware
IronDuke wrote:
Wed Jun 12, 2019 5:20 pm
it can't possible be messier than Silver's code :ghost:
Yes, it can. You haven't seen other peoples code. Mine... is relatively tidy.

Re: The End

Posted: Thu Jun 13, 2019 12:00 am
by Flatfingers
Silverware wrote:
Wed Jun 12, 2019 5:22 pm
IronDuke wrote:
Wed Jun 12, 2019 5:20 pm
it can't possible be messier than Silver's code :ghost:
Yes, it can. You haven't seen other peoples code. Mine... is relatively tidy.

Those of you with weak constitutions may wish to avert your eyes from the chthonic horror that is the Super Star Trek code written in PL/I as I last updated it in 1985:

Code: Select all

      ROMULN: PROC(E);
      IF RX=0 THEN RX=1;
      IF RY=0 THEN RY=1;
       H=(1000+500*RND)/SQRT((S1-RX)**2+(S2-RY)**2);
      IF C$='DOCKED' THEN DO;
        PUT EDIT('STARBASE SHIELDS PROTECT ',N$,' FROM ROMULAN')
          (COL(1),A,A,A); GOTO MOVER; END;
        IF Z$='UP' THEN DO; A9=A9-H;
      IF A9>0 THEN DO;
     PUT EDIT('SHIELDS PROTECT ',N$,' FROM ROMULAN')(COL(1),A,A,A);
      GOTO MOVER; END;
      H=-A9; Z$='DOWN';
      PUT SKIP LIST('ROMULAN ATTACK CRASHES SHIELDS'); END;
    E=E-H;PUT EDIT(H,' HIT ON ',N$,' FROM ROMULAN AT SECTOR ',RX,'-',RY)
      (COL(1),F(6,1),A,A,A,F(2),A,F(2));
      IF E<=0 THEN DO; P4=10; CALL #11950; GOTO #6930; END;
      IF E<=100 THEN DO; P4=11; CALL #11950; END;
      /* MOVE ROMULAN AT RANDOM */
    MOVER: PUT EDIT('ROMULAN AT ',RX,'-',RY,' MOVES.') (COL(1),A,F(2),A,F(
     2),A);
      Q(RX,RY)=0; RW=.3*RND+.1; RD=360*RND;
      RX1=-COS(RD/57.296); RY1=SIN(RD/57.296);
      DO I=1 TO TRUNC(RW*10.05); RX=RX+RX1; RY=RY+RY1;
      IF Q(TRUNC(RX+.5),TRUNC(RY+.5))¬=0 THEN GOTO HOLDIT;
      END;
      ROMSTP: RX=TRUNC(RX+.5) RY=(TRUNC(RY+.5); GOTO ROMOVE;
      HOLDIT: RX=RX-RX1; RY=RY=RY1; GOTO ROMSTP;
      ROMOVE: Q(RX,RY)=7; RD=45*TRUNC(RD/45+.5);
    PUT SKIP LIST('SENSORS INDICATE ROMULAN IS MOVING APPROXIMATELY');
      PUT EDIT('ON COURSE ',RD,' AT WARP ',RW)
        (COL(1),A,F(3),A,F(3,1));
      RETURN; END;

And that's a relatively sane section. There's no way Silver's code -- or Josh's -- is this bad.

...yay?

Re: The End

Posted: Thu Jun 13, 2019 5:33 am
by FormalMoss
Flatfingers wrote:
Thu Jun 13, 2019 12:00 am
Silverware wrote:
Wed Jun 12, 2019 5:22 pm
IronDuke wrote:
Wed Jun 12, 2019 5:20 pm
it can't possible be messier than Silver's code :ghost:
Yes, it can. You haven't seen other peoples code. Mine... is relatively tidy.

Those of you with weak constitutions may wish to avert your eyes from the chthonic horror that is the Super Star Trek code written in PL/I as I last updated it in 1985:



And that's a relatively sane section. There's no way Silver's code -- or Josh's -- is this bad.

...yay?
Snip'd with <3

Wow, is there moar?

Re: The End

Posted: Thu Jun 13, 2019 6:58 pm
by zircher
Comments are for the weak. :-)

Re: The End

Posted: Thu Jun 13, 2019 7:26 pm
by Silverware
Just to show how my code looks when being written for a production environment.
Spoiler:      SHOW

Code: Select all

args=""
if [ -n "${MASTER}" ]; then args="${args} -S ${MASTER}"; fi
if [ -n "${CLIENT}" ]; then args="${args} -C ${CLIENT}"; fi
if [ -n "${POLICY}" ]; then args="${args} -k ${POLICY}"; fi
if [ -n "${POLICYTYPE}" ]; then args="${args} -t ${POLICYTYPE}"; fi
if [ -n "${AFTER}" ]; then args="${args} -s ${AFTER}"; fi
if [ -n "${BEFORE}" ]; then args="${args} -e ${BEFORE}"; fi
if [ -n "${NOCLOBBER}" ]; then args="${args} -K"; fi
## Start Restore of File(s)
if [ -z "${FILELIST}" ]; then
	log "Restore Started for ${FILE}"
	${BPRESTORE} ${args} -L ${TMPFILE} -w ${FILE}
	# '-w' is used so that this sciprt will only move on ONCE the file has finished (or failed) restoring
	RET=$?
	log "Restore Finished for ${FILE}"
else
	# Rename only works as a filelist, so we include the feature here
	if [ -n "${RENAME}" ]; then args="${args} -R ${RENAME}"; fi
	log "Restore Started for Multiple Files"
	${BPRESTORE} ${args} -L ${TMPFILE} -w -f ${FILELIST}
	# '-w' is used so that this sciprt will only move on ONCE the file has finished (or failed) restoring
	RET=$?
	log "Restore Finished for Multiple Files"
fi
So that you can see the difference.

Re: The End

Posted: Fri Jun 14, 2019 9:10 am
by Employee 2-4601
Now I'm having weird visions of LT being re-written as shell script :)

Re: The End

Posted: Fri Jun 14, 2019 12:09 pm
by Flatfingers
zircher wrote:
Thu Jun 13, 2019 6:58 pm
Comments are for the weak. :-)

"If it was hard to write, it should be hard to understand, and even harder to modify." :D

FormalMoss wrote:
Thu Jun 13, 2019 5:33 am
Wow, is there moar?

There's considerably more. That snippet, plus all the other spaghetti code (some of which is even worse), is what I found in the Chemical Engineering section of the campus mainframe back in 1982. All I did -- then -- was some bug-fixing, but I didn't change any of the basic structure from the original PL/I code (which itself had been adapted, presumably, from the even more original version written in BASIC).

It was a bit of a challenge to figure out that gibberish and convert it to JavaScript a few years ago. One of these days I might fork a version to which I can add more features ("Super-Duper Star Trek"?)...

...but this is now very off-topic.

Re: The End

Posted: Sun Jun 16, 2019 3:00 pm
by Rad
Talvieno wrote:
Tue Jun 11, 2019 9:20 am
I get the feeling he's wanting the source code to be "perfectly tidy" when he releases it... which isn't really necessary.
Reminds me of this:
We've been meaning to release all this for ages, in various forms, and always ended up not doing it because "we'd just have to clean it up a bit first...".
Better not let that happen - just wrangle it through a code sanitizer and start uploading to gitlab or whatever. Look at file, add, push. Repeat until it is done. Best way of going about this IMO.

Re: The End

Posted: Sun Jun 16, 2019 8:03 pm
by Shados
Silverware wrote:
Thu Jun 13, 2019 7:26 pm
Just to show how my code looks when being written for a production environment.
Spoiler:      SHOW

Code: Select all

args=""
if [ -n "${MASTER}" ]; then args="${args} -S ${MASTER}"; fi
if [ -n "${CLIENT}" ]; then args="${args} -C ${CLIENT}"; fi
if [ -n "${POLICY}" ]; then args="${args} -k ${POLICY}"; fi
if [ -n "${POLICYTYPE}" ]; then args="${args} -t ${POLICYTYPE}"; fi
if [ -n "${AFTER}" ]; then args="${args} -s ${AFTER}"; fi
if [ -n "${BEFORE}" ]; then args="${args} -e ${BEFORE}"; fi
if [ -n "${NOCLOBBER}" ]; then args="${args} -K"; fi
## Start Restore of File(s)
if [ -z "${FILELIST}" ]; then
	log "Restore Started for ${FILE}"
	${BPRESTORE} ${args} -L ${TMPFILE} -w ${FILE}
	# '-w' is used so that this sciprt will only move on ONCE the file has finished (or failed) restoring
	RET=$?
	log "Restore Finished for ${FILE}"
else
	# Rename only works as a filelist, so we include the feature here
	if [ -n "${RENAME}" ]; then args="${args} -R ${RENAME}"; fi
	log "Restore Started for Multiple Files"
	${BPRESTORE} ${args} -L ${TMPFILE} -w -f ${FILELIST}
	# '-w' is used so that this sciprt will only move on ONCE the file has finished (or failed) restoring
	RET=$?
	log "Restore Finished for Multiple Files"
fi
So that you can see the difference.
Pretty reasonable. Assuming it's being run on a vaguely-recent bash, I would suggest some changes:
  • Construct `args` by appending to an indexed array, not a string, like:

    Code: Select all

    args = (); args+=("-S" "${MASTER}")
  • Then, when calling `BPRESTORE`, expand `args` as an array to ensure each item is passed as a separate arg, like:

    Code: Select all

    ${BPRESTORE} "${args[@]}" ... 
  • Double-quote the other arguments you pass to `BPRESTORE`; even if you know a priori that they do not contain spaces or globs, that may no longer be true after you or someone else edits the script later, so you're still better off quoting them to prevent possible unexpected behaviour in the future.
  • The combination of those three changes clarifies the intent of the code, and prevents unexpected word-splitting changing what should be a single argument token into multiple tokens.
  • Start using shellcheck. Ideally, with editor integration.

Re: The End

Posted: Sun Jun 16, 2019 11:54 pm
by HappyGhecko
Shados wrote:
Sun Jun 16, 2019 8:03 pm
Silverware wrote:
Thu Jun 13, 2019 7:26 pm
Pretty reasonable. Assuming it's being run on a vaguely-recent bash, I would suggest some changes:
  • Construct `args` by appending to an indexed array, not a string, like:

    Code: Select all

    args = (); args+=("-S" "${MASTER}")
  • Then, when calling `BPRESTORE`, expand `args` as an array to ensure each item is passed as a separate arg, like:

    Code: Select all

    ${BPRESTORE} "${args[@]}" ... 
  • Double-quote the other arguments you pass to `BPRESTORE`; even if you know a priori that they do not contain spaces or globs, that may no longer be true after you or someone else edits the script later, so you're still better off quoting them to prevent possible unexpected behaviour in the future.
  • The combination of those three changes clarifies the intent of the code, and prevents unexpected word-splitting changing what should be a single argument token into multiple tokens.
  • Start using shellcheck. Ideally, with editor integration.
First (and only post) since 2012. Good job Silverware, you catched a lurker here using only your tidy code.

Re: The End

Posted: Mon Jun 17, 2019 12:14 am
by Shados
HappyGhecko wrote:
Sun Jun 16, 2019 11:54 pm
First (and only post) since 2012. Good job Silverware, you catched a lurker here using only your tidy code.
To be honest, it is not the first time someone posting a shell script has baited me out of lurking in a forum...