Hacker Newsnew | past | comments | ask | show | jobs | submit | gukoff's commentslogin

Draw.io already allows creating editable PNGs and SVGs: it embeds the diagram definition in the image metadata. You can then import this image like you would import any other .drawio diagram

The VSCode integration is the cherry on top. All files with the correct extension (such as xxx.drawio.png) will automatically open for edit in the draw.io UI embedded in the IDE.

I use this feature often to build on top of the previously made diagrams.


> Prof Penadés' said the tool had in fact done more than successfully replicating his research.

> "It's not just that the top hypothesis they provide was the right one," he said.

> "It's that they provide another four, and all of them made sense.

> "And for one of them, we never thought about it, and we're now working on that."

The Google's co-scientist still seems to make a useful assistant.


That's very impressive - how do you do this? I also see an IDE screen with the debugger in your other article about telegram - presumably also HTML/CSS


I just open Sublime Text (a basic text editor) and start typing away HTML/CSS until I've got something I like the look of. No fancy IDE features or anything, just typing out code into a file :).

I also use my browsers' DevTools for faster CSS iteration, and Paint.NET for concept art and comparing/measuring screenshots. Sometimes I even use Illustrator and/or Inkscape for some SVG stuff (which I manually edit in code afterwards) - in this blogpost I used Inkscape to recreate the cat emoji and the Chrome iframe error pixel art icon.


Thank you, this is very interesting


This really depends on the pure strategies that you choose.

The initial set of strategies wasn't very diverse and compensated for the binary search "weaknesses" on the ends of the spectrum by sometimes guessing 1 and 98.

But after adding some more pure strategies to the set, we've got a far better mixed strategy that prefers the numbers between 28-70 as the first pick: https://github.com/gukoff/ballmer_puzzle#winning-strategy


O, wow, post got update!

  > Avg win if Ballmer chooses randomly: $0.16247848000093376
  > Win if Ballmer chooses adversarially: $0.14657033010415976
So the goal is to find a set of strategies where adversarial avg win == random avg win? Or these numbers will never be equal?


Interesting! What about the worst case? And which kinds of strategies did you pick?


Using random strategies with small sub-optimal deviations, I get to about $0.189

Ref. https://pastebin.com/YcRhGpV6


I don't view the original problem this way, but let's think about it!

> the spread on that surely goes over the 0 line.

Do you imagine starting with $1 or $1000? :)

Let's add a condition that Ballmer has infinite money, we start with a specific budget, and we can't continue playing if we exceed budget randomly changes after each game,

In the game where you start with $N, win $1 with probability p > 0.5 and lose $1 otherwise, the chance of eventually losing all your money is (p/(1-p))^N. [1]

So, the ruin chance actually becomes exponentially lower the more money you have at the start.

The steps in the random walk above belong to a simple, Bernoulli-like random distribution. Meanwhile the mixed strategy is a more complex discrete random variable because it can do more steps than just +1 and -1.

However, I believe that the same principle applies for the mixed strategy.

If you zoom out and consider "batches" of steps, you can apply the Central limit theorem and see that all these random walks work roughly the same. The caveat being that you need a large enough starting budget to "zoom out" :)

Granted, the standard deviation for the mixed strategy is ~$1. I would guesstimate that if you start with ~$1000, there's no way you will ever lose your money.

> What would be more interesting is to monte carlo simulate this strategy and look at the win/loss distribution. Presumably the choice is then not so clear cut.

Agree, this would be a nice demonstration! I will think about doing this next time I get a couple of hours of free time.

[1] https://math.stackexchange.com/a/153141/65143


hey, thanks for the blog post and your reply! I think I follow - a generalization of a coin-flip type game. I agree that if you have more starting money, you would never lose. From the binary search idea, even if chosen adversarially, the worst case is still log2(100) ~= 6.6. So if you get 1,000 guesses or just any number of guesses >= 7 you literally can't lose. Then you should definitely play.

Setting the limit at 5 brings you to the interesting point of there being a good mix of win/loss outcomes. 4 would be too few guesses and you'd very likely lose, and 7+ you'd definitely win. So the question is only interesting _because_ the limit is chosen so that the spread puts your odds on both sides of the 0 line. Otherwise it'd be clear cut.

The standard deviation being ~$1 is interesting. To me that suggests that with a mean of $0.07 and a deviation of +/- $1, it's essentially 50/50 odds. There's technically a slight edge in your favor, probably 53/47, but barely. So given a game with essentially no edge, would you play? Framing it that way - deciding to what degree the game is winnable - it's essentially not. You should not particularly expect to win, no matter your strategy.

I think part of the trick with the Ballmer question as well is the question is not necessarily about 'can you find an optimal strategy?' - it's 'do you play the game or not?'. The paths chosen within the round don't ultimately matter to that question. It's only intermediately necessary to model the intra-round decision paths in order to get to the overall win/loss distribution for a single round.

If you do end up getting the time, do make another blog post!


Here's another way to look at it. With a naive binary search strategy, which is an optimal algorithm for search for a sorted static array, we have:

Step # | % of reachable numbers in [1,100]

1 | 1% = 2^0

2 | 3% = 2^1 + 2^0

3 | 7% = 2^2 + 2^1 + 2^0

4 | 15% = 2^3 + ...

5 | 31% = 2^4 + ...

6 | 63% = 2^5 + ...

7 | 100% <-- 2^7 > 100

So out of all possible single-trial outcomes, only 31% of outcomes guess the number in <= 5 steps. In other words, in 1 trial you would expect a 69% chance of a non-positive outcome.

So an EV of +$0.2 or +$0.07 alone does not match the actual odds of winning in 1 trial. EV is most predictive in the infinite limit, and least predictive in a single trial - which this is. First off, $0.2 isn't even a possible outcome so there's a good reminder that the mean value does not always occur in the dataset.

This is also pretty straightforward from the classical interview-y 'Big O' perspective. If you translate the question to the natural CS-worded equivalent, something like "can you search a sorted array of length 100 to find an arbitrary value in 5 steps or less?", one readily sees that O(log2(n)) -> log2(100) = 6.6 > 5, so you definitely can't guarantee it. If we put odds on it as above, we can see that the odds are also not in your favor.

Now, if you want to look at it as saying after 5 steps you've removed ~96% of the search space, that's cool and all that you've reduced the candidates to only 3-4 remaining numbers, but those aren't the odds of winning. We know that 7 guesses is enough to guarantee finding the number, so after 5 guesses we ought to be 'close'. But the game is not horseshoes, so the fact that we're close is not relevant


Thanks for spotting it! Exactly right, I fixed the text.


You can actually do well combining different flavors of binary search! I commented a solution on the parent post if you're curious.


You forget that the quick guesses bring you more than $1!

As the original article says, on average you can win $0.20. But that's indeed the upper bound if we speak of the adversarial number picking.


Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: