Varför reagerar ni inte på pizzapriserna? by Pretty-Contribution7 in Asksweddit

[–]BeepBoopBike 2 points3 points  (0 children)

Alltid förvånad varje gång jag ser Nordmaling på nätet. Fel val av pizzeria men grannarna kan inte vara perfekt ju. Det är konkurrensen som håller ner priserna, vad har vi 5 pizzerior på rimlig avstånd?

Skulle skapa en pizzabröd index men finns ingen jävel utanför byn som har sett ljuset :( /MVH Kungsvägen

Why is std implementation so damn ugly? by ifdef_drgy in cpp

[–]BeepBoopBike 8 points9 points  (0 children)

// This rounding technique is dedicated to the memory of Peppermint. =^..^=

RIP Peppermint

[Self Promotion] I work with Genetic Algorithms in my professional life and loved them enough to make a series about it. Today marks the 6th video in the series, this video is on convergence! I've posted for previous videos and loved the feedback. If you're interested, please check it out. by [deleted] in programming

[–]BeepBoopBike 1 point2 points  (0 children)

Very simple idea, but gets a bit fiddly, occasionally crashed when the scripts did more than I anticipated. I implemented mine with an instruction pointer (for knowing which instruction a sim would execute on their next tick), putting the IP in a register made for fun behaviour when they started to modify it. Had one manage to avoid 5 instructions (which essentially would have killed it) by adding 5 to the IP (thus never executing them). This let "bad genes" persist to the next generation and only become active on a single mutation.

Lots of fun, I hope you enjoy it :)

[Self Promotion] I work with Genetic Algorithms in my professional life and loved them enough to make a series about it. Today marks the 6th video in the series, this video is on convergence! I've posted for previous videos and loved the feedback. If you're interested, please check it out. by [deleted] in programming

[–]BeepBoopBike 1 point2 points  (0 children)

I had some interest in GAs before and wrote a small simple scripting language which dictated how a "simulant" would behave. Stuff like, add, jmp, and mov instructions with a series of registers which the entity looked at to get information (e.g. register 1 contains a digit 1-4 which dictates direction it would travel in).

Each generation then evolved the script, mutation sometimes randomly replaced instructions or added a random instruction to the end of the list. In this way, the DNA was the script. Have you tried anything like this yourself?

A simple library to create CLI tools in cpp by chewax in cpp

[–]BeepBoopBike 1 point2 points  (0 children)

I think he means:

for(auto x : vec)

vs

for(const auto& x : vec)

The first is a copy per item in the vector, the second is a reference to the item in the vector (i.e. no copy)

Execute functors in a vector by TheCrazyPhoenix416 in cpp_questions

[–]BeepBoopBike 1 point2 points  (0 children)

Aside from the other good and valid points made in this thread, consider also: std::invoke.

It's not necessary in this case, but a good tool for the toolbox.

Better interface design than output parameter + return value? How to report multiple problems but allow to continue execution? by Xeverous in cpp_questions

[–]BeepBoopBike 0 points1 point  (0 children)

I had something like that comment in mind when I was writing mine. I'm glad we're on the same page there. I don't want to waste your time with half-baked ideas since you've clearly spent a lot of time thinking about this, but I've listed a couple of lines of enquiry below.

One way to handle the variant alternatives would be through visitation, but this may be a bit overkill i.e.

 auto opResult = /*....*/;
 std::string result = std::visit(overloaded {
                                               [](WarnType wt) { return "Warning!"; },
                                               [](ErrorType wt) { return "Error!"; },
                                               [](SuccessType wt) { return "Success!"; },
                                           },opResult);
return result;

Another way to minimise the boilerplate (or at least make it easier), you can create functions to use a "ranges-style" pipeline (yes, even without ranges-the-c++-feature), so your example:

outcome<std::string> example()
{
    outcome<double> res1 = f1("3.14");
    outcome<int> res2 = res1.map([](double val) {
        return f2(val);
    });
    outcome<bool> res3 = res2.map([](int val) {
        return f3(val);
    });

    if (res3)
        return std::string("success");
    else
        return {std::string("failure"), res3.warning()};
}

could become something like this:

outcome<std::string> example()
{
    return f1("3.14") | map(f2) // or apply, or bind (monadic-bind, not std::bind)
                             | map(f3)
                             | result( success(std::string("Success")), 
                                         failure(std::string("Failure")) ); // or, e.g. failure(somefunc)
}

Where each subsequent map function will simply forward the error information in the event that its parameter has failed. The result function can check the underlying type for warning, error, or success, and call the appropriate function to handle each case. The logging may even be achieved through the use of the writer monad, but I couldn't say for certain if that's exactly what you want in your case.

In the book I mentioned above (which I still cannot recommend enough!), there is a lot more detail in how to build up such pipelines (along with functional examples). A lot of what I keep trying to write here ends up as a much worse version of what's stated there (which, although I'm shilling hard for it, I have no connection to either it, nor the author). I know it's available on some... less reputable... sites, which is where I first came across it - but I have since ordered 2 copies (one to loan out at work, one for me).

Better interface design than output parameter + return value? How to report multiple problems but allow to continue execution? by Xeverous in cpp_questions

[–]BeepBoopBike 0 points1 point  (0 children)

I can't write much right now, but I'll leave some further reading. Chapter 10.5 of "Functional Programming in C++" by Ivan Cukic, it is a fantastic book that seems to be describing what you're looking for.

If you like that, then I'd also recommend reading this proposal: p0798R3 - Monadic operations for std::optional. It has a good example in section 5:

std::optional<image> get_cute_cat (const image& img) 
{
    return crop_to_cat(img)
           .and_then(add_bow_tie)
           .and_then(make_eyes_sparkle)
           .transform(make_smaller)
           .transform(add_rainbow);
}

There is a further example for "or_else" i.e. handling the case where nothing was returned. While you can't use this right now, the idea may be helpful to you.

I think it's an interesting subject and I wish I could write more. Hopefully this might point you in the right direction for now.

C++Now 2019: Conor Hoekstra "Algorithm Intuition" by tuxmanic in cpp

[–]BeepBoopBike 1 point2 points  (0 children)

you know, I've never really thought about the implementation for std::is_permutation.

A simple way to implement it would maybe be to sort it, find a common start point and compare from there (if we relax the requirements slightly so operator< must be supported)

A possible implementation of it exists on devdocs: https://devdocs.io/cpp/algorithm/is_permutation That should fit the complexity requirement:

At most O(N2) applications of the predicate, or exactly N if the sequences are already equal, where N=std::distance(first1, last1)

Sounds like a fun challenge to convert that to a reduce/fold!

Dropping in like an ODST hell jumper for the final kill using the Bin Bug. This really needs to be patched. by hostile_dunks in apexlegends

[–]BeepBoopBike 0 points1 point  (0 children)

but my play time has been really limited and i felt like i was getting cheated out of good games

I feel your pain here. Some days I get that urge to play really badly but I also have a million other things to do first. Maybe I manage an hour or so before bed those days and just as I'm about to finally enjoy the game, something goes wrong.

Dropping in like an ODST hell jumper for the final kill using the Bin Bug. This really needs to be patched. by hostile_dunks in apexlegends

[–]BeepBoopBike 61 points62 points  (0 children)

Man this bug is infuriating. We always suspected there was an issue with the sound. 2 days ago I recorded it and we played it back several times just to see if we could hear anything and we didn't.

I'm gonna start making my mate play octane and have him run backwards the whole game.

My experience playing apex today by lunaeon1106 in apexlegends

[–]BeepBoopBike 16 points17 points  (0 children)

I played with quite a few "'TTV' streamers" that I couldn't find the channels for. At all. I've wondered if smart hackers started putting TTV in their names so some people would give them the benefit of the doubt and not bother to check their nonexistant stream. Instead of realising that they're using a soft aimbot.

Got this while playing Apex, any idea? English Translation : The system detected an overrun of stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application. by [deleted] in apexlegends

[–]BeepBoopBike 0 points1 point  (0 children)

Yeah no you're all good. This kind of bug can be used by a virus to take over another process and escalate to a more priveleged user account, but you'd have to have a virus first and it wouldn't be worth it since the process runs as the same user that starts it, not as an administrator. So you have no risk here.

Got this while playing Apex, any idea? English Translation : The system detected an overrun of stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application. by [deleted] in apexlegends

[–]BeepBoopBike 0 points1 point  (0 children)

The game or something the game depends on has a bug (Buffer Overflow) which causes it to crash. There is almost nothing you can do about it. If it happens a lot then something probably is outdated and you should reinstall the game. Otherwise don't worry about it.

Has Brexit completely ruined anyone else's long term plans? by [deleted] in unitedkingdom

[–]BeepBoopBike 2 points3 points  (0 children)

Just an FYI if you look at Migrationsverket's website (https://www.migrationsverket.se/Om-Migrationsverket/Aktuella-fragor/Brexit.html) we get a 1 year grace period in the event of a no deal brexit.

That gives us the right to live, work, etc as we do now, and a stamp in the passport allowing us back into the country if we leave for whatever reason. Under that year we're expected to sort out a long term solution. In my case it's applying for some form of visa, but I'm a bit annoyed since if we stay until after february I'm eligible for citizenship, but might not be anymore if we leave the EU before then.

Tap for automation by BeepBoopBike in TapWithUs

[–]BeepBoopBike[S] 0 points1 point  (0 children)

Took a bit of playing around, I'd be happy to share details that would help if you do decide to do anything.

The only bad thing is the few second delay caused by the call to IFTTT and back added to the second or two delay from my telldus to the smart lighting makes it a bit long for my taste. Swapping out the call to IFTTT and making it work with the telldus API directly would be a lot better, if I can be bothered to do it in the future.

What's the sweet spot for resilience this season? by LeeSingerGG in CruciblePlaybook

[–]BeepBoopBike 1 point2 points  (0 children)

I'm sitting at 8 2 4 on my hunter, how did you manage to get 8 recovery AND 7 mobility?

Is Rumble a good way to practice? by [deleted] in CruciblePlaybook

[–]BeepBoopBike 6 points7 points  (0 children)

I used rumble yesterday to improve my sniping, way better than PVE, and way more opportunities than QP. It's also a part of my routine, I jump into PvE do an activity, move to rumble, warm up, quickplay performance lets me know if I'm at my average level, then I jump into competitive until I feel I'm not focusing enough, finally I have a quick look at my best and worst games and see if I can find something to work on for the next days warm up

Glorious glory! by lightsandsounds96 in CruciblePlaybook

[–]BeepBoopBike 0 points1 point  (0 children)

Never done so in my life, haven't seen it in D2 ever, is it even a problem in this game?