![]() |
|
another variation of "10 PRINT" - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Programs (https://qb64phoenix.com/forum/forumdisplay.php?fid=7) +---- Thread: another variation of "10 PRINT" (/showthread.php?tid=3324) |
RE: another variation of "10 PRINT" - SMcNeill - 01-12-2025 (01-12-2025, 12:41 AM)bplus Wrote: I was going for a one-liner like the original that didn't need the _Font 8 to fix the print. I think what you wanted was something more like this then: Code: (Select All)
Single line of code, no use of _Font 8... Several screen modes default to font 8, and Screen 1 is one of those.
RE: another variation of "10 PRINT" - bplus - 01-12-2025 The higher the colon count the crappier the line of code, usually. For assignments, it makes sense until QB64pe allows commas in such lines. a = 1, b = 2, ... (01-12-2025, 12:48 AM)SMcNeill Wrote:(01-12-2025, 12:41 AM)bplus Wrote: I was going for a one-liner like the original that didn't need the _Font 8 to fix the print. yeah thats nice! Still crappy is saying goto 10 twice. But you pay a price for one-liners. RE: another variation of "10 PRINT" - JRace - 01-12-2025 (01-12-2025, 12:53 AM)bplus Wrote: Still crappy is saying goto 10 twice. But you pay a price for one-liners. Who needs GOTO? For that matter, who needs IF...THEN...ELSE? Quote:(In the world of C, I've always enjoyed deeply nesting ternary operators, imagining the reactions of people who will have to maintain the code later. Debugging them sux, but nesting them is fun.) Of course the name TenPrint would no longer make sense. (Forget one-liners; with functions like _IIF to abuse I'm getting ideas about an Obfuscated Basic contest!) RE: another variation of "10 PRINT" - SMcNeill - 01-12-2025 (01-12-2025, 02:03 AM)JRace Wrote:(01-12-2025, 12:53 AM)bplus Wrote: Still crappy is saying goto 10 twice. But you pay a price for one-liners. In this case, you don't even need the _Font 8. Screen 1 defaults to font 8. RE: another variation of "10 PRINT" - bplus - 01-12-2025 Nice one at @JRace, You don't even need Screen 1 ![]() Code: (Select All) _Font 8: For c = 1 To 1920: Print _IIf(Rnd < .5, "\", "/");: NextRE: another variation of "10 PRINT" - JRace - 01-12-2025 Thanks yet again, Hero Steve! Now let's eliminate the PE-specific _IIF: Quote:(Notice I'm still trying to keep it at least mildly obfuscated.) This should now run on QB and (with the addition of a line number) GWBasic. RE: another variation of "10 PRINT" - bplus - 01-12-2025 Here's another way. also skips the IF's Code: (Select All) Font 8: For c = 1 To 1920: Print Chr$(47 + -45 * (Rnd < .5));: Nextalso closer to Original 10 Print: Code: (Select All) 10 PRINT CHR$(205.5+RND(1)); : GOTO 10RE: another variation of "10 PRINT" - SMcNeill - 01-12-2025 (01-12-2025, 03:11 AM)JRace Wrote: Thanks yet again, Hero Steve! How about this version for something that works in all basics and should have people scratching their heads trying to sort it out without running it first: Code: (Select All)
Or use a different Screen mode as we don't want _Font (which is QB64 specific): Code: (Select All)
RE: another variation of "10 PRINT" - JRace - 01-12-2025 (01-12-2025, 02:52 AM)bplus Wrote: Nice one at @JRace, Technically we don't need the Screen or Font statements since it still prints the same characters, but the results just don't look the same on a vanilla screen with a vanilla font: vs: @SMcNeill & @bplus I was about to post my old GWBasic port of TenPrint, but you both beat me to it. It's pretty much the same as your last posts. RE: another variation of "10 PRINT" - Jack002 - 01-12-2025 I struggle with using fonts in QB64 Not easy! This is my file explorer in win 10 ![]() this is the properties of the font ![]() This line gives the error invalid handle mfont = _LoadFont(Environ$("HOME") + "/.local/share/fonts/CousineNerdFontMono-Bold.ttf", ps, "UNICODE") So does this line mfont = _LoadFont(Environ$("HOME") + "/windows/fonts/CousineNerdFontMono-Bold.ttf", ps, "UNICODE") /windows/fonts/ is right where the ttf file is! Is it installed? I think so, I did install it. You right click and PREVIEW and on that screen press INSTALL. I did it, it is GREY ![]() Go there with the DOS command and do DIR, not there! ![]() I don't know what I am doing wrong |