Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - SolarShado

Pages: [1] 2 3 ... 162
1
General Discussion / Re: Bay12's posting history.
« on: December 11, 2015, 12:10:16 am »
*prods*

Did you miss:
*Clears throat*
AHHHHHHHHHHHHHHHHHHHHHH FINALS
AHHHHHHHHHHHHHHHHHHHHHH NO UPDATE UNTIL AFTER
AHHHHHHHHHHHHHHHHHHHHHH

2
To anyone posting large amounts of code:
Please consider using something like pastebin.com or gist.github.com (gist can handle multiple files!), it'll keep your posts cleaner and make the code easier to read.

That managed to work perfectly.  Unfortunately my new problem is that the computer I have to present it on is running Java 6, because my teacher apparently had trouble with a piece of software when it updated to 7.  So to get it to run in six do I only have to use the JDK for six?  And if so which would I use?  The Java archive here have everything from 6 to 6u45.  What are the differences between all of these?

Oh, that's one I've actually never directly dealt with. A quick google finds this StackOverflow post about netbeans (which I've never used). If you're using Eclipse, it's under project properties somewhere (try Java Build Path and Java Compiler; "generated .class files compatibility" in the latter looks promising); I don't have a new version handy on this machine. If you're building manually with javac, the "-target" option looks like what you need.

So, it looks like JDK 7 can build for JRE 6, and you're almost certainly not using any 7-only libraries, so that should be fine. Ideally, test first. If you really want to be sure, you can always uninstall 7 and just use 6 (or try running it on some other computer that only has 6).

As for code review, the first big thing I'd mention is names. Give your variables descriptive names! Unless you're using Notepad(*), your code editor/IDE should autocomplete them, so there's no excuse to not use full words for your variable names. This is doubly important for class and method names. And always capitalize your class names! It's such a firmly entrenched convention, it's disorienting when it is broken.

Second important thing, always declare your variables at the innermost scope possible. Is that string set at the start of each iteration of your loop and never needed outside of it? Declare it inside the loop! If you're careful you can even reuse the same name in different places (with different types!).

I'll get some more detailed stuff put together tomorrow: It's 3:30am here now. Feel free to put up your most recent code.

(*)And if you are using Notepad, stop. Now. Seriously. Go download Notepad++, it's got autocomplete and syntax highlighting and tabbed editing.

3
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: April 30, 2014, 11:07:44 pm »
I hate coming again so soon after my previous problem with the same program, but I've spent almost my entire day after getting home trying to fix this with no success.  The problem is that when I'm creating a list of dec classes, the arraylist ids and deci are not being created with anything in them.  The output I get is just the very first info "You are to report to Claudius in the throne room.  What do you do?" 
-- snip --
The only thing my main does is create a game object.

I'm looking at things now. Still working on figuring out how it's supposed to work. Why, oh why, are all of the variables in reader declared at the class level?

I could go on and on with style tips/code review stuff if you're interested.

Will hopefully post again soon with assistance.

EDIT instead of double-post:

In reader's constructor, you're re-using the same ArrayLists over and over. Think about that for a moment before you open the spoiler.

Spoiler: Why is that bad? (click to show/hide)

Spoiler: How to fix? (click to show/hide)

4
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: April 29, 2014, 10:41:31 pm »
For my English project on Hamlet I am making a game where you are presented with some story information and then make a choice.  Instead of putting everything into the code itself I decided to have it read from a text file.  My problem is that I am currently getting a NullPointerException.  Normally I would try to fix this myself, but I'm getting it in the part of the code that my Comp Sci teacher gave us specifically to allow us to do stuff without learning IO, even thou he did encourage us to try. 
--- snip ---
The place where I am getting the error is Line 52 in the IO code, where it says "try{return in.nextLine();}"

That IO code is terrible...

The problem is a cascade of your file path not being valid: "Libraries\Documents\info" is interpreted as relative path; you probably need the absolute path (which should start with "C:\").

The NPE is because of this
Code: (from the provided IO code) [Select]
  try{in = new Scanner(new FileInputStream(name));}
  catch(java.io.FileNotFoundException e){}

That silently swallows the vastly more informative FileNotFoundException and leaves in unassigned (and therefore null).

I'm guessing you haven't gotten to exception handling yet either, or that constructor should have throws FileNotFoundException on it so your code can catch the exception.

Also, style tip/nitpick: class names should start with a capital letter.

EDIT: i fail bbcode...

5
Free her.

Taunting wasn't as entertaining as I thought it would be. I feel robbed. ヽ༼ຈل͜ຈ༽ノ RIOT ヽ༼ຈل͜ຈ༽ノ

6
Hear her out!

Spoiler (click to show/hide)

7
Other Games / Re: Creeper World 3 (Now on Steam)
« on: April 07, 2014, 07:22:00 pm »
I recently bought the series, having played the flash demos of 1 and 2 multiple times over several years. Finished the campaign and barely started into alpha sector.


That looks insane... My gut says "rush the inhibitor!". Does that count as a win in Tormented space, or do you have to clear the emitters?

Also, a tip that was not at all obvious to me: always drop all available command buildings! They produce (iirc) 1.5 energy/sec. Reactors only gen 0.4, so this can be HUGE early-game. I didn't realize this until I watched a youtube vid after getting stuck at Farbor.

8
Bandwagon! Dungeons!

9
Free the Witch.

We may choose not to learn from her, but it's nice to have the option.

10
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: March 30, 2014, 04:02:58 pm »
I've recently been playing around with creating and joining threads in static initialization/deinitialization (C++). That is, pre-main and post-main. Short version: don't do it. Even if it works in one case, it will probably fail randomly somewhere down the line, and it's probably not portable.

Yeah this was my gut reaction:
Quote
don't do it.

Why would do that anyway? I'm genuinely curious as to what legitimate use it could have.

Pardon my C++ ignorance, but isn't pretty much anything "pre-main/post-main" non-portable?

11
DF General Discussion / Re: This game needs a tagline
« on: March 27, 2014, 03:45:08 am »
Dwarf Fortress: Cut the trees and dig the stones, Scream as goblins break your bones.

Bravo, +1

13
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: March 20, 2014, 05:13:24 pm »
My antipathy for symbols in code is pretty high.
*menacingly waves Perl at you*
*pulls out a/the swiss army knife of regular expressions*

14
General Discussion / Re: Bay12's Desktops
« on: March 20, 2014, 12:08:35 am »
* SolarShado crosses fingers hoping for a devArt link

http://real-fiduciose.deviantart.com/art/The-conductor-70376021

Yay!
Was hoping for more robots in the same style, but still some cool stuff.

WALLPAPERS FOR THE WALLPAPER... uh... FOLDER!

15
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: March 19, 2014, 11:58:24 pm »
But shouldn't you write source code fully and have a minimizer shorten the production code? @_@
(I should probably note that I am far from an expert on Javascript/minimization.)

Well, yes. TBH this idiom is probably more Laziness than anything else. Though jQuery may pre-date the popularization of Javascript minimizers (don't know, to lazy to attempt to confirm), in which case the shortcuts make a lot more sense, especially the $ = jQuery bit.

A NINJA ATTACKS!

In general I agree, but with jQuery it's so common to use $ instead of jQuery that a lot of people probably don't even realize you can use jQuery instead.  It's also pretty nice to type $ instead of jQuery when you have to write a lot of code with it.

This. Very this.

Having said that, I've never seen the notation of just tossing a function inside of $() and expecting it to behave like $(document).ready().  I really don't like that and do prefer the more verbose option.

It is an odd, arbitrary alias. But given that most jQuery manipulations depend on the DOM being fully loaded, it mostly makes sense is you squint and don't think about it too much.

It's quite possible to write unreadable JavaScript code when using jQuery.
FTFY

Related: Just remembered this gem of a site: wtfjs.com

EDIT: I don't know why I felt the need to address every piece of your post Telgin. It's late and I'm starting to get tired.

Pages: [1] 2 3 ... 162