Re: The End
Posted: Wed Jun 12, 2019 12:00 am
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.
Silverware wrote: ↑Wed Jun 12, 2019 5:22 pmYes, it can. You haven't seen other peoples code. Mine... is relatively tidy.
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;
Snip'd with <3Flatfingers wrote: ↑Thu Jun 13, 2019 12:00 amSilverware wrote: ↑Wed Jun 12, 2019 5:22 pmYes, 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?
Reminds me of this:
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.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...".
Pretty reasonable. Assuming it's being run on a vaguely-recent bash, I would suggest some changes:Silverware wrote: ↑Thu Jun 13, 2019 7:26 pmJust to show how my code looks when being written for a production environment.
So that you can see the difference.Spoiler: SHOW
Code: Select all
args = (); args+=("-S" "${MASTER}")
Code: Select all
${BPRESTORE} "${args[@]}" ...
First (and only post) since 2012. Good job Silverware, you catched a lurker here using only your tidy code.Shados wrote: ↑Sun Jun 16, 2019 8:03 pmPretty 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.
To be honest, it is not the first time someone posting a shell script has baited me out of lurking in a forum...HappyGhecko wrote: ↑Sun Jun 16, 2019 11:54 pmFirst (and only post) since 2012. Good job Silverware, you catched a lurker here using only your tidy code.