Well, even now that I’m not working usual hours on Thursdays… they are still nightmares. Most of the days been a collection of minor disasters of one sort or another.
I’ve managed to actually get two things done today… Just two worth noting.
Working on controlled pairs w/ the G3A3 in RvS, dealing with multiple targets, and my favorite. A quick double tap followed by a follow up to the head/neck to make sure they go down for good. The over riding rule I have in ammunition usage, is I keep firing till I can confirm the targets out of the picture. The first 2 rounds might get him, but I have no problem with firing a 3rd or 4th before they hit the ground. It might be a waste of ammo but if I’m not sure they are neutralised after my normal 2-3rnd burst. I’m shooting the target again! Just the same with multiple targets, Find the most threatening target, hit it, find the next, hit it. Rinse and repeat and keep firing till all targets are down or I’m wishing the game allowed me to throw the rifle at the tango ! I think having to deal with 2 or 3 tangos at once is important. You don’t really have time to make sure you kill any one on the first solvo…. I remember in F.E.A.R. I was pissed at always getting shot at by a bunch of Replicas trying to set up an Ambush. So when I started taking fire, I had enough of that crap. Grabbed my scattergun and came blitz’ing around the corner in Slow-Mo mode. Plugged one Replica with a shell, cycled over to the next and missed. Put a nice hole in the wall :/, no time to argue so I cycled back to the first with another shell as he dropped to the ground (kia) Cycled back to the second Replica again, took him down with a shot to stagger him as I dropped out of ‘Slow-mo’ mode. Then leaped into a nice Round-House that smashed the Replica’s skull on a near ledge in a very awkward way for a Video Game. A crazy and foolish assault but the game made for an interesting chance to engage multiple targets.
Also,
def edit_file( editor=nil, file=nil )
unless editor
if Platform::OS == :win32
#We need to dig in to the registry later
system( "notepad #{file}" )
elsif Platform::OS == :unix
if ENV['EDITOR']
system( "#{ENV['EDITOR']} #{file}" )
else
system( "vi #{file}" )
end
end
else
system( "#{editor} #{file}" )
end
end
I got to finish solving a little problem. How to figure out what OS the program is running on in order to adopt, e.g. notepad or vi as an editor of last resort. The Platform module from rubyforge gives us a decent way of finding out if it’s a Windows or Unix based system. I don’t have any access to a Mac… so oh well. :S
Later when I’ve got time, I want to see about pulling the systems default editor for .txt files from the registry, since $EDITOR is not useful on Windows NT. The snippet also shows some thing I really like about Ruby, the unless statement.
# For example, Ruby
unless 5 < 4
puts '5 is more then 4'
end
/* and in C which has no unless statement */
if ( !5 < 4 ) {
printf( "5 is more then 4" )
}
while I’ve never cared much for the if ( !expr ) bit in C, I learned to read it fine. In what reminds me of Perl, you can also do a bit of < code > unless expr on one line if you want in Ruby. What I like about the idea of an unless and until statement, is unlike if (!expr) and while (!expr), after a shit load of reading. It’s a little harder to miss the difference when it’s not dependent on seeing the ‘!’. One reason why I use parentheses the way I do, is I’ve found it much easier on the eyes. When I do have enough time. I find my self reading a lot, so when I’m half asleep and I’m trying to remember what I read 2,000 lines ago. It’s pretty dang easy to foul up and have to wait on the compiler to scream. I’m not lucky enough to be able to have both time to read code and to sleep… lol. I remember I once spent like a half hour trying to fix a program that wouldn’t build. The whole dang problem? Was just a comma instead of a period, some_struct,member instead of some_struct.member and after 3 or 4 hours of non stop working… I couldn’t tell the difference between the , and . with my font and tied eyes.
So needless to say, I like to keep in mind that I may not be functioning in a stable frame of mind when I do things. The less I can leave for my self to fuck up, the less I have to smack my self upside the head for not seeing in the first place.
While I’ve never claimed to be decent at it, C is my strongest language. There’s just some thing about C that gets me, like the ultimate balance to my tastes. With Ruby, I’ve found that the pace it allows me to maintain is to good to pass up. Just being able to open a new tab with irb in it; for testing short bits of code. Is so much faster then opening a new tab, writing a scratch file, compiling it, and screwing with it till it works. Before finally adopting it to make use of it in what ever I’m working on. I think theres actually an interceptor for C but I’ve never tried any thing but a compiler.
I’m used to C style syntax, I started learning with C++, not really a good choice but it worked. Java and Perl are pretty similar in the basics. When I found C, I fell in love :/ so I’m pretty used to the idea of having to deal with things when I have to. I know crap about PHP but it’s close enough to the languages I do know that I can get along ok. In Ruby the syntax is very different but it’s kind of nice. You even have the choice of { … } or do … end, I usually use do and end because I feel they fit in well with the syntactic style (imho).
When ever I write some thing, if it’s not short or a quickie I’ll never need again. I try to keep a few things in mind.
- That I know what the hell I did, when I haven’t worked on it closely in weeks or months
- That it’s fairly easy to understand whats happening
- That after you read it, you’ll probably get the jist of how it works. And hopefully what it does by reading the comments
I really hate when I start reading a function and it’s so deep. by the time I get to the functions ending ‘}’ I can’t even remember what the hell it was named — I’ve never written a routine that fat!! lol. When I can, I like things to fit on a screen/screen and a half’ish for what I need to see. If I can’t keep the routine down to a manageable size. I’ll usually write other functions in the module just to help it do it’s job. I’d rather follow the line of execution to another function to make a change, then have like another 40 lines to scroll past in search of it. Most of the personal conventions I have, are ether to make my self clear yet efficient without making it easy for me to screw up. I believe source code is meant to be read by humans and run by machines, in that order. If I think it makes it easier on the reader without much cost, I’ll do it. Thats probably why when I work on some thing, I do it in stages. I make a prototype and some test pieces, I learn from that. Then I adopt and apply it to the main section. Once it’s done and doing what I want it to do. I try to go back over it and see if I can improve its quality.