Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 602 603 [604] 605 606 ... 779

Author Topic: Things that made you mildly upset today thread  (Read 859244 times)

methylatedspirit

  • Bay Watcher
  • it/its
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #9045 on: July 11, 2021, 08:15:45 pm »

So, I downloaded Grasshopper (A JavaScript learning/Google recruitment tool) on my phone a while back, and on a whim I decided to try and make the worst possible Hello World script I could manage.


Worst possible Hello World? The worst I can do is this (Python, but should be adaptable):

Code: [Select]
hello = ("\u0048","\u0065","\u006c","\u006c","\u006f","\u0020","\u0077","\u006f","\u0072","\u006c","\u0064","\u0021")
for i in range(0, len(hello)):
     print(hello[i],end = "")

Which I'm pretty sure is structurally similar to what the compiled assembly of a program does when you write cout << "Hello world!" in C++.
Logged

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #9046 on: July 11, 2021, 08:50:07 pm »

Code: [Select]
hello = ("\u0048","\u0065","\u006c","\u006c","\u006f","\u0020","\u0077","\u006f","\u0072","\u006c","\u0064","\u0021")

Are you even trying?
Code: [Select]
hello = []
hello.append("")
hello[0] += "\"
hello[0] += "u"
hello[0] += "0"
hello[0] += "0"
hello[0] += "4"
hello[0] += "8"
hello.append("")
hello[1] += "\"
...
hello = hello.reverse()
for in range(0, len(hello)):
     print(hello.pop(),end="")

Edit: Actually, I should've done deletions from the beginning of the array instead of reversing it and popping.
« Last Edit: July 13, 2021, 03:08:36 am by Bumber »
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

Naturegirl1999

  • Bay Watcher
  • Thank you TamerVirus for the avatar switcher
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #9047 on: July 11, 2021, 09:26:44 pm »

Why would you want to make a bad Hello World script? What constitutes a bad script if it performs its function. Assuming both scripts work, what makes one worse than the other?
Logged

JoshuaFH

  • Bay Watcher
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #9048 on: July 11, 2021, 10:15:46 pm »

Why would you want to make a bad Hello World script? What constitutes a bad script if it performs its function. Assuming both scripts work, what makes one worse than the other?

I think it's the size of the program, the speed of execution, and how much computational power is required from the computer. I'm not a programmer, but I have played Human Resource Machine, a game that's like a beginner's tutorial on programming, and that game scores you on those metrics, so I assume that's what makes a good program.
Logged

None

  • Bay Watcher
  • Forgotten, but not gone
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #9049 on: July 11, 2021, 10:42:26 pm »

It's like turning left three times to go right, I suppose. Some people just want to know how to maximize left turns in a journey.

Current upsetti- The impedance-regulating six-speaker-set-switcher I thrifted yesterday has not alleviated the missing middles in my stereo setup. It's less cabling up front, which is nice, at least, but I'll have to finagle some of that if I want to test out the non-biwired speaker pair I thrifted for six bucks to debug the system.

Slightly worried the core flaw is with the amp itself, which would suck beans because it's pretty much an antique and irreplaceable on my budget. Oh well, I'll play with it some more tomorrow when it's not the middle of the night and I won't wake up my neighbors.

Unrelated- 'six-speaker-set-switcher for missing middles' is some jammin' alliteration. Good lilt.
Logged

methylatedspirit

  • Bay Watcher
  • it/its
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #9050 on: July 11, 2021, 10:55:17 pm »

Why would you want to make a bad Hello World script? What constitutes a bad script if it performs its function. Assuming both scripts work, what makes one worse than the other?

Because it's funny and mentally stimulating! It's perversely funny to make an inefficient/unreadable script and watch it actually work. Have you ever seen the IOCCC, the International Obfuscated C Code Contest? There's a few YT videos showing some winning entries. Someone made a flight simulator in the contest, and the source code is shaped like an aircraft.

What makes code bad depends on the application, but it's often about readability. Remember, the computer doesn't really care-- it's going to optimize it to fast-enough speeds that you won't notice unless you're making something big or doing something really inefficient. Python is hard to make unreadable, but I'll try that. Consider this:

Code: [Select]
print("Hello world!")
Simple, elegant, anyone who knows what "print" does knows exactly what this does.

But let's try doing format() strings.

Code: [Select]
H = "H"
e = "e"
l = "l"
o = "o"
spacechar = " "
w = "w"
r = "r"
d = "d"
bang = "!"
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}".format(H,e,l,l,o,spacechar,w,o,r,l,d,bang))

Too readable! Let's mess with the variable names:

Code: [Select]
d = "H"
i = "e"
n = "l"
e = "o"
r = " "
u = "w"
s = "r"
Y = "d"
slam = "!"
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}".format(d,i,n,n,e,r,u,e,s,n,Y,slam))

Let's put it into an array for shits and giggles instead, and let's do an indirection. Further confuse the reader with nonsense variable names. Let's encode it as UTF-8 code points, too. Except for just the one. Just give the reader a false sense of hope.

Code: (dIngUsmcscRiNgus.py) [Select]
Y = "d"
stan = "\u0065"
ornot = "\u0072"
satan = "\u006c"
saatanaa = "\u006f"
r = "\u0020"
god = "\u0048"
maryPoppins = "\u0021"
u = "\u0077"
import sys
Code: [Select]
import dIngUsmcscRiNgus.py
import numpy
thegodequation = (god,stan,satan,satan,saatanaa,r,u,saatanaa,ornot,satan,Y,maryPoppins)

for i in range(0,int(((numpy.exp(1)**numpy.tan(1.1693705)) + numpy.pi * numpy.sin(1/4 * numpy.pi)))) :
sys.stdout.write(thegodequation[i])

I still think it's too readable, though. I'm not a skilled obfuscator.
Logged

Naturegirl1999

  • Bay Watcher
  • Thank you TamerVirus for the avatar switcher
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #9051 on: July 12, 2021, 02:43:41 am »

What’s numpy? Also that does look fun, and you taught me that format strings are a thing in Python
Logged

Kagus

  • Bay Watcher
  • Olive oil. Don't you?
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #9052 on: July 12, 2021, 03:13:47 am »

It can be funny, it can be mentally stimulating (encouraging lateral thinking), and in a way it also exercises/demonstrates a good familiarity with the language. Just as making highly optimized and streamlined code that works is indicative of good understanding and use of the tools available, so too is making intentionally inefficient/unintuitive solutions.

Anyway, lemme see if I can transcribe this utter abomination here (Grasshopper, sadly, doesn't appear to have a readily available "copy" option for code snippets written in-program)

Spoiler: pr review pls (click to show/hide)


This was copied by hand from looking at my phone, so there might potentially be some issues that I accidentally introduced. I haven't tested it yet in en environment that lets me loop more than 500 times (which means I haven't even confirmed that printing the whole string works in the phone's copy).

There are probably some opportunities for anti-optimization and obfuscation here, as I copied directly from Grasshopper and it has some built-in restrictions in usable commands and syntax.

EDIT: Whoops, apparently forgot that W was a letter

methylatedspirit

  • Bay Watcher
  • it/its
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #9053 on: July 12, 2021, 04:50:34 am »

What’s numpy? Also that does look fun, and you taught me that format strings are a thing in Python

NumPy is a numerical computing library for Python that adds support for a lot of advanced math operations and for many-dimensional arrays/matrices. It turns out a lot of computationally-intensive problems can be rephrased into matrix operations, so being able to do that does wonders for Python's use in science. It's a very parallelized library-- works best if you give it lots of numbers at once. It's also written in C, not Python, which makes it substantially faster than if it was running on the Python interpreter itself.

Format strings are great, but Python has another trick up its sleeves: f-strings! These things are great, especially if you're manipulating filenames and such. Look at these filename variables in one of my databending scripts:

Code: [Select]
step1_out = f"{in_filename}-step1-{pixel_format}"
step2_out = f"{in_filename}-step2-{audio_codec}-{bitrate}-{pixel_format}"
step3_out = f"{in_filename}-step3-{step2_format}-{audio_codec}-{bitrate}-{pixel_format}"
step4_out = f"{in_filename}-end-{audio_codec}-{bitrate}-{pixel_format}"

It's amazing. You know exactly what the structure of the filename's going to be (though part of this is my variable naming scheme), and it's all done in a very neat notation. All it is, is if you put "f" in front of the string, it becomes an f-string. Once you do, you can do any arbitrary 1-line expression inside curly brackets. I'm a simple person, I just went for variable names inside my scripts. Nothing stopping you from doing:

Code: [Select]
import math
foo = f"{round(math.sin(math.radians(30))*140)}"

I'm not sure why'd you do this, but it's right there if you want it. f-strings don't appear to replace the older format() string (don't quote me on that; I've only written scripts, not full code), but it's very nice when you can use it.
« Last Edit: July 12, 2021, 06:09:26 am by methylatedspirit »
Logged

Arx

  • Bay Watcher
  • Iron within, iron without.
    • View Profile
    • Art!
Re: Things that made you mildly upset today thread
« Reply #9054 on: July 12, 2021, 06:57:14 am »

Something is jacking up my stress levels to the point where I'm getting stress dreams and they're not letting me rest properly. Get eight hours and it still feels like I haven't slept.I hope it clears up soon.
Logged

I am on Discord as Arx#2415.
Hail to the mind of man! / Fire in the sky
I've been waiting for you / On this day we die.

Damiac

  • Bay Watcher
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #9055 on: July 12, 2021, 09:08:31 am »

Arx, have you considered seeking anti-anxiety medication? It's not something you need to take all the time but it can really help a lot when stress levels get too high. I have a few relatives whose lives were greatly improved after they got treatment.

Just knowing you've got the medication can be a huge help. I know it's hell when you can't get good sleep because your brain won't shut up.
Logged

Arx

  • Bay Watcher
  • Iron within, iron without.
    • View Profile
    • Art!
Re: Things that made you mildly upset today thread
« Reply #9056 on: July 12, 2021, 11:44:26 am »

I have both sleep and anxiety meds. Both are addictive and the withdrawal symptoms on the sleep ones are potentially rather un-fun, so I avoid them as far as possible. The great fun is that the sleeping pills don't actually help with the fact that sleeping doesn't seem to rest me! They do help on the really bad days, though, yes, which is good.
Logged

I am on Discord as Arx#2415.
Hail to the mind of man! / Fire in the sky
I've been waiting for you / On this day we die.

Damiac

  • Bay Watcher
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #9057 on: July 12, 2021, 12:25:05 pm »

I have both sleep and anxiety meds. Both are addictive and the withdrawal symptoms on the sleep ones are potentially rather un-fun, so I avoid them as far as possible. The great fun is that the sleeping pills don't actually help with the fact that sleeping doesn't seem to rest me! They do help on the really bad days, though, yes, which is good.
Yeah, I get where you're coming from. It's always a trade off. I'm glad you have the option for when you need it, sorry to hear about your sleeping problems though. I completely sympathize, nothing else in life is enjoyable when you can't get good rest.

For me personally, those sorts of things did get better as I got older, in my teens and early twenties insomnia was my life. Now it's once or twice a month.

Just to state the obvious, watch out for caffeine. It's a vicious cycle of not sleeping well, being exhausted, drinking a bunch of caffeine, and being all stressed and anxious and unable to sleep.  Sounds like you're already on top of that sort of thing, but it's worth repeating.
Logged

Jopax

  • Bay Watcher
  • Cat on a hat
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #9058 on: July 12, 2021, 06:16:38 pm »

Been catching up to the Dresden files recently, didn't even realize 2 books had come out last year. Still good stuff despite Butcher's rather basic and somewhat repetitive style (speaks volumes on how good the world and the characters are).

Anyways, Battlegrounds spoilers below:

Spoiler (click to show/hide)

So yeah, book upset me, even tho I generally enjoyed it, can't wait for the next one too :I
Logged
"my batteries are low and it's getting dark"
AS - IG

ChairmanPoo

  • Bay Watcher
  • Send in the clowns
    • View Profile
Re: Things that made you mildly upset today thread
« Reply #9059 on: July 12, 2021, 08:23:37 pm »

Spoiler (click to show/hide)
Logged
There's two kinds of performance reviews: the one you make they don't read, the one they make whilst they sharpen their daggers
Everyone sucks at everything. Until they don't. Not sucking is a product of time invested.
Pages: 1 ... 602 603 [604] 605 606 ... 779