Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
echinopsis
Apr 13, 2004

by Fluffdaddy
I really wish I can learn to use something like a dictionary. there are functions in that code that exist to act like a dictionary, they take a string and then I loop through every item in the array searching for a match for the string, and return some bullshit. it feels like a tragic solution to what feels like it should have a much simpler solution

Adbot
ADBOT LOVES YOU

echinopsis
Apr 13, 2004

by Fluffdaddy

my homie dhall posted:

what you really need is a finite state machine and algebraic data types mate

wtf ok imma boot up wikipedia and read some mf words

echinopsis
Apr 13, 2004

by Fluffdaddy

prisoner of waffles posted:

echi try this poo poo out, you might like it:
https://www.executeprogram.com/courses/modern-javascript

it teaches some of the nicer stuff that has become available in all browsers (and been available for quite a while at this point) and it does spaced recall testing so that you can learn a thing and have it reinforced.

it's also a nice way to give some money to the guy who made the "javascript wat" presentation, if you want the premium account

thankyou very much this looks good and is something achievable

echinopsis
Apr 13, 2004

by Fluffdaddy
noted

echinopsis
Apr 13, 2004

by Fluffdaddy

Wheany posted:

i'm just going to use this as an example, but you don't need to use "new" here, instead you can just use an object literal:

JavaScript code:
for (let gameStateDataIndex = 0; gameStateDataIndex < setOfCrime.length; gameStateDataIndex++) {
	gameState[gameStateDataIndex] = {
		state:0,
		numberTimesCommitted: 0,
		datetimeCrimeWillEnd: 0,
	}
}
or, if you want to use a function to create your objects (which is fine):

JavaScript code:
// struct for accumulated data (I expect to add more as time goes on)
function structOfGameState(state, numberTimesCommitted, datetimeCrimeWillEnd, datetimeCrimeStarted) {
	// using shorthand object notation
	return {
		state,
		numberTimesCommitted,
		datetimeCrimeWillEnd,
		datetimeCrimeStarted
	}
}

function structOfGameStateButWithOldNotation(state, numberTimesCommitted, datetimeCrimeWillEnd, datetimeCrimeStarted) {
	// using the traditional notation
	return {
		state: state,
		numberTimesCommitted: numberTimesCommitted,
		datetimeCrimeWillEnd: datetimeCrimeWillEnd,
		datetimeCrimeStarted: datetimeCrimeStarted
	}
}


for (let gameStateDataIndex = 0; gameStateDataIndex < setOfCrime.length; gameStateDataIndex++) {
    gameState[gameStateDataIndex] = structOfGameState(0, 0, 0); // no "new" operator, just a function call
}

i’ll have a look at these later and get my head around them. something satisfying I get when coding is discovering a new and significantly better approach to making something work.


here’s a question : in unreal engine blueprints there’s this thing called select

let’s say I needed to plug a float into a function, select means I plug the select into the float input and then put multiple float options into the select, and then something like a boolean or integer index or even an enumeration, and then at run time the float is chosen from the options depending on the indexing input

I use it all the time because it feels clean.

and I’ve just thought about it and think I know how you could do it in js but would feel ugly and spose pointers would also be helpful achieving this .. just thinking out loud



coz of the nodes, the select node doesn’t really messy up the code, in fact it makes it clearer than the top example using branch

I spose in-line it might make for some gnarly to pull apart code and more challenging to work out what’s going on later sitch

echinopsis
Apr 13, 2004

by Fluffdaddy
I am realising now looking at those examples that there is a performance price to pay, at least in those blueprints. but I can imagine how pointers wouldn’t introduce that issue

anyway lol what am I talking about I’ve never used a pointer in my life

echinopsis
Apr 13, 2004

by Fluffdaddy

Subjunctive posted:

you mean you want to map it? can use an array or object for that depending on what keys you want. for zero-based integers:

code:
const select = [“red”, “blue”, “green”, “butts”];

…

let colourIndex = 3;
let colour = select[colourIndex]; // “butts”

:chanpop:

amazing

echinopsis
Apr 13, 2004

by Fluffdaddy
doesn’t pl just mean programming language not plang?

echinopsis
Apr 13, 2004

by Fluffdaddy
:qqsay:

echinopsis
Apr 13, 2004

by Fluffdaddy
all good lol spose I misunderstood this thread :cry:

echinopsis
Apr 13, 2004

by Fluffdaddy

neosloth posted:

whats an array

just a long string

echinopsis
Apr 13, 2004

by Fluffdaddy

Kazinsal posted:

I would simply fake my death and move to belize

:worship:

echinopsis
Apr 13, 2004

by Fluffdaddy
nm

echinopsis fucked around with this message at 14:11 on Sep 22, 2023

echinopsis
Apr 13, 2004

by Fluffdaddy

RokosCockatrice posted:

I don't know anything about javascript or your code, I just liked that there's a 'commitcrime' function. Good function name.

I will never regret living life to the full

echinopsis
Apr 13, 2004

by Fluffdaddy

rotor posted:

just use numbers higher than 255?? doesnt seem hard imo

there's even 26 letters to use

echinopsis
Apr 13, 2004

by Fluffdaddy

eschaton posted:

such a toolkit ships with your platform of choice and the waiver should be to use something other than it

every time a web view pretending to be an app overrides the standard macOS text editing commands because the webshits who wrote the megabytes of JavaScript depleting my battery thought they knew better than the actual experts working on TextKit, I want to use my fists and their faces to generate some expressionist art

are you ok


don’t get me wrong I love the passion and the posts but you’re giving that fart in class poppin veins guy vibes. which just wanna be clear I love. read every word. never stop

echinopsis
Apr 13, 2004

by Fluffdaddy
why not have the real file name and file display name be different things


no problems

echinopsis
Apr 13, 2004

by Fluffdaddy
MSDOS had it right with 8.3 in all caps

echinopsis
Apr 13, 2004

by Fluffdaddy

VikingofRock posted:

Filesystems/OSs should just give every file a UUID and then use that. Then, allow users to set the display names to whatever they want. Users wanna have 50 different files on their desktop, all called "temp.txt" or whatever? I say, let them!

hell, every file is 24 digit alphabuermic random number w

echinopsis
Apr 13, 2004

by Fluffdaddy
Д is just A

echinopsis
Apr 13, 2004

by Fluffdaddy
this gives me a headache

echinopsis
Apr 13, 2004

by Fluffdaddy
so both my kids learn coding in school and this pharmacist at work wants to move into the field (seems like a bad move job security wise)

anyway I was just thinking because of this, kids should start with shenzen io

echinopsis
Apr 13, 2004

by Fluffdaddy
yeah so that’s why curiously wondering if it’s helpful or not to teach them how computers work first

echinopsis
Apr 13, 2004

by Fluffdaddy
isn’t that a tool you replicate cpu’s in?

echinopsis
Apr 13, 2004

by Fluffdaddy
rust is still a baby





dude at work is learning himself some python and he asked me my opinion on what he should learn next. idk why me? spose coz I sometimes talk about coding stuff with him and I have a few more clues but ya know i’m still a loving casual. anyway I told him perl js because I assume that’s a language that is handy to know seeing as it’s loving everywhere

echinopsis
Apr 13, 2004

by Fluffdaddy

redleader posted:

yeah, a good question to ask him (and then the thread) is "what do you want to do with that knowledge?"

the answer would be “get out of pharmacy where I have to deal with humans”

Internet Janitor posted:

js is definitely a handy language to know from a "getting stuff done" perspective, and it can be used in conjunction with server-side python to make webapps

likewise c is a handy language to know (at least the rudiments), and again it can easily go hand-in-hand with python

if he doesn't already know some flavor of sql, learning with posgres or sqlite makes sense

if he's interested in game modding, lua is a neat little lang

if he wants to learn a language that'll stretch his general understanding of programming, rather than be directly useful, any of scheme, ocaml, forth, prolog, erlang, rebol, or apl/j/k would surely expose him to new ideas

this is interesting to me at the very least. I am on an amateur level familiar with python, c, js.. but never even looked at those other ones. I find coding interesting from a pure interest level, not just “get poo poo done” level, so that’s a good start


I’ve been suggested to learn react which I know is ultimately js/html but it’s to get some poo poo done. i’ll get my head round it. a concept with me making crimecommitter was pure js but when i’ve been reading about react seems like I can focus a bit more on the mechanics and less on it fundamentally displaying anything. but i’m just rambling now

echinopsis
Apr 13, 2004

by Fluffdaddy
keep going keep going I am almost there

echinopsis
Apr 13, 2004

by Fluffdaddy
lol

echinopsis
Apr 13, 2004

by Fluffdaddy
I can get my load time down to about three minutes if I wait a week

echinopsis
Apr 13, 2004

by Fluffdaddy
docking huh

Adbot
ADBOT LOVES YOU

echinopsis
Apr 13, 2004

by Fluffdaddy

FlapYoJacks posted:

Slackware on floppy disks was my first distro. :corsair:

I was team slackware for a while

then team bsd

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply