News for hackers. Stuff that matters.

valtron

Re:Show HN: 2048 Tetris on Thursday March 20, 2014 @11:57AM (#7436329)
A first approximation for a strategy would be to follow a boustrophedon, and keep 2, 4 and 8 near the top, e.g. something like this:

    .   .   .   .
    .   4   2   .
    8  16  32   .
  512 256 128  64
If you're really determined, you can use `.` as an operator via __getattr__ and inspect :p
Re:2048 on Monday March 10, 2014 @04:33PM (#7375517)
Tried 3 games, and the scores were 2700, 1200, 5000. So maybe. But then I wrote a function to play it for me:

    var manager = new GameManager(4, KeyboardInputManager, HTMLActuator);
    
    function play() {
      manager.restart();
      var m = 0;
      while (!manager.over) {
        manager.move(m);
        m = (m+1)%4;
      }
      return manager.score;
    }
... and that gets scores between 500 and 3000.

(Edit) Histogram of 500 runs:

  0k: ***
  1k: *******************
  2k: ****************
  3k: *********
  4k: *
  5k: *
  6k: *
Re:Show HN: Kriegspiel on Saturday March 08, 2014 @12:08PM (#7365665)
I started working on a similar thing last year [0]. In my version, your pieces can see any spot on the board they are allowed to move to.

[0] https://github.com/valtron/fog

Re:Arscoin, our own custom cryptocurrency on Wednesday March 05, 2014 @11:32AM (#7347898)
I would be inclined to agree; that value is _not_ entirely caused by scarcity. (Though I will point out that if a resource is scarce, people might put more value on it and try to acquire more now because they're afraid they might not be able to get it later.)

However, for a currency, scarcity is critical! Let's say it was easy (and cheap) for people to print their own dollars. You then want to buy an apple. How much is an apple these days, about $1? That doesn't make sense, the apple store can easily print $1 worth of money and keep the apple. What about for $100? Same thing: it's still one bill. What about $1000000? Maybe. Depends how much harder it is to acquire that amount of paper and ink than the apple. At this point, congratulations, your currency is basically paper and ink. Buying anything remotely expensive (like groceries) involves hauling around tons of paper and ink.

http://w3.newsmax.com/newsletters/uwr/images/transcript-img1...

Re:Arscoin, our own custom cryptocurrency on Wednesday March 05, 2014 @10:28AM (#7347449)
The creation of a new coin has no bearing on the scarcity of another.

Scarcity is just one requirement for something to act as a currency; another would be that it can be exchanged for goods and services (read: other things that people value, and for which they want things that they also value).

Re:Why you should move that button 3px to the left on Sunday February 16, 2014 @01:49PM (#7248675)
No, but I just checked a few of the sites we made and none break from ctrl+ (regarding this: I've never seen a non-tech person, i.e. 99% of traffic for the sites, use shortcuts in the first place); they also look consistent between _modern_ browsers; and how often do people load their own fonts? Is the designer responsible that a site becomes unusable under Wingdings? (Sorry for the strawman.)

That being said, when a designer says things like "move this button 3px to the left" they usually mean things like "move this button so its right edge aligns with the right edge of the content below, which got shifted because we added padding-right." So the original request gets implemented as what he _wants_ rather than what he asked for.

Re:Why you should move that button 3px to the left on Sunday February 16, 2014 @01:29PM (#7248570)
When I used to work with my designer friend, he would tell me to do things like that: increase this padding by 5px, lighten the color by a little, slightly decrease the border-radius, etc. One by one like that, I find it hard to follow and it doesn't feel like anything really looks different -- until I compare the finished product with what I originally made by myself.

Anyway, slightly OT: the screenshot looks like a Google page. Does anyone know which one? I really want to know what difference the 3px makes!

Re:Flappy Space Program on Friday February 14, 2014 @01:33AM (#7237272)
Are you supposed to get it to go through the space between the "stars"? Is it even possible?

Edit: Got my first point (50 - 100 tries?). You need to make it go a full orbit without touching the outer circle. This seems obvious in retrospect.

Edit 2: And they knock each other out of orbit. This is fun.

Re:How to Save 90% on your S3 Bill on Wednesday February 05, 2014 @04:06PM (#7186788)
You only need to worry about this if you're doing 100k+ LIST requests. For me, turning off validate would save 0.2%.
Re:Torus-Earth on Wednesday February 05, 2014 @03:37PM (#7186626)
I can't tell if you're being sarcastic... but if not, this is the first legitimate use of uncyclopedia as a source I've seen.
Re:Life is a game, this is your strategy guide on Wednesday February 05, 2014 @12:21PM (#7185119)
It depends on the rules of the game.

Maybe the rules of life are competitive: you can only increase your score at someone else's expense. The score is either 0-1 or 1-0. (Maybe you're both starving but only have enough food to sustain one person.)

Or maybe they're cooperative: you can both achieve a >= score if you combine resources/knowledge/what-have-you. The score is 3-3 for cooperating or 1-1 for playing independently. (Take insurance, for example.)

In reality, the game is a complex mixture of these two extremes.

Re:Strangest Programming Language Feature? on Friday January 31, 2014 @11:11PM (#7160803)
Cool!
I can see this being much better than Yelp. How are you doing the recommendations? Something along the lines of PageRank?
Re:JQuery 1.11 and 2.1 Released on Friday January 24, 2014 @11:49AM (#7115847)
Rejoice! No more

    event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
There's only one way to add a finite list of numbers, but several ways to "add" infinite lists. Ramanujan summation is just one way. There are also other ways to define "addition" on infinite lists: Abel, Borel, Cesaro, Euler, etc. summation.

They're different from each other because they disagree on certain infinite sums, but they're still considered "summations" because, for finite lists, they give the same answer as normal addition.

Achilles runs at 1 unit/s and Tortoise at x < 1 unit/s. Tortoise gets a head start of 1 unit. How long until Achilles catches up?

Well first, Achilles has to travel 1 unit because Tortoise got a head start. That takes 1s. By then, Tortoise managed to run x units, so Achilles has to catch-up, which takes another x seconds, and by then... etc: The time it takes Achilles to catch up is 1 + x + x^2 + ... Since x < 1, this converges and the answer is 1/(1-x). It takes 1/(1-x) seconds for Achilles to catch up.

Plot the lines: Achilles runs along A(t) = t, the tortoise T(t) = 1 + x t. Solving for t: t = 1 + x t = t (1 - x) = 1; t = 1/(1-x).

Ok, now what if x > 1? Let's use x = 2.

1/(1-2) = -1. It takes -1 seconds for Achilles to catch up. Don't believe me? Plot it: A(t) = t, T(t) = 1 + 2t; Achilles catches up with Tortoise 1 second before the race starts!

There you have it, a physical interpretation of why 1 + 2 + 4 ... = -1. (I have no example right now for 1 + 2 + 3 ..., sorry.) So you see, this isn't nonsense, though I admit it DOES depend on definitions!

Re:The Harsh, Logical World of Cryptocurrencies on Thursday January 16, 2014 @10:17PM (#7074073)
If cryptocurrencies take off, banks are simply going to store keys for people instead of physical money. For the layperson, nothing will change.

However, with cryptocurrency, the gap between how securely a single person vs. a dedicated entity such as a bank can store money decreases significantly.

He makes a good point about infinite MAD vs. STD.
Re:A 30 minute introduction to Rust on Monday January 13, 2014 @06:34PM (#7054367)
Don't points 2 & 3 together imply that anything that uses built-ins, which I assume are implemented with C FFI, is `unsafe`?
Re:Playing Atari with Deep Reinforcement Learning on Monday January 13, 2014 @03:20PM (#7053011)
A former coworker did his master's thesis on playing Atari games using RL. Here's a video of it learning to play Freeway: http://www.youtube.com/watch?v=44CilPmlimQ
Re:Click the Pic - How does this work? on Monday January 13, 2014 @03:04PM (#7052934)
It's composed of two images with transparent backgrounds. The foreground on one of the images consists only of white, and on the other only of black. Depending on what color's behind the picture, it obscures one or the other.

Edit: Gray background: https://twitter.com/SciencePorn/status/422565255726641152/ph...

Re:The Tuesday boy problem, in under 300 words on Wednesday January 08, 2014 @02:50AM (#7022291)
"I have a two children, one of which is a boy. What's the probability the other is a boy?"

Intuition wrongly treats the possibilities as sets and assigns probabilities 1/2 BB, 1/2 GB, rather than 1/3 BB, 1/3 GB, 1/3 BG.

Re:Radix Sort Revisited on Thursday December 19, 2013 @12:54PM (#6936326)
Also works for sorting strings in alphabetical order.
Re:Show HN: Myth โ€“ CSS the way it was imagined on Tuesday December 17, 2013 @07:25PM (#6924985)
You can also write colors with the more intuitive hsl() and it'll convert them to hex notation.

(Only relevant if you need to support IE < 9, but still cool.)

Re: on Sunday December 15, 2013 @06:20PM (#6911562)
Probably algorithmic trading.
Re:Why Bitcoin Will Never Be a Currency on Sunday December 15, 2013 @05:32PM (#6911297)
Interesting point, and you're right: I was only considering printed money!
Re:Why Bitcoin Will Never Be a Currency on Sunday December 15, 2013 @05:20PM (#6911217)
Let T be the total amount of money in circulation in a given currency C. When you see a value X in units of C, convert it to C' by X in C' = X / T. There you have it, every currency is already trivially equivalent to Bitcoin in that the supply of C' is fixed at 1.

How they're _not_ equivalent is that the creation of money in existing currencies is centrally controlled. You can get a clearer view of what happens when money is printed by looking at C' rather than C.

For simplicity, pretend there's only the Mint (can create money) and the Public (can't). Initially, Mint has X C and Public has Y C. In C', this is X/(X+Y) C' and Y/(X+Y) C'. Then Mint decides to create Z C. Mint now has (X+Z) / (X+Y+Z) C' and Public has X / (X+Y+Z). The Mint has effectively transferred money away from Public. All arguments against deflation are, basically, Mint will now redistribute the money in such a way as to stimulate the economy.

Re:Strategic Game of Life on Friday December 13, 2013 @12:56PM (#6901863)
1393 generations using the shotgun approach.

Older ยป