Page 1 of 1
[04:48:09] Marisa: anybody know of a good resource that explains how to parse a string so it can be split up via spaces and new lines? I'm finding the official documentation hard to follow
[04:51:58] Marisa: i'm at the point where i know more about how to solve my problem than the syntax to do it...
[04:59:17] Marisa: so, any general recommendations on books/websites to learn Ruby comprehensively? I've been doing learn ruby the hard way but I'm about 2/3rds through and starting to realize it's not very good about teaching "the ruby way" of coding
[05:07:03] Marisa: hmm, this is being annoying...i'm using cloud 9 as my ide and when i run ri (which does work), it can't find anything about any function
[05:10:27] Marisa: i didn't install it myself, basically, they use a virtual machine (or something like it)
[07:09:18] Marisa: have a question about variable scope...i have 3 variables that I want to use, and i am using a loop to parse their values from my input...would best practice to use a @instancevariable when I call them in the loop and then later in the program or should i just initialize them before the loop?
[07:12:32] Marisa: it's more like, since i'm initializing them inside a loop, i can't call them later (they're local to the loop), so should i make them instance variables (by using @name) or should i just initialize the variables before i assign them values
[07:32:06] Marisa: woohoo, I got it to parse my data inputs and assign variables correctly. Thanks guys for your help :)
[07:36:14] Marisa: the data is always formatted the same, on line 1 there are 3 numbers separated by spaces and on line 2 there are up to 10 numbers separated by spaces
[07:41:54] Marisa: this is for a code challenge so i'm not trying to get tooooo specific on what exactly i'm trying to do
[07:42:35] Marisa: no, this is just parsing the data, i still have to write the actual logic to give me the answer
[07:43:52] Marisa: but basically, line 1 has 3 numbers, the first is the number of enemies, second is amount of spell damage on first enemy, third is amount that the spell damage reduces for each subsequent enemy
[07:45:54] Marisa: well, i wasn't sure how to get data using ARGF line by line and then split it up without using an array
[07:46:52] Marisa: well i only want to split the first line, it will work better for line 2 to keep it in an array
[07:48:17] Marisa: i want the data from line 2 to be in an array (so I can manipulate it later) and but for line 1, i want each item to be assigned to a variable
[07:52:43] Marisa: Ox0dea: definitely nicer, i'm just too new at this to know all the syntax especially the pretty stuff ;)
[07:53:36] Marisa: thanks for all your help though...might need to refactor it tomorrow though, it's getting late here
[07:55:12] Marisa: i'm not sure i can get through all 3 programs though, this was supposed to be the easy one and it's taken me like 3 hours to just parse the data (to be fair, i've never done anything like that in my previous studies)
[07:56:46] Marisa: i'm not realistically trying to get a job out of this, i just thought it would be a good learning experience as a worst case scenario, and best case, you never know...
[07:59:29] Marisa: i've been going through the Odin Project, but I was getting bored with the HTML/CSS stuff (as I already know a fair bit about that), so I started going through learn ruby the hard way, but I feel like it's just a bad translation of learn perl the hard way and not really that useful
[08:00:23] Marisa: really just trying to make steady progress on stuff, but i've done too many super simple programs and not enough "sink or swim" type challenges, which is where i tend to learn the most
[08:01:14] Marisa: i think the best thing i've done so far was make a simple calendar generating program...learned a lot from that