Search found 3024 matches

by Berengal
Fri Sep 16, 2011 10:29 pm UTC
Forum: Gaming
Topic: Starcraft 2 : The Dune II Clone
Replies: 6604
Views: 705707

Re: Starcraft 2 : The Dune II Clone

Xanthir wrote:I don't know what's good against hydras. I don't see them very often.
From what I gather, it doesn't really matter unless you're doing something stupid like massing only a single unit.
by Berengal
Sun Sep 11, 2011 7:27 pm UTC
Forum: Gaming
Topic: Starcraft 2 : The Dune II Clone
Replies: 6604
Views: 705707

Re: Starcraft 2 : The Dune II Clone

Problem is, NP isn't going to be very useful now. It still has uses, but they're very situational, which means that probably more often than not it's going to be better to spend the research money on something else instead. This means that even in situations where it's useful it's just not going to ...
by Berengal
Sat Aug 20, 2011 5:08 pm UTC
Forum: Gaming
Topic: Starcraft 2 : The Dune II Clone
Replies: 6604
Views: 705707

Re: Starcraft 2 : The Dune II Clone

I suck at pretty much everything in this game, except I feel like I'm getting the hang of producing probes, and I'm not too bad at producing other stuff as well. I just won a game where I had twice the resources lost of my opponent yet still three times the army. At one point he killed 40 probes wit...
by Berengal
Thu Aug 04, 2011 9:24 am UTC
Forum: Coding
Topic: Concurrent Functional Languages
Replies: 6
Views: 3564

Re: Concurrent Functional Languages

I put my vote in with Haskell. Not because it neccessarily has better concurrency than any of the other languages (erlang has a very nice model built-in), but because it provides a very good foundation to learn about all the different models (including Erlang's) without really giving any of them any...
by Berengal
Fri Jul 29, 2011 7:30 am UTC
Forum: Gaming
Topic: Starcraft 2 : The Dune II Clone
Replies: 6604
Views: 705707

Re: Starcraft 2 : The Dune II Clone

I'm partial to the drop pods myself. Except I play protoss, and feel like drop pods would be a clear violation of my warp gate patent. People don't use warp prisms enough. Sometimes I find myself going templar in the mid-late game, but I still get a robo pretty early for the observers. When I've got...
by Berengal
Tue Jul 26, 2011 3:09 am UTC
Forum: Gaming
Topic: Starcraft 2 : The Dune II Clone
Replies: 6604
Views: 705707

Re: Starcraft 2 : The Dune II Clone

So I'm playing my placement matches and won the first two. The third quit on me right away, and the fourth was an epic crazy battle where I first parked a warp prism in his base for five minutes, and then he killed me with ultras ten minutes later (both of us messed up badly). That guy was the first...
by Berengal
Mon Jul 25, 2011 3:44 pm UTC
Forum: Gaming
Topic: Starcraft 2 : The Dune II Clone
Replies: 6604
Views: 705707

Re: Starcraft 2 : The Dune II Clone

Hi, welcome. It sounds like you did a full on swan dive into multiplayer SC2, so there's really not much to add. I will say though, that if you're at the point where you're refining and trying to improve, you should bow out of the practice league. Yes, the plan was only to stay there for a day or t...
by Berengal
Mon Jul 25, 2011 6:46 am UTC
Forum: Gaming
Topic: Starcraft 2 : The Dune II Clone
Replies: 6604
Views: 705707

Re: Starcraft 2 : The Dune II Clone

A couple of weeks ago I was bored and for some reason happened to watch an sc2 game. It struck me how close it was to "real" sport, except I was actually enjoying watching it. Somewhat curious I decided to watch some more games, and a few hours later I was hooked. I used to play a lot of R...
by Berengal
Sat Jul 02, 2011 4:25 am UTC
Forum: Coding
Topic: Java - Images and Memory
Replies: 6
Views: 1585

Re: Java - Images and Memory

You know, rotated versions of images can be stored as a simple affine transformation. That could save you some space on those temporary BufferedImages.

Also images will naturally take a lot of memory, since they're usually "unpacked" into raw pixels in memory.
by Berengal
Tue Jun 07, 2011 8:58 pm UTC
Forum: Coding
Topic: Scala?
Replies: 11
Views: 1728

Re: Scala?

The CLR has stack-allocated objects and parameterized types. Dalvik is a register machine, which is just nicer to work with overall. Also, Dalvik's executable format is supperior to the JVMs. Hotspot has a much better JIT and garbage collector than Dalvik. Do you have any benchmarks for that? I've b...
by Berengal
Tue Jun 07, 2011 6:41 pm UTC
Forum: Coding
Topic: Scala?
Replies: 11
Views: 1728

Re: Scala?

The JVM is actually a decent enough platform. With the exception of the lack of tail call support, it's pretty much the best VM out there from what I can tell. I think that both the CLR and Dalvik are better VMs. The JVM is actually rather primitive. What's good about it are the various highly matu...
by Berengal
Thu Jun 02, 2011 7:34 pm UTC
Forum: Coding
Topic: batch new line in variable
Replies: 1
Views: 1570

Re: batch new line in variable

Use newlines. As in

Code: Select all

foo="hello
world"


Unless you mean DOS batch scripts, in which case I don't know.
by Berengal
Thu Jun 02, 2011 5:15 pm UTC
Forum: Coding
Topic: junit testing vs system.out printing
Replies: 18
Views: 3301

Re: junit testing vs system.out printing

Eh, printing stuff out is still my preferred way of debugging. Debuggers are too cumbersome to use.

(Also, debuggers aren't. The bugs are still there even if you run a debugger on it.)
by Berengal
Tue May 31, 2011 1:13 pm UTC
Forum: Coding
Topic: Scala?
Replies: 11
Views: 1728

Re: Scala?

I personally think Clojure is better than Scala, but it's certainly an interesting language. Better than Java by far.
by Berengal
Tue May 31, 2011 1:10 pm UTC
Forum: Coding
Topic: What to begin with?
Replies: 10
Views: 2084

Re: What to begin with?

IMO. The hardest part will be getting a good sense of how to do good OO design. Depending on the kind of C you're writing, you may not be seeing... much of that at all. I agree with the first part, and partly the second as well. I'd just like to add that you're about as likely to see good OO design...
by Berengal
Sat May 28, 2011 9:54 pm UTC
Forum: Coding
Topic: Concurrent depth-first search webcrawl in Haskell
Replies: 2
Views: 1006

Re: Concurrent depth-first search webcrawl in Haskell

I've had some success scraping html with the HXT library ( hackage ). It might be overkill for one simple task like this, but it's a neat tool and you'll learn a new minor programming paradigm in the process. It's basically xpath + xslt + steroids + haskell. You probably want to do some reading up o...
by Berengal
Sat May 28, 2011 5:04 pm UTC
Forum: Coding
Topic: Some game programming advice
Replies: 12
Views: 1681

Re: Some game programming advice

The stored format isn't particularly important as long as you can read it. PNG, GIF and BMP are all widely used for sprites (though BMP lacks alpha. Usually 0xFF00FF is translated to fully transparent when using BMP, so you might have to do that after you've loaded the image). BufferedImage works ju...
by Berengal
Sat May 28, 2011 3:52 pm UTC
Forum: Coding
Topic: Parallel/Functional Programming vs OOP/C++?
Replies: 7
Views: 1754

Re: Parallel/Functional Programming vs OOP/C++?

I should note that parallel programming really only works for problems that are parallizable. Concurrency is a harder issue. When you want to parallelize you're going to have the most trouble creating an algorithm that is parallelizeable. Implementing it is comparatively easy, and several languages...
by Berengal
Wed May 25, 2011 10:43 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9738
Views: 1550172

Re: Coding: Fleeting Thoughts

checkEnvironmentState, while in theory just a getter (depending on the hidden variable "time"), is crazy expensive, and also cannot be assumed to be referentially transparent even if time is considered to be an explicit parameter, so it can only really be safely called once each iteration....
by Berengal
Wed May 25, 2011 6:39 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9738
Views: 1550172

Re: Coding: Fleeting Thoughts

Is the following piece of code understandable? Would you balk if you encountered it in the wild or is it a perfectly valid way of doing what it's trying to do? outerLoop: for (List<Foo> foo: foos) { List<Bar> bars = getBars(foo); for (Bar bar: bars) { pauseLoop: while(true) { switch (checkEnvironmen...
by Berengal
Fri May 06, 2011 9:12 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9738
Views: 1550172

Re: Coding: Fleeting Thoughts

Do you think ghc would convert something like "x `xor` 0" to "x" when optimizing? It would allow me to write one function in terms of another and make things very marginally cleaner :P. Doubtful, but the only way to be sure is to inspect the assembly. There are several things th...
by Berengal
Tue Apr 26, 2011 4:22 pm UTC
Forum: Coding
Topic: Thinking in functional programming
Replies: 28
Views: 5695

Re: Thinking in functional programming

Lazy IO is not recommended. It's there for writing quick filters in a language somewhat more structured than bash, not something you're supposed to use in programs longer than 30 lines. If you think that because Haskell is lazy then IO in haskell is lazy has completely missed the distinction between...
by Berengal
Mon Apr 18, 2011 6:13 am UTC
Forum: Coding
Topic: Why don't ALL computer programs have customizable controls?
Replies: 25
Views: 2760

Re: Why don't ALL computer programs have customizable contro

You're going about this all wrong.

If you want customisable keybindings, fix them yourself in the window manager.
by Berengal
Mon Apr 18, 2011 5:33 am UTC
Forum: Coding
Topic: Thinking in functional programming
Replies: 28
Views: 5695

Re: Thinking in functional programming

Anubis wrote:These are all just examples of recursion. I think we're obviously interpreting the original request in fundamentally different ways. You're showing me functions with their return value passed as a parameter to the next call of that function, whereas the way the original request is written it sounds like its asking for a function call with its return value passed as a parameter to the very same call, which could obviously never be evaluated (in fact, I don't think such a call could even be written).
Take another look:
Berengal wrote:

Code: Select all

fix :: (a -> a) -> a
fix f = let x = f x in x
Where is the recursion?
by Berengal
Sun Apr 17, 2011 5:53 am UTC
Forum: Coding
Topic: Thinking in functional programming
Replies: 28
Views: 5695

Re: Thinking in functional programming

How about these standard combinators? fix :: (a -> a) -> a fix f = let x = f x in x loop :: ((a, b) -> (c, b)) -> a -> c loop f input = let (output, feedback) = f (input, feedback) in output Edit: Made some dataflow diagrams, since I find that more educational than code in these cases: dataflow.png
by Berengal
Sat Apr 16, 2011 8:20 pm UTC
Forum: Coding
Topic: Thinking in functional programming
Replies: 28
Views: 5695

Re: Thinking in functional programming

Aha! I was waiting for just that question, and have indeed prepared an example! The problem we'll tackle is quite a silly one: Parsing of a simple data stream format defined as such: ⋅ The character "e" not followed by anything (indicating the end) ⋅ A single digit numb...
by Berengal
Sat Apr 16, 2011 8:25 am UTC
Forum: Coding
Topic: Thinking in functional programming
Replies: 28
Views: 5695

Re: Thinking in functional programming

For practice, try writing a function that depends in part on the return value of the next function it calls to determine some of the parameters it will call that very function with. Are you intentionally trying to confuse the OP? Because either you've misstated the problem or you're asking for the ...
by Berengal
Sat Apr 16, 2011 6:10 am UTC
Forum: Coding
Topic: A compilation of best programming practices ?
Replies: 17
Views: 3415

Re: A compilation of best programming practices ?

Best" practices are harmful. I've seen more damage done by "best" practices than by the things they're supposed to keep you from doing. There are no hard and fast rules on how to write good code, only aesthetic principles, and those are very hard to teach and impossible to condense in...
by Berengal
Fri Apr 15, 2011 1:16 pm UTC
Forum: Coding
Topic: MYSQL help
Replies: 2
Views: 626

Re: MYSQL help

That commentReply FK won't work. Well, it will, but it won't do what you want. What you're saying is that every row must have at least one row with the same commentReply value as it does. This is trivially true, since the row itself has the same value as itself. What you probably want is a "FOR...
by Berengal
Wed Apr 13, 2011 5:33 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9738
Views: 1550172

Re: Coding: Fleeting Thoughts

Haskell. Clojure's also good. I've seen good things in Erlang, but I haven't used it much myself. The good thing about Haskell is that forces you to let go of your tainted imperative approach right away; there's no secret escape back to the familiar. The bad thing about this is that you'll feel like...
by Berengal
Mon Apr 11, 2011 5:05 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9738
Views: 1550172

Re: Coding: Fleeting Thoughts

Berengal wrote:Unrelated FT: Haskell has a really good FFI. Both the language support and the tooling is awesome.

On a continued tangent, the FFI can be treacherous at times. It isn't here-be-dragons exactly, but more like here-be-not-dragons-actually-but-a-drakeling-or-two-shouldn't-be-too-surprising.
by Berengal
Sun Apr 10, 2011 6:11 pm UTC
Forum: Coding
Topic: Java Programming Question
Replies: 4
Views: 770

Re: Java Programming Question

But please choose a better technology. Java applets are so 90's. I've only ever written one and that was after someone explicitly asked me to write it in Java. Let me link you to a good java applet, and the equally good making off of said applet. Although yes, java applets are probably not the best...
by Berengal
Sun Apr 10, 2011 3:54 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9738
Views: 1550172

Re: Coding: Fleeting Thoughts

FT: For a quick and dirty CAPTCHA, I wonder if a rough one-IP-can-only-do-action-5-times-in-an-hour limit could work? Sure people have proxies and whatnot, but it would limit the overall spamability, no? False positives would be really annoying for actual humans, and even 5 spams/hour is too much s...
by Berengal
Thu Apr 07, 2011 5:32 pm UTC
Forum: Coding
Topic: What can I do with coding skills?
Replies: 25
Views: 11612

Re: What can I do with coding skills?

One question though: what's Project Euler for? It's for exercising your algorithmic, mathematical and creative problem solving muscles. The problems are complicated enough that you need to be able to reason about them mathematically to reduce the problem space to something that fits inside our univ...
by Berengal
Wed Apr 06, 2011 5:19 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9738
Views: 1550172

Re: Coding: Fleeting Thoughts

Haskell question: Best way of converting a Bytestring to [Word64]? My first thought was a fold, but all the list-like functions for Bytestrings go by Word8 chunks so that seems pretty awful to do. Basically my DES encryption functions work on [Word64], and I'm trying to write a little file encrypti...
by Berengal
Wed Apr 06, 2011 1:42 pm UTC
Forum: Coding
Topic: I want to make a game, for portfolio and $$. Which Language?
Replies: 19
Views: 5145

Re: I want to make a game, for portfolio and $$. Which Langu

If you want a Ruby framework I'd go for Gosu. Basically, it takes care of framerate and event loops for you and gives you a few simple things like images, samples and songs, plus a few utility functions for trigonometry. That's all you need to start out with; pretty decent for making small games qui...
by Berengal
Tue Apr 05, 2011 4:19 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9738
Views: 1550172

Re: Coding: Fleeting Thoughts

ORMs make me cry.
by Berengal
Tue Mar 29, 2011 10:20 pm UTC
Forum: Coding
Topic: I want to make a game, for portfolio and $$. Which Language?
Replies: 19
Views: 5145

Re: I want to make a game, for portfolio and $$. Which Langu

Figure out which game you want to make first, then figure out which platform you want to use. At least if you don't have any experience with any of them, choosing one at random won't get you very much. Also, making a game isn't all about programming. There's loads of other stuff you need to be able ...
by Berengal
Mon Mar 28, 2011 9:33 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9738
Views: 1550172

Re: Coding: Fleeting Thoughts

Also, I noticed that your installation instructions for Ubuntu involved mucking around to convince Ubuntu that it does, in fact, actually want to run 'gem update --system'. I very (very very very) highly recommend using RVM if you're doing Ruby dev on Linux. (And while I'm thinking about it, anothe...
by Berengal
Mon Mar 28, 2011 2:20 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9738
Views: 1550172

Re: Coding: Fleeting Thoughts

I was very surprised to see .rb extensions when I took a look at the source, given that you're the one who wrote it. I'm a polyglot programmer. I glot less Ruby than I'd like to, so I decided to write this in that. Also, you should include a Gemfile in your repository so that people just need to ru...

Go to advanced search