Our new Indie Games subforum is now open for business in G&T. Go and check it out, you might land a code for a free game. If you're developing an indie game and want to post about it,
follow these directions. If you don't, he'll break your legs! Hahaha! Seriously though.
Our rules have been updated and given
their own forum. Go and look at them! They are nice, and there may be new ones that you didn't know about! Hooray for rules! Hooray for The System! Hooray for Conforming!
SELECT * FROM posts WHERE tid = 'PA PROGRAMMING THREAD'
Posts
The Builder abstract class just sets up the friendlier append methods (that accept full strings or arbitrary objects instead of just a character) just leaving you to implement what append(char) means. In this case, it's to add to a StringBuffer in a particular way.
The PhalLounge :: Chat board for Phalla discussion and Secret Santas :: PhallAX 2013
Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
That would bite you in the ass big time soon enough.
The PhalLounge :: Chat board for Phalla discussion and Secret Santas :: PhallAX 2013
Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
The PhalLounge :: Chat board for Phalla discussion and Secret Santas :: PhallAX 2013
Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
the days before recursion
blew my mind away
Yes. The PrintWriter is really handy for this: It breaks down the input string, then runs the writer's write method on the resultant bytes (the default is internally a loop over the array calling the single-byte version - you can find implementations in OpenJDK if you're interested, but it's not needed).
For this problem, concern yourself with overriding the behavior of OutputStream#write(int), with general contract
Other refs:
E: goddamn automatic quote linking
I'm really liking the new UX/chrome in VS'11.
need to brush up on algorithms / be able to write some basic pseudocode for an interview
won't need to know in depth technical stuff as it's not a programming position, but technical knowledge is needed
haven't looked at this stuff in a few years, since data structures... where is a good place / what is a good way to review
public static MethodInfo[] GetInterfaceMethods (this Type iface, BindingFlags flags) { if (!iface.IsInterface) { throw new ArgumentException ("Type must be an interface", "iface"); } var methods = new List<MethodInfo> (); Action<Type> getInterfaceMethods = null; getInterfaceMethods = t => { methods.AddRange (t.GetMethods (flags)); foreach (var childIface in t.GetInterfaces ()) { getInterfaceMethods (childIface); } }; getInterfaceMethods (iface); return methods.Distinct ().ToArray (); }The PhalLounge :: Chat board for Phalla discussion and Secret Santas :: PhallAX 2013
Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
Assuming you've got some time, this book is just about regarded as the bible for algorithms. For all the algorithms they go over in the book, they give a pseudocode implementation. However, it's a very technical book. And it's like 1300 pages. But, if this is material you've already studied before, it could be a good refresher to skim through to the relevant parts you don't really remember/understand. I say relevant parts, because it's very comprehensive.
It's also a good book just to keep around for referencing.
Thanks for the info guys, I'll see what kind of monstrosity I can hack up. As GnomeTank mentioned, writing a MOBA backend in Javascript will be pretty disgusting. The concept is interesting to me because it allows the use of Javascript on both server and client. Also, I'm curious about the actual performance of Google's V8 engine. I'd better go read that Eloquent Javascript book first, though.
Javascript and V8 are very reasonable.
They're not C fast but hey, they are powerful and fast still.
Give it a go and let us know how it goes!
The PhalLounge :: Chat board for Phalla discussion and Secret Santas :: PhallAX 2013
Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
If it is, it won't be Javascript's fault. :lol:
I'm not familiar with Eloquent Javascript, so it's entirely possible that it's actually a better book, but my recommended reading will (again) be Crockford - Javascript: The Good Parts. It's brief, to the point, for programmers and it does well to introduce some current common practices of writing JS code. It may be about to start getting dated, but I found it exactly what I needed at the time. Very fast, very easy read.
Recursion is the best for problems that involve self similar data structures.
For more information read this comment.
Javascript running in Node.js is, as far as I've read, effectively JIT'ed into C++ code
That's what V8 is all about
edit: Zeeny, after reading half through the first chapter I picked that book up and, yes, this is good stuff. It makes javascript's weirdness make a bit more sense.
Depends on the language. For example, in OCaml I often recur over a set of jobs, consuming them until empty. While I could do this with a while loop, doing it with a recursive call lets me use a list instead of a list reference. Mutable data structures are costly, so the recursive approach has a slight edge in that case.
Algorithms by S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani is the book I used in college and the entire book is online for free at http://www.cs.berkeley.edu/~vazirani/algorithms.html.
I was on an interview with a company that absolutely hated recursion because it's stack intensive. I think they used fibonacci as an example.
The benchmarks I have seen place v8 performance behind pure C++. The issue is how to benchmark a compiled a language to one that does run time optimizations. I expect v8 performance to be really good on heavy branching code that has runtime branch trends.
It doesn't have to be amazing. It just has to be better than average.
IMO the computational exhaustion of enforcing game rules for a MOBA game are NOT the problem
The problem is writing javascript on the client that will ferry that data back and forth to the server in a responsible way.
WebSockets is a great tool but it certainly doesn't write the net code for you.
It will demand a brutal crash course in client side prediction
Just remember, there is a constant-time approximation of Fibonacci. I hate the example of Fibonacci as a dynamic programming problem, so I memorized the closed form approximation of the function just for interviews.
Fibonacci is the standard question the interviewer asks where I work, and he laments that nobody, ever, has given what he considers the "right" answer. Which is "well, first I'd write a test". Tests supporting naive recursive Fibonacci are arguably better in the real world than clever closed form approximations - at least then you have a solid base to optimize on, and are only likely to do so when the need becomes apparent.
But because everyone knows Fibonacci so well as an example, they start reeling off how to program it: the question shifts their brain into "Fibonacci mode" instead of "software development" mode. If the question was "How would you program <function you've never seen before>", you'd likely get a much more methodical answer.
Outside of an interview context, is there an application for fast, high-value, accurate Fibonacci numbers? Or is it, as I suspect, just an example?
Memorizing the closed form approximation is certainly a waste. Even knowing how to derive it is sort of a waste. I just like to have a glib answer to that particular question.
I always thought the best answer to such questions was to say something like, well, it's a dynamic programming problem, so you fill out a table containing answers to the smaller problems, working your way up to the problem you wanted to solve. Generally, any problem which has independent subproblems can be solved this way.
"First I'd write a test" seems like an odd answer to a programming question. You might as well expect someone to say "First I'd open up a buffer" or "First I'd jot down the problem definition on a piece of paper" or "I'd start by turning on the PC". It's so fundamental to the process that it seems like it doesn't need saying.
And you might say it's so fundamental to the process that is shouldn't need saying - for a lot of people, that's not true.
How would you perform an interview?
Well first I would take a breath...
The PhalLounge :: Chat board for Phalla discussion and Secret Santas :: PhallAX 2013
Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
You see, by taking the deep breath before the check, I am now able to handle the situation where I am not wearing suitable work attire by just sprinting out of the office and into my car. Without the deep breath, I would be unable to do this as efficiently.
I think this shows that I am capable of forward planning, and also shows respect for the workplace.
Is fibonacci even a good question? Maybe it tells a lot about the programmer.
Recursion: Warning. Just graduated college.
Memoized Recursion: Warning. Functional Programmer.
Iterative: Warning. Either very experienced or completely inexperienced.
Precomputed Lookup Table: Warning. Watch your back. This guy is sneaky.