Simon blogs

Started by Simon, October 18, 2015, 06:05:44 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

namida

QuoteI hesitate making intricate programming design topics here though: It's really software development at heart, not of general Lemmings interest, and probably more sensible on Software Engineering stack overflow. It would be a genuine call for help, on a nontrivial and highly specific problem in my personal areas of expertise and interest (Lemmings, OOP) -- thus obvious solutions won't fit.

On the other hand, it's easier to explain the problem on Lemmings Forums, because we have a bunch of developers here that will readily understand the problem. And if we find the least-worst solution, maybe it'll be helpful too for somebody in the future.

There is no rule against posting in more than one place. ;)
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

ccexplore

There's no harm in posting the problem here; as the saying goes, two (or more) heads can be better than one.  But I also think you are actually already the person on the forum who's most well-versed in the theory and practice of software design and architecture.  So ideally you'd want to get advice from someone who's even better at this, and hence a more programming-oriented forum or channel is probably the way to go.

But even if you end up solving the problem through purely outside advice, I certainly wouldn't mind hearing about the solution here. ;)

[aside: your previous post about keeping sentences terser has made me actually took the time to review and edit my writing above accordingly]

Dullstar

I often feel more comfortable posting questions in places like this where I recognize a lot of the posters even if there's probably a technically better place to ask the question. Of course, if it's too advanced, there might not be anyone here who can help, but there's certainly not any harm in posting it here. I'd certainly be interested in seeing whatever you come up with; I find your posts on these topics quite interesting and informative.

namida

Quote from: ccexplore on June 22, 2020, 10:05:15 AM
There's no harm in posting the problem here; as the saying goes, two (or more) heads can be better than one.  But I also think you are actually already the person on the forum who's most well-versed in the theory and practice of software design and architecture.  So ideally you'd want to get advice from someone who's even better at this, and hence a more programming-oriented forum or channel is probably the way to go.

Counter-point: Not all progamming problems are purely about the programming. Some might be about the underlying logic - there's usually many ways to approach such questions. Some might be about the UI, in which case feedback from potential users is very important - indeed, I feel that some decisions in Lix are based too much on programmer mentality and not user mentality (for example, the strong focus on making sure the UI is optimized in terms of fewest clicks - to the extent that some of the "nice fuzz" that players may expect in a game, is missing).

Of course, most such cases fall under "having a variety of opinions is good", and thus are most strongly arguments for "ask the question on both".
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

WillLem

Quote from: Simon on July 31, 2019, 12:14:48 PM
Christmas tree problem

You have a fir tree and want to decorate it with christmas lights.

The fir tree's green bushy "surface" is cone-shaped, with a circular boundary at the bottom.

You also have n candles. These are about to be placed on the fir tree.

---

Task. Distribute the n candles on the fir tree such that the candles are nicely spaced apart from all other candles. You may place candles on the boundary.

No problem! I'm ace at decorating Christmas trees 8-) Nearer the time, I'll put up some pictures.

Quote from: Simon on July 31, 2019, 12:14:48 PM


Application. If your christmas tree is instead the space of all colors, and you have 8 Lix player colors, find a distribution of 8 colors such that no two colors look more similar than necessary. This is hard, especially if you, in addition, want to avoid black because black lixes looks too much like the boundary level background.

To be fair, the picture you've posted distinguishes the Lixes very well. If you wanted to avoid black, this could be changed for hot pink or pastel pink, both of which are different enough from red not to be confused. Interesting that you chose teal rather than royal blue for Lix #5 in the image.

namida

QuoteTo be fair, the picture you've posted distinguishes the Lixes very well. If you wanted to avoid black, this could be changed for hot pink or pastel pink, both of which are different enough from red not to be confused. Interesting that you chose teal rather than royal blue for Lix #5 in the image.

Adding to this - I would say that you could use a deeper blue there, then also use cyan as a player color. This would then allow ultimately removing black, and using white for neutrals (if that's still planned).
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Simon

Thanks for the suggestions to post in both places!

The problem is elaborate to describe from scratch, it relies on several details. For a start: Tiles and Occurrences, I'll probably move that and any replies to new topic.

Quote from: ccexploreBut I also think you are actually already the person on the forum who's most well-versed in the theory and practice of software design and architecture.

This is flattering. :lix-blush: I would have easily thought that you were the most well-versed, or else one of the professional software engineers who post less often, but supposedly have formal education and more years in the business. Thanks!

Still so much to learn, especially with my near-zero experience in multithreading and inter-process communication (apart from networking, or temp files).

Quote from: Dullstarthere's certainly not any harm in posting it here. I'd certainly be interested in seeing whatever you come up with; I find your posts on these topics quite interesting and informative.

This is very inspiring, thanks! This was the reason that I've begun here today with the explanation.

Re colors in Lix: Hmm, reasonable recommendations. I'll have to consider everything here in case of a physics or format change. Light grey would be a good neutral color.

-- Simon

Simon

#247
Deal or No Deal

Once in your lifetime, now, you're offered a choice:

  • 50 % chance of gaining 1,000,000 EUR, or
  • guaranteed gain of 200,000 EUR.

I would take the guaranteed win. The reason is the classic utility argument: The 200,000 help me reach most of the same goals in life as the million would. Any goals that don't mainly depend on money aren't helped any better with the million anyway.

Maybe some readers are already so wealthy that the gamble is more interesting to them for its higher expected value than the guaranteed 200,000. Congratulations then. :thumbsup: Or you're in a stickup and must pay 800,000 EUR of ransom. >_>

If you agree at all that there (may) exist sound reasons for picking the 200,000, the next interesting questions become:

  • What is the amount of money that makes you indifferent between winning that money guaranteed, and the 50 % chance at a million?
  • What is the probability of winning the million that makes you indifferent between a guaranteed 200,000 EUR, and winning the million with that probability?

I'm unsure if I would take 120,000 EUR over the chance at the million. The 120,000 is reasonably easy to grasp, one can work diligently towards it, and yet doesn't have to sacrifice one's entire life for it.

Varying the probability is even more interesting: People exhibit a psychological bias that overestimates small probabilities and underestimates high probabilities, especially when the exceptional outcome is easy to imagine (plane crash), but the likely outcome is boring (few safely arrived planes make it into the news). Thus, if you agreed with my pick of the 200,000 in the original choice, think if you really need 95 % for the million before the gamble becomes attractive.

-- Simon

WillLem

This is a conundrum I'd most likely be thinking about whilst I'm spending my 200,000 Euros ;P :crylaugh:

I guess the guaranteed win would have to be very small for me to want to take a chance on the million - something like 10 - 100 Euros. Higher than that, and you're basically being given free money not to gamble for 1,000,000. That is an attractive deal.

Furthermore - as you've said, 200,000 is still a relatively life-changing amount of money. There's lots you can do with it that may even turn it into a million if you're savvy enough.

The chances of winning the million would have to be at least 99% for me to even consider taking a chance on it versus a guaranteed gift of 200,000. And even then, I'd be very hesistant and would still probably favour the 200,000. The reason being that there's a 1% chance you could walk away with nothing, and that would be more difficult to live with and potentially more psychologically damaging than taking the 200,000 and living with the fact that you most likely would have won the million had you gambled.

200,000 Euros is just fine by me, I'm off to fantasise about what I'd do with it...!

namida

By the EV (expected value) strategy, it makes more sense to take the shot at a million. The reasoning is simple: one has a 100% chance of a 200,000 euro payoff (average winning: 200,000 euros), the other has a 50% chance of a 1,000,000 euro payoff (average winning: 500,000 euros). The chance-at-a-million, on average, leaves you 300,000 euros better off.

However, the EV strategy is tailored to long-term gambling, not a one-off huge shot. This affects how one would act. I definitely deviate a bit from EV-based strategy when there's an unusually high-value hand when I'm playing Poker. To be fair, I'm not the strongest adherent to it in the first place (maybe I am subconciously, but I don't actively try to figure out my EV, even as a rough estimate) - I've given consideration to it when figuring out what my general approaches would be, but I don't think about it while actually playing in most cases.

Ultimately, I think in this case - I would take the 200k, unless I was already a millionaire (or close to it) at the time. Play it safe. I'm not sure what lower-guaranteed-amount or higher-win-chance I'd need to tip that. I would definitely take a 50% shot at a million over 1000 euro, probably over 10,000 euro. At 50,000 I'm not so sure.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Simon

#250
Thanks! Yeah, the example was deliberately tailored to against the EV maximation strategy. The 200,000 is already so good a prize.

Still interesting to see the differences in how much certain cash makes the 50 % shot at the million unattractive. I assume it depends massively on job safety, expectations for personal development for the next years, current life problems, ...




Smoothening dice

We are designing a game involving dice. We want to generate a random integer between 3 and 18 inclusive. We would like to produce far more results in the middle of the range than we want to produce extreme values; i.e., we want 9, 10, 11, 12 to come up a lot, and 3, 4, 17, 18 to come up rarely.

Here are two procedures. Both are biased towards the desired middle values and against extreme values. Which of these is biased the most?

  • Roll three fair 15-sided dice, each with the numbers 3, 4, 5, ..., 18, then pick the middle outcome.
  • Roll three fair 6-sided dice, each with numbers 1, 2, ..., 6, then add the three outcomes.
Answer


Left diagram: Roll 15-sided die three times and pick the middle result. (1,000,000 trials)

Right diagram: Roll three 6-sided dice and add the results. (1,000,000 trials)

Thus, the sum of three 6-sided dice is better suited for our game design. This is handy because fair 15-sided prisms are hard to come by anyway.

Interesting that pick-middle-of-three seems to produce a parabola. Maybe there is a proof that it really produces this parabola. But I'm too tired! Have a good night.

-- Simon

Simon

#251
Sleep over it

For difficult tasks, start them, then go to bed and have a good night's sleep. Subconciousness will continue to attack the problem. This has two benefits the next morning:

  • You will have a better idea on how to continue, i.e., wise philosopher.
  • You want to rush to work to try the ideas, i.e., motivated guinea pig.
Rome wasn't built in a day.

Corollaries:
  • Don't ruin the sleep schedule for difficult work. You won't solve it within the next hour anyway, maybe not even within the same night. Not sleeping over it has opportunity costs.
  • With 1-2 spare hours in an evening, start the work, even if that's nowhere enough time to finish. Take for free the benefit of sleeping over it.
-- Simon

geoo

QuoteSubconciousness will continue to attack the problem. This has two benefits the next morning: [...]
For me this usually comes with the following downside in the evening though:

  • I lie in bed unable to fall asleep for an hour or two...

Which also breaks the two corollaries.

Maybe it works if you make sure to do something mellow and not exciting in the last hour before you go to bed.

mobius

I often have the problem of lying in bed for an hour...
QuoteMaybe it works if you make sure to do something mellow and not exciting in the last hour before you go to bed.

This is definitely usually true. They also say not looking at a computer screen an hour or so before bed helps a lot, (which nobody like us does that these days...). Also not listening to (loud) music or watching an exciting movie but reading a book or something like that (or puzzling/coding maybe?) would be better.

Wafflem showed me this app called "Flux" which eliminates certain blue colors in your screen which is supposed to help you get to sleep easier. Adjusting to the color of the screen took a bit but that wasn't bad.

------

Working/doing physical tasks while thinking about the problem may help. Years later I still remember solving Clam's level "Evacuating a retirement home" not while playing the game but while thinking about it at my old job taking apart crusty furniture. I knew I solved it too without evening having to test it out.
everything by me: https://www.lemmingsforums.net/index.php?topic=5982.msg96035#msg96035

"Not knowing how near the truth is, we seek it far away."
-Hakuin Ekaku

"I have seen a heap of trouble in my life, and most of it has never come to pass" - Mark Twain


Simon

Quote from: geooMaybe it works if you make sure to do something mellow and not exciting in the last hour before you go to bed.
Quote from: mobius on August 25, 2020, 01:15:01 AM
I often have the problem of lying in bed for an hour...

Yeah, you can't force the sleep. I assumed that the sleep came from regular bedtime or other genuine need to sleep.

The point is to not sacrifice regular/anticipated sleep for problem solving; instead, I consider the regular sleep part of the solving.

Quote from: mobius
Working/doing physical tasks while thinking about the problem may help.
Clam's level "Evacuating a retirement home"
I knew I solved it too without evening having to test it out.

Likely, physical activity allows the unconciousness to attack a problem similar to how sleep allows it.

Solving a Lemmings level offscreen without having to test it in the engine, that's really strong.

-- Simon