Let's get programmy!

If you have some randomness to share that you can't post elsewhere, this is the place to do it.

Is Assembly the best programming language?

Yes
3
9%
Oh God my eyes
3
9%
Oh God my brain
12
38%
I perform unholy incantations to keep Assembly at bay
4
13%
Real men write binaries by hand
10
31%
 
Total votes: 32
monsi
I love sarcasm

Posts:
145
Contact:

Re: Let's get programmy!

Post by monsi »

Kogorou wrote: @redangelran
What did you do?
She made a Tetris game on Java. :x
Image
Image
User avatar
Kogorou
*drinking beer and playing guitar*

Posts:
1132
Contact:

Re: Let's get programmy!

Post by Kogorou »

monsi wrote:
Kogorou wrote: @redangelran
What did you do?
She made a Tetris game on Java. :x
That's nice :)
Let me see.
ranger
Community Villain

Posts:
3588

Re: Let's get programmy!

Post by ranger »

I did pretty mediocre in my opinion on an interview I just had w LinkedIn. 

I might audit/brush up on my data structures.
Image
Image
Akonyl
Community Hero

Posts:
4200

Re: Let's get programmy!

Post by Akonyl »

ranger wrote: I did pretty mediocre in my opinion on an interview I just had w LinkedIn. 

I might audit/brush up on my data structures.
structures you will end up using at your actual job:
vectors/whatever array wrapper your language of choice uses
sets/maps

structures they will ask you about at your interview:
all the others
ranger
Community Villain

Posts:
3588

Re: Let's get programmy!

Post by ranger »

Akonyl wrote:
ranger wrote: I did pretty mediocre in my opinion on an interview I just had w LinkedIn.  

I might audit/brush up on my data structures.
structures you will end up using at your actual job:
vectors/whatever array wrapper your language of choice uses
sets/maps

structures they will ask you about at your interview:
all the others
Yeah, had trouble with a hashset implementation for a problem..oh well, I guess I'll see if I'll make it to the 2nd round.

However I did make it to the 2nd round w Salesforce.  aw yeh.

edit: somehow I made it to second round with LinkedIn.  Dafuq? Also, offer from ViaSat.
Last edited by ranger on November 1st, 2012, 4:11 pm, edited 1 time in total.
Image
Image
User avatar
Callid
Ratio vincit omnia.

Posts:
1433

Re: Let's get programmy!

Post by Callid »

It''s running :D
Spoiler: My game
Press 1 to start a new game, or write "load" in order to load a saved game.
> load
Please enter the name of the file you want to load the game from.
> Test
"Test" successfully loaded!

+++++

It is now 10:00.
What do you want to do? You can choose between the following actions: test(0)
> 0
Who should participate in this action?
0/0 males (max:0), 0/0 females (max:0), 0/0 either (max:5)
> me 2
John was successfully added to this action!
0/0 males (max:0), 0/0 females (max:0), 1/0 either (max:5)
> Jane 2
Jane was successfully added to this action!
0/0 males (max:0), 0/0 females (max:0), 2/0 either (max:5)
> finish
You have successfully finished creating a test action!

+++++
Test, Other:
Executing successful!
+++++

It is now 11:00.
What do you want to do? You can choose between the following actions: test(0)
> save
Please enter the filename of the savegame.
> Test
Game "Test" successfully saved!
> quit
BUILD SUCCESSFUL (total time: 45 seconds)
Not shown: the number of things you can do wrong (not-existing savegame, invalid adding type, entering an invalid command...) :P
If  ;), :D, ;D, ::), :P, :-X, :o or >:D are attached, that paragraph may not be 100% serious. Seriously.
This link provides further information.
Callid Conia Pact - Petitions - Archive
ranger
Community Villain

Posts:
3588

Re: Let's get programmy!

Post by ranger »

Looks like you got a basic File I/O set for your game, and I'm guessing a good hub of your logic? But what exactly is the game?

I don't really make a whole lot of games in my sparetime outside of class..I've made Snake in C, checkers in java, and missile command in x86 (god why).

also, SalesForce get.
Image
Image
User avatar
Callid
Ratio vincit omnia.

Posts:
1433

Re: Let's get programmy!

Post by Callid »

Yeah, logic is kinda done, now I only need to write actual actions (which, as I said, will only be compiled at runtime :D) to do stuff. And an AI (see below) :x

It's kind of a interpersonal relationship simulator, but a quite crappy one ATM. Basically, you decide an action and can decide whom else you want to participate. The action then checks whether the person you "invited" actually wants to do that stuff (every action has a repulsion level (fun stuff less, tiresome stuff more, icky stuff most), and other factors (relationship, needs) influence that), and if they do, you complete the action together and the relationships are updated accordingly. However, any person you haven't included in your action will do exactly nothing :x
Which is why I want to write an AI to have them do actions on their own, basing on what they want and need. But first I need to get some actions :x

Also, most of the above example is taken from this huge method (which is entirely uncommented, yay :P) :x
Who said something about a black box? XD

Code: Select all

public static boolean createSelfAction(Person p, ActionType a) {
        if (p.todayAct[g.time.time] != null) {
            Action old = p.todayAct[g.time.time];
            old.group.getOverseer().todayAct[g.time.time] = null;
            Person[] oldParts = old.group.getTemp();
            for (int i = 0; i  1) {
                                arg = Integer.parseInt(temp[1]);
                            } else {
                                arg = 1;
                            }
                            if (a.validLength(arg)) {
                                result.length = arg;
                                IO.w(IO.g("action.create.self.completed", a.toString()));
                                return schedule().add(result);
                            } else {
                                IO.w(IO.g("action.create.self.invalidLength", arg + ""));
                                break evaluation;
                            }
                        } else {
                            IO.w(IO.g("action.create.self.uncompleted"));
                            break evaluation;
                        }
                    }

                    select = temp[0];
                    arg = Integer.parseInt(temp[1]);

                    if (eval(select) == 101) {
                        toAdd = g.player;
                    } else {
                        if (eval(select) == 103) {
                            toAdd = g.player.acquaintance.active;
                        } else {
                            toAdd = acqSearch(select);
                        }
                    }
                    if (toAdd != null) {
                        switch (arg) {
                            case 0:
                                success = result.group.addMale(toAdd);
                                break;
                            case 1:
                                success = result.group.addFemale(toAdd);
                                break;
                            case 2:
                                success = result.group.addNeuter(toAdd);
                                break;
                            default:
                                success = false;
                                break;
                        }
                        if (success) {
                            IO.w(IO.g("action.create.self.part.success", toAdd.name));
                        } else {
                            IO.w(IO.g("action.create.self.part.failure", toAdd.name));
                        }

                    }
                } catch (NumberFormatException e) {
                    IO.w(IO.g("error.input.noNumber", temp[0]));
                } catch (ArrayIndexOutOfBoundsException e) {
                    IO.w(IO.g("error.input.paramMissing"));
                }
            }
        }
    }
If  ;), :D, ;D, ::), :P, :-X, :o or >:D are attached, that paragraph may not be 100% serious. Seriously.
This link provides further information.
Callid Conia Pact - Petitions - Archive
Akonyl
Community Hero

Posts:
4200

Re: Let's get programmy!

Post by Akonyl »

long as this topic's bumped, may as well post a screenshot:
Spoiler:
Image
(programmer art go!)

there's a lack of variety, but I'm holding off on detailing generated maps because in the future I might make a transition to isometric anyway (since the game world is technically 3D), in which case I'll want to make houses that open to the right as well, rather than just the bottom. Of course, now that map generation is done, I have to start implementing scripting, which I haven't started at all yet, so my drive is pretty low atm :P
User avatar
Callid
Ratio vincit omnia.

Posts:
1433

Re: Let's get programmy!

Post by Callid »

Spoiler:
Image
Seems like I've managed to break .split() o.O

I mean, even if it somehow failed to recognize the "." in 0.52 as a ".", it should still be an array of length=1, not =0 :x
If  ;), :D, ;D, ::), :P, :-X, :o or >:D are attached, that paragraph may not be 100% serious. Seriously.
This link provides further information.
Callid Conia Pact - Petitions - Archive
Akonyl
Community Hero

Posts:
4200

Re: Let's get programmy!

Post by Akonyl »

before thinking a method is broken, you should look up the API and make sure it does what you think it does, which in this case, it doesn't.

go look up the String.split() method in the Java API, it uses regexes, that period doesn't mean what you think it does.
User avatar
Callid
Ratio vincit omnia.

Posts:
1433

Re: Let's get programmy!

Post by Callid »

Akonyl wrote: before thinking a method is broken, you should look up the API and make sure it does what you think it does, which in this case, it doesn't.

go look up the String.split() method in the Java API, it uses regexes, that period doesn't mean what you think it does.
Even if the period means any character, shouldn't I still get a different result, namely an array of 5 empty Strings? It does work with escaping, though.

It's still very strange, as that method has been working for quite a while without any errors whatsoever, and I haven't changed it in months o.O
If  ;), :D, ;D, ::), :P, :-X, :o or >:D are attached, that paragraph may not be 100% serious. Seriously.
This link provides further information.
Callid Conia Pact - Petitions - Archive
Akonyl
Community Hero

Posts:
4200

Re: Let's get programmy!

Post by Akonyl »

the API also explains that :P

split(string) just acts like split(string, 0). The two-argument split behaves differently depending on the numerical argument (the limit). When defined as 0, all trailing empties are thrown out, so when they're all empties, they're all thrown out. Use .split("\\.", -1); to get your empties back.

As for the method working previously without any changes, I highly doubt that nothing changed. Either you forgot about a tweak you made to it, or you were passing in different input that worked with regexes anyway.
User avatar
Callid
Ratio vincit omnia.

Posts:
1433

Re: Let's get programmy!

Post by Callid »

.split("\\.") works as well ;)

Nope, I definitely haven't changed that method for quite a while, and it still worked earlier today. My guess is that this is either
a) due to some update which, among other things, changed the . operator to include numbers, and my IDE didn't recompile either the class the function was in or the other class that called this function until I changed it today or
b) it was because of some difference between Java 1.6 and 1.7 which suddenly became important when I called 1.7-compiled stuff from a 1.6-compiled class (though I thought that class would also be 1.7-compiled o.O)

But I definitely didn't change that method today, and I have been calling it with similar parameters all the time.
If  ;), :D, ;D, ::), :P, :-X, :o or >:D are attached, that paragraph may not be 100% serious. Seriously.
This link provides further information.
Callid Conia Pact - Petitions - Archive
Akonyl
Community Hero

Posts:
4200

Re: Let's get programmy!

Post by Akonyl »

of course it works, but only because "5.23" doesn't result in any trailing empties when you split on the period. I was using that as an example of invoking the method to get trailing empties back (since you were wondering why no empties were returned), and when you call it on "5.23", of course there aren't any trailing empties.
Post Reply