Results 61 to 90 of 356
Thread: ProgrammersitP
-
2012-10-13, 04:39 AM (ISO 8601)
- Join Date
- Jul 2007
- Gender
Re: ProgrammersitP
I made a dice rolling program, and I plan to expand it to include probabilities and more systems, although my general goals for that are much smaller then yours (I don`t plan to include calculations for opposed roles, I don`t want to make it user friendly, etc).
There is a formula which I think is correct for calculating the probability of a certain sum in a roll of a few dice, but I don`t remmember it exectly.Madly In Science, an RPG in which you play mad scientists, you can get it for free.
Spoiler: Some other things.
-
2012-10-13, 09:55 PM (ISO 8601)
- Join Date
- Dec 2008
- Location
- Malsheem, Nessus
- Gender
Re: ProgrammersitP
- Where are you and what are you doing in terms of programming? Employment, education or in your spare time?
I have a MS and BS in computer science and am working as a software engineer at a Big Data company. - What language or languages are you using primarily at the moment? What's your favourite, and why?
Languages I'm using at work: C, C++, Python, and MySQL.
Languages I'm using for fun: Perl, PHP, and Java.
I love Perl's quirky syntax and built-in hashes and regular expressions, so I'd say that's my favorite right now. - Where do you hope to go with your programming? Any plans for the future, or just waiting to see if anything of interest comes along?
No plans, really, I just like coding. - Any projects, personal or otherwise, you're in the middle of? Anything you're really focused on?
I'm working on a D&D database for my group's use, basically a comprehensive SRD of all 3e material out there like dndtools or realmshelp, but that isn't missing anything and that has more powerful searching and sorting. It's all OCRing PDFs, parsing, formatting, scanning, stuff like that. I've also recently made a tower defense game with an AI that reacts to the player's choice of tower types, paths defended, etc. - What environment do you work/prefer to work in? Netbeans/Eclipse/Command line and a text editor?
Linux terminal and vim for me, please. My work laptop is a Macbook, but the dev team works in a RHEL 6 VM.
Writing dicerollers and other gaming apps is a hobby of mine as well. I wrote a diceroller that handles conditional logic, exploding dice, rerolls, multiple rolls, and more. Some examples:
SpoilerCode:~$ diceroller.pl "7d10b5e10" --verbose 7d10b5e10 Result: 29 Rolled 8d10: 2, 4, 6, 3, 4, 10 (die 6 exploded), 5, 1 Chose best 5: 10 6 5 4 4
Code:~$ diceroller.pl "1d20+X" --repeat 4 --var "X={20/15/10/5}" 1d20+20 Result: 39 1d20+15 Result: 17 1d20+10 Result: 28 1d20+5 Result: 21
Code:~$ diceroller.pl "1d20+5" --repeat 100 --atleast 23 --index 1) 1d20+5 Result: 25 Critical Hit! 4) 1d20+5 Result: 24 5) 1d20+5 Result: 25 Critical Hit! 8) 1d20+5 Result: 25 Critical Hit! 15) 1d20+5 Result: 24 24) 1d20+5 Result: 24 28) 1d20+5 Result: 25 Critical Hit! 37) 1d20+5 Result: 24 65) 1d20+5 Result: 24 69) 1d20+5 Result: 25 Critical Hit! 70) 1d20+5 Result: 23 83) 1d20+5 Result: 23 86) 1d20+5 Result: 24 87) 1d20+5 Result: 25 Critical Hit! 90) 1d20+5 Result: 24 92) 1d20+5 Result: 23 97) 1d20+5 Result: 23
I also wrote a dice statistics program for arbitrary dice expressions:
SpoilerCode:~$ statistics.pl Enter a dice expression: 4d6b3 Result Times Probability 3 1 0.0008 4 4 0.0031 5 10 0.0077 6 21 0.0162 7 38 0.0293 8 62 0.0478 9 91 0.0702 10 122 0.0941 11 148 0.1142 12 167 0.1289 13 172 0.1327 14 160 0.1235 15 131 0.1011 16 94 0.0725 17 54 0.0417 18 21 0.0162 Mean: 12.2445987654321 Standard Deviation: 2.8468
...as well as a simulator for Star Wars Saga vehicle combat to handle massed attacks, condition track steps, shield reduction, and such. It made combats in my Rogue Squadron campaign ("72 TIE Interceptors and 2 Dreadnoughts? There's 12 of us, we can take 'em!") a lot easier to handle.
-
2012-10-14, 12:35 PM (ISO 8601)
- Join Date
- May 2005
- Location
- control+apple+alt+8
Re: ProgrammersitP
For people into Python: I thought this was pretty neat.
TopSecret's First Ever Two Page Tabletop ContestIf you have any questions, want to talk about the contest entries, or you just want to hang out with cool people, visit our forums.
-
2012-10-14, 05:13 PM (ISO 8601)
- Join Date
- Dec 2005
- Location
- Denmark
- Gender
Re: ProgrammersitP
I don't get it... What does it do? Other than write "good job" in big red letters, obviously.
EDIT: On second look, it compiles the code you type in? that is neat in a redundant sort of way.
Might as well add a question of my own: Is everything classes and automatic garbage collection these days? I ask because we don't use that much where I work. The programs we make has to run real time, so I guess we have a wierd programming style.
I'm sitting here with a little hobby project and the garbage collected classes from microsoft and my own code does NOT want to play nice together. It does not really want to mix managed classes and my code. Should I just give in and make everything managed? Proformance is not too important in this little application.Last edited by Miklus; 2012-10-14 at 05:28 PM.
Bad to the Bone!
Miko Miyazaki : Strip #120 - #464 : R.I.P.
-
2012-10-16, 05:44 AM (ISO 8601)
- Join Date
- Dec 2010
- Location
- Ireland
- Gender
Re: ProgrammersitP
Ah, very nice; I've got a little dice program myself from ages ago that I've really been meaning to expand on. It asks you how many sides the dice you want to roll has, how many times you want to roll it, and returns the results of each roll, and the total value of all rolls combined:
Spoiler
Code:Enter the amount of sides the dice has: 6 Enter number of times to roll the dice: 100 The total result is 381 1: 11 2: 17 3: 18 4: 15 5: 12 6: 27
Some things I want to add to it is having conditonal rolls(such as critical hits, nat 20s, nat 1s,), and automatically adding in modifiers, and possibly tying it to a database of weapons that would have damage, crit ranges, etc.
Once I get the dice program to a level I'm happy with, I'll try and use it for some other projects; I've been meaning to get a D&D character generator up and running, and I'm planning on doing it in netbeans forms, or possible some other form of GUI.
It could be worse; try having an Arraylist(in java) of objects, and a method to take objects from it and give it to another Arraylist; I had:
Spoiler
Code:static ArrayList<Card> dealToHand(ArrayList<Card> deck, ArrayList<Card> hand, int cards) { for(int i = 0; i < cards; i++) { Card test = deck.get(0); test.setHasBeenDealt(true); hand.add(deck.get(i)); deck.remove(i); } return hand; }
And I was driving myself mad trying to find out why it taking the first card, then the third, then the fifth, when I wanted it take just the first each time; turns out I just needed to have the is as 0s, and it took longer than I'd like to admit for this piece of logic to click.
Yeah, you would have to have an overridden toString(), and personally I find it just the same to have a printDetails() method, especially as I can have printCard(), printHand(), and printDeck() for different formats of printing.
Ah, but I've designed it in a way that an incorrect value can't be put in for Suit or Number, so I don't have to worry about using an enum. Also, haven't covered enums yet, and I'm starting to get worried about the amount of stuff on my plate at the moment.
Also, something of note: I found a free online Introduction to Computer Science course from Harvard, if anyone is interested in signing up for it; it started yesterday, and goes on until the 15th of April.Last edited by Miscast_Mage; 2012-10-16 at 05:45 AM. Reason: Spelling error. :3
-
2012-10-16, 06:36 PM (ISO 8601)
- Join Date
- May 2005
- Location
- control+apple+alt+8
Re: ProgrammersitP
I only looked at the code in the second spoiler, but it looks like a good time to try out a for:each statement. I'm not sure if it's possible with the way your program is written, but if you can do it, it is usually a nice way to perform a set amount of operations to a list of objects.
TopSecret's First Ever Two Page Tabletop ContestIf you have any questions, want to talk about the contest entries, or you just want to hang out with cool people, visit our forums.
-
2012-10-16, 08:46 PM (ISO 8601)
- Join Date
- Nov 2006
Re: ProgrammersitP
Ugh. x86 Assembler.
Avatar by araveugnitsuga | Play by Post (Guide) | Steam
Homebrewers' Extended Signatures
Hey Look, a Summer Reading List!
-
2012-10-17, 02:43 AM (ISO 8601)
- Join Date
- Dec 2010
- Location
- Ireland
- Gender
Re: ProgrammersitP
Hmm, the thing is, I don't think a for-each loop would work out here(I have used for-each loops a bit, at this point); the method takes in the number of cards to take from the deck and to give to the hand. I can't see how you would do this in a non-messy way using a for-each loop. A for-each loop would go through every card in the deck, whereas I only want a specific number of cards from it(e.g. deal five cards to a hand).
-
2012-10-17, 01:40 PM (ISO 8601)
- Join Date
- Dec 2005
- Location
- Denmark
- Gender
Re: ProgrammersitP
So our head programmer at work...just dropped dead last weekend! I'm not making this crap up. The funeral is next tuesday.
I wonder what part of his 1 million unfinished but highly business critial projects will land on my head? Well, now the power of careful documentation will come to it's fullest! Oh wait! We don't do paper! Our mantra is "The documentation is in the code", because documentation is for amaturs!
I'm not asking for detailed documentation for every little bit of code, but it would be nice if I knew, like, what the program was *supposed* to do.
*Sigh* I will miss his completely unmotivated outbursts of "WHAT?!" whenever his code did something unexpected, his constant clicking of ball point pens and violent sneeze attacks, all heard from two cubicles over.Last edited by Miklus; 2012-10-17 at 01:43 PM.
Bad to the Bone!
Miko Miyazaki : Strip #120 - #464 : R.I.P.
-
2012-10-17, 02:38 PM (ISO 8601)
- Join Date
- Dec 2006
- Location
- Raleigh NC
- Gender
Re: ProgrammersitP
My sympathies :(. It's sad to lose a co-worker.
At any rate, this is why our project has several dozen, possibly several hundred, articles by me in the project wiki discussing every aspect of what I've done and why I did it.
Respectfully,
Brian P."Every lie we tell incurs a debt to the truth. Sooner or later, that debt is paid."
-Valery Legasov in Chernobyl
-
2012-10-17, 04:19 PM (ISO 8601)
- Join Date
- Dec 2005
- Location
- Denmark
- Gender
Re: ProgrammersitP
Last edited by Miklus; 2012-10-17 at 04:20 PM.
Bad to the Bone!
Miko Miyazaki : Strip #120 - #464 : R.I.P.
-
2012-10-17, 04:37 PM (ISO 8601)
- Join Date
- Nov 2006
Re: ProgrammersitP
Avatar by araveugnitsuga | Play by Post (Guide) | Steam
Homebrewers' Extended Signatures
Hey Look, a Summer Reading List!
-
2012-10-18, 08:34 AM (ISO 8601)
- Join Date
- Dec 2006
- Location
- Raleigh NC
- Gender
Re: ProgrammersitP
Allow me to direct you to Assembla . They provide a repository, trouble ticket management system, a wiki, and a bunch of other stuff. There's a free version for students which provides something like :mumble mumble: storage space in 1 workspace. I've had occasion to use the paid versions, but for which companies and which projects I cannot say.
Respectfully,
Brian P."Every lie we tell incurs a debt to the truth. Sooner or later, that debt is paid."
-Valery Legasov in Chernobyl
-
2012-10-19, 01:09 AM (ISO 8601)
- Join Date
- Jul 2007
- Gender
Re: ProgrammersitP
Madly In Science, an RPG in which you play mad scientists, you can get it for free.
Spoiler: Some other things.
-
2012-10-19, 01:35 AM (ISO 8601)
- Join Date
- Feb 2007
- Location
- Manchester, UK
- Gender
Re: ProgrammersitP
Assembly is raw machine code instructions...it doesn't really have *any* language constructs you might be familiar with. As an example, this is a small piece of in-line assembly code I put into a C function to speed it up many years ago:
Code:mov ecx, 0 mov ebx, width mov esi, tempsrc mov edi, tempdest asm_loop: cmp ecx, ebx jnc end_asm test ecx, 31 jnz no_load mov eax, DWORD PTR [esi] add esi, 4 bswap eax no_load: shl eax, 1 jnc no_inc inc BYTE PTR [edi] no_inc: inc ecx test ecx, tbit jnz asm_loop inc edi jmp asm_loop end_asm:
Last edited by factotum; 2012-10-19 at 01:38 AM.
-
2012-10-19, 04:23 AM (ISO 8601)
- Join Date
- May 2005
- Location
- control+apple+alt+8
Re: ProgrammersitP
If all you know is Java, I would not waste my time trying to learn assembly: it will be next to impossible. To jump from one of the highest level languages in existence to assembly (the lowest level practical language) would take inordinate amounts of time, practice, and dedication.
It would legitimately be quicker to learn another language at a lower level and then try to learn assembly, than it would be to just jump to it from Java. At the very least you should know a language that is no higher level than C++ before you start assembly ( C would be even better). Then it may be easier to mess around with something like an Arduino, which can be programmed basically in C or in assembler, allowing you progress down into the assembly code as you are comfortable with (and you can actually see it do stuff which makes code verification easy).
If you want to go straight from Java to assmbly code, go for it; I'm just saying that there are much better ways to go about it that will take a lot less time and be a whole lot less frustrating.TopSecret's First Ever Two Page Tabletop ContestIf you have any questions, want to talk about the contest entries, or you just want to hang out with cool people, visit our forums.
-
2012-10-19, 04:32 AM (ISO 8601)
- Join Date
- Mar 2009
- Location
- Sweden
- Gender
Re: ProgrammersitP
It might also be prudent to start with another assembly language than x86. We had assembly programming as a part of a computer architecture course last spring, where we were taught MIPS assembly, which wasn't all too hard to grasp, at least not in my opinion.
I should also point out that the only languages I knew prior to that course were Java and SML (which is a functional language, and thus even further removed from assembly, which is imperative), and the same applied to most of my coursemates, so it's not impossible to learn assembly just because you know nothing like it. Actually, since we just had left SML, I found MIPS assembly to be sort of a relief, seeing how it let me put skills in imperative programming I'd learned in Java to use again.Clouddreamer Teddy by me, high above the world, far beyond its matters...
Spoiler: Banner by Vrythas
-
2012-10-19, 04:34 AM (ISO 8601)
- Join Date
- Dec 2010
- Location
- Ireland
- Gender
Re: ProgrammersitP
@Miklus:
Oh dear, I'm sorry to hear of your loss. My sympathies to his friends, family, and coworkers.
Ah, I've actually been looking into setting up a wiki or database that would contain classes and methods I've that I thought were particularly useful; this looks like it could be just what I need. It seems a lot more complex than what I need, but still, learning something new never hurts.
Just to get a bit of a head start though, if all I want is essentially a database of small programs, and brief descriptions of what they do, all I would need for the moment is the git repository, right? And I would essentially be able to set it up like a wiki for myself and others(assuming I set it to public) to access? Or would I just be better off setting up something on wikispaces?
-
2012-10-19, 11:53 AM (ISO 8601)
- Join Date
- Jul 2007
- Gender
Re: ProgrammersitP
Seems scary. What was it supposed to do? What the bigger program is supposed to do?
From what I know of C++ syntax, it`s very similiar to that of Java. I don`t see how that could help significantly in learning assembly (anyways I`ll pick something easier then assembly after Java).
When I`ll work on learning Assembly, I will work on learning the Assembly leanguage of the computer I`ll have at the time.
I didn`t look at the website pendell posted, but Java has a built in documentation system - Javadoc.
Also, if your packages are organized well, it saves you a lot of bother. You could create a package named utility and put everything usefull there.Madly In Science, an RPG in which you play mad scientists, you can get it for free.
Spoiler: Some other things.
-
2012-10-19, 01:31 PM (ISO 8601)
- Join Date
- Nov 2006
Re: ProgrammersitP
Sure, the syntax is pretty similar. It's a type-cased brackets-based language. Java does a lot of hand holding for you though. C/C++ really requires you to have a good working knowledge of memory layout, pointer usage, and so on. There are also a lot of different data structures in the standard library, and knowing which one to use when can be tricky.
When I`ll work on learning Assembly, I will work on learning the Assembly leanguage of the computer I`ll have at the time.
1
Miscast, at work, a lot of people had their own established (personal) codebases saved locally. For instance, my mentor didn't like the STL Vector class (think ArrayList in Java), so he wrote his own. It's not uncommon to keep small utility programs around. I do it for Python and C/C++, mostly for image processing. Centroiding and filtering are pretty common operations.
If you find yourself using a lot of the same initialization code, consider just putting together a template program. I have one for OpenCL runtimes, as 90% of the time it's the same cl::getPlatform(), cl::getDevices(&Platform) or something along those lines.
What you don't want to do is make a wiki and just post raw code snippets. Avoid writing a chunk of code and copy/pasting it every time you use it. Consider encapsulating it into an (inline) function if you use it frequently, then import the file.Last edited by Neftren; 2012-10-19 at 01:34 PM.
Avatar by araveugnitsuga | Play by Post (Guide) | Steam
Homebrewers' Extended Signatures
Hey Look, a Summer Reading List!
-
2012-10-20, 05:19 AM (ISO 8601)
- Join Date
- Feb 2007
- Location
- Manchester, UK
- Gender
Re: ProgrammersitP
The code snippet there scans a line of input pixels and converts it to an array several times smaller with a count of pixels...so, if you wanted it to be 4 times smaller, you'd get back an array with values from 0-4 in it saying how many "set" pixels were in each 4-pixel block. It was part of a font rendering engine that created anti-aliased text by rendering it several times larger than it needed to be and then scaling it down. Those were the days before proper anti-aliased font handling was built into Windows, of course!
-
2012-10-20, 06:14 AM (ISO 8601)
- Join Date
- Dec 2011
- Gender
Re: ProgrammersitP
-
2012-10-21, 09:51 AM (ISO 8601)
- Join Date
- Dec 2006
- Location
- Raleigh NC
- Gender
-
2012-10-22, 09:11 AM (ISO 8601)
- Join Date
- Mar 2010
- Location
- Gridania, Eorzea
- Gender
Re: ProgrammersitP
•Where are you and what are you doing in terms of programming? Employment, education or in your spare time?
I'm currently a Hospital Secretary (with a degree in geology no less) so no real programming work there. Taken a couple of classes in C++ and I've been teaching myself Python the past couple of years. Just started the cs50x class posted here so here's hoping something new sticks.
•What language or languages are you using primarily at the moment? What's your favourite, and why?
I'm currently using python as my main language (and favorite so far), although with the class I'm taking I'll be getting to use C, PHP, and Java. I also have experience with C++ but haven't used it in long enough that I'm on the farther side of rusty with it.
•Where do you hope to go with your programming? Any plans for the future, or just waiting to see if anything of interest comes along?
I'd like to one day be a freelance programmer and/or indie game programmer, both of which are sometime in the nebulous future.
•Any projects, personal or otherwise, you're in the middle of? Anything you're really focused on?
I've got a rougelike that I dable with from time to time, need to get back to working on that at some point. Other than that just working on learning as much about programming as I can.
•What environment do you work/prefer to work in? Netbeans/Eclipse/Command line and a text editor?
I generally just use IDLE for a programming enviornment. As for a text editor, I greatly enjoy the look and feel of Notepad++.
•Any problems that are driving you mad? A piece of code not compiling right, or being off by one, or one little syntax error in a sea of code? Not quite grasping the logic of a particular piece of code?
Biggest problem I have right now is making sure I don't have any typos or syntatic errors. I have a tendency to type obnoxiously fast, which causes case errors, and spelling errors more frequently than I would care for.
-
2012-10-22, 06:55 PM (ISO 8601)
- Join Date
- Dec 2005
- Location
- Denmark
- Gender
Re: ProgrammersitP
Thanks. Speaking of assembler, I just remembered that he was the only one who knew how to program in that. There are functions programmed by him in assembler for speed. Let's hope they never need to be debugged or we are so screwed.
Now for my little hobby project: Managed code and my code fit like foot in glove. Seriously, help! I want to use the build-in components like treeview and such. They are all managed and will only work with other managed object. It is borderline harrasment. For example, the treeview has a "tag" property per node which is just a pointer. But it can only point to managed objects. you can't even cast it to the type you want.
It's the same for this list class I'm making. The head class (the form) is managed, so the list must be managed. The elements in the list must thus also be managed. And all the part of the element must also be managed, right down to a 2D vector. Really?
Is this really how it is supposed to be? Everything is on the garbage collected heap now and nothing on the stack?
I guess if you want to use a Microsoft product, you have to program the Microsoft way.Bad to the Bone!
Miko Miyazaki : Strip #120 - #464 : R.I.P.
-
2012-10-22, 07:07 PM (ISO 8601)
- Join Date
- Nov 2006
Re: ProgrammersitP
What exactly is this for? I'm guessing .NET Framework?
Also, why are you using a vector in a list? That seems to defeat the purpose of putting together a list...
There's quite a lot that goes onto the heap now, and rightly so. For large data sets, you probably won't be able to fit it into the stack frame...Avatar by araveugnitsuga | Play by Post (Guide) | Steam
Homebrewers' Extended Signatures
Hey Look, a Summer Reading List!
-
2012-10-23, 08:30 AM (ISO 8601)
- Join Date
- Dec 2010
- Location
- Ireland
- Gender
Re: ProgrammersitP
Hmm, I suppose a template program would be handiest for what I want to do. At the moment I just copy and paste previous classes/methods from previous work that I think would be handy for whatever I'm working on at the moment. I'll have to see about looking into that, thanks.
Ah, I think I've spotted an issue with what I want to do, actually; I've been meaning to do two things, and I've been muddling them together:
- Having a database of my own useful methods/classes/etc for my personal use
- Having something to show other people in my course if they're having a problem
I was thinking of a wiki to have more an index of useful methods/classes, descriptions of what they do and how, what they take in/return, and what project I have them located in. The advantage to this would be it would useful for me, and for anyone if they wanted to see how snippets of my code worked.
However, now I'm just thinking of having a seperate way of managing my stuff for me, and having a wiki of useful snippets completely separate for other people to look at that would be more the tricky things that we'll have to be aware of in the exam like:
Spoiler
Code:int number = 5; if(++number == 6) { System.out.println("Hello."); } if(number-- == 5) { System.out.println("Goodbye"); }
Code:int []y[];
Or just plain useful methods like this for sorting arrays
Code:public static void swap(int [] num, int i, int j) { int tmp = num[i]; num[i] = num[j]; num[j] = tmp; } public static void sort(int [] num) { for(int i = 0; i < num.length - 1; i++) { int minIndex = i; for(int j = i + 1; j < num.length; j++) { if(num[j] < num[minIndex]) minIndex = j; } swap(num, i, minIndex); } }
Amen for organised packages; I organise mine by date(Y/M/D)-subject, e.g. 20121023Sample2DArrays or 20121014CharacterGenerator. It's annoying that there doesn't seem to be a tagging system or even a "ascending/descending according to date made/last edited" option; it makes it a pain to have a coherent yet expansive way of cataloging projects.
Lumping everything useful in one package does sound like a pretty convenient solution, even just for the moment where I don't really have anything huge yet.
Hmm, I think I'd prefer if it had some way of keeping the different sections of code inherently with documentation, as opposed to having it is as a separate file, which I can imagine getting messy or being a pain to keep updated.
-
2012-10-23, 09:02 AM (ISO 8601)
- Join Date
- Aug 2012
Re: ProgrammersitP
I'm in a C++ freshman course for my computer engineering degree, and basically for a scholarship I'm working with my professor on stuff outside the normal class things, including going into Python, cgi, and sqlite. It's pretty interesting! I'm working on one big program for the end of the semester that runs an HTML page where students can select a topic to practice coding on, where it'll pull a problem from an sqlite db and then take a form from the user. Then I guess I need to work on saving it as a .cpp file and compiling it through the command prompt (returning errors if there are any). So I may update you guys/ask for help :P
-
2012-10-23, 12:16 PM (ISO 8601)
- Join Date
- Nov 2006
Re: ProgrammersitP
What I'm saying is that you shouldn't copy/paste at all. If it's a code snippet, it's short enough to retype, or regex/text-expand it. Typing it out will help you avoid mistakes (enter the logical fallacy of code found on the internet). If it's some sort of utility method (e.g. templated matrix multiply) that you use on a frequent basis, it should be documented and then compiled into a package.
Code that you use personally and code that you show other people shouldn't be any different. If you maintain a rigorous and neat programming style, your code should be easily understandable to anyone reading it. At that point, it's just a matter of "oh, here's my file, look at it and understand!"
As for some comments on your code... I know a lot of instructors provide cheat sheets on exams. I don't know if yours does the same though. Anyways ...
You should probably avoid performing mathematical operations within conditional statements. Your first code sample will fail if the given number isn't 5. Granted you probably already knew that part.
I'm surprised you (or other people you're helping) found int []y[]; tricky. Well, maybe it's the format you wrote it in. This is more of a pet peeve of mine more than anything else (going back to the Star (Pointer) Wars. It makes much more sense to rewrite that fragment as int[] y[]; (note the spacing). That way, you keep the data type with the container. An integer[array] (of) y[array_size]. Similarly, in C/C++, int* i makes much more sense than int *i, as you would read it as an integer pointer. If in doubt, refer to your style guide (most companies or managed code bases typically have one somewhere).
Also, for the last code example, Bubble Sort (and similar O(n2) algorithms)...? Why do you consider this useful?
Amen for organised packages; I organise mine by date(Y/M/D)-subject, e.g. 20121023Sample2DArrays or 20121014CharacterGenerator. It's annoying that there doesn't seem to be a tagging system or even a "ascending/descending according to date made/last edited" option; it makes it a pain to have a coherent yet expansive way of cataloging projects.
Compiling via command line is pretty easy. You'll probably learn to use the GNU Compiler (gcc/g++). In Terminal (or shell of choice), you'll enter something along the lines of...
Welp. Forbidden post error. I had something written up here, but the forum won't let me post it (and no, I didn't use the word involving a cat (yes, that word) or a colon followed by two spaces anywhere).Avatar by araveugnitsuga | Play by Post (Guide) | Steam
Homebrewers' Extended Signatures
Hey Look, a Summer Reading List!
-
2012-10-23, 12:17 PM (ISO 8601)
- Join Date
- Jul 2007
- Gender
Re: ProgrammersitP
There is another option - static variables, or maybe even a class with details about a package (if you are going to include one in every package, I recommend naming it $).
Again, javadoc.
A class written with javadoc documentation: http://docs.oracle.com/javase/7/docs...g/Package.html
A package written with javadoc documentation: http://docs.oracle.com/javase/7/docs...e-summary.html
The entire API supplied with java, with much javadoc documentation (bookmark this one): http://docs.oracle.com/javase/7/docs/api/Last edited by akma; 2012-10-23 at 12:17 PM.
Madly In Science, an RPG in which you play mad scientists, you can get it for free.
Spoiler: Some other things.