Page 17 of 20

Re: Let's get programmy!

Posted: October 29th, 2012, 6:30 pm
by monsi
Kogorou wrote:@redangelran
What did you do?

She made a Tetris game on Java. :x

Re: Let's get programmy!

Posted: October 30th, 2012, 9:08 am
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.

Re: Let's get programmy!

Posted: October 30th, 2012, 5:03 pm
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.

Re: Let's get programmy!

Posted: October 30th, 2012, 9:54 pm
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

Re: Let's get programmy!

Posted: October 31st, 2012, 1:52 am
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.

Re: Let's get programmy!

Posted: November 25th, 2012, 4:47 am
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

Re: Let's get programmy!

Posted: November 25th, 2012, 4:53 am
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.

Re: Let's get programmy!

Posted: November 25th, 2012, 10:34 am
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=Largest method I've ever written (voluntarily)]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"));
                }
            }
        }
    }[/code]

Re: Let's get programmy!

Posted: November 25th, 2012, 3:04 pm
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

Re: Let's get programmy!

Posted: November 28th, 2012, 2:01 pm
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

Re: Let's get programmy!

Posted: November 28th, 2012, 2:22 pm
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.

Re: Let's get programmy!

Posted: November 28th, 2012, 3:21 pm
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

Re: Let's get programmy!

Posted: November 28th, 2012, 3:37 pm
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.

Re: Let's get programmy!

Posted: November 28th, 2012, 4:23 pm
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.

Re: Let's get programmy!

Posted: November 28th, 2012, 4:31 pm
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.