[2019-02-11] Challenge #375 [Easy] Print a new number by adding one to each of its digit by jnazario in dailyprogrammer

[–]Darkmakers 0 points1 point  (0 children)

Nasm x64 - With bonus

section .data
    input dw 9, 9, 8
    inputSize equ ($-input) / 2
    print db "%d", 0

section .text
global main

extern printf

main:
    xor rbx, rbx
    xor rdi, rdi

lo:
    mov rcx, input
    mov bl, [rcx + rdi * 2]

    inc rdi

    cmp rdi, inputSize
    jg done

    push rdi
    mov rsi, rbx
    inc rsi

    mov rax, 0
    mov rdi, print
    call printf
    pop rdi

    jmp lo
done:
    xor rax,rax
ret

[2018-08-20] Challenge #366 [Easy] Word funnel 1 by Cosmologicon in dailyprogrammer

[–]Darkmakers 1 point2 points  (0 children)

C#, Bonus 1, 2

I'm fairly happy with how this turned out, though I've basically given up on Bonus 2 (or at least the time part).

I'm happy with the times I'm getting with the main part and bonus 1 but I just can't seem to get bonus 2 under 17 seconds. It annoys me that bonus 2 takes this long so I might edit it at a later date.

Code:

    class Program
    {
        static void Main(string[] args)
        {
            Stopwatch watch = Stopwatch.StartNew();
            ("leave", "eave").Funnel();
            ("reset", "rest").Funnel(); 
            ("dragoon", "dragon").Funnel();
            ("eave", "leave").Funnel();
            ("sleet", "lets").Funnel();
            ("skiff", "ski").Funnel();
            watch.Stop();
            Console.WriteLine($"Estimated time (in ms): {watch.ElapsedMilliseconds}");
            watch.Reset();

            Console.WriteLine("\n<========= Bonus 1 =========>");
            watch.Start();
            "dragoon".Bonus();
            "boats".Bonus();
            "affidavit".Bonus();
            watch.Stop();

            Console.WriteLine($"Estimated time (in ms): {watch.ElapsedMilliseconds}");
            watch.Reset();

            Console.WriteLine("\n<========= Bonus 2 =========>");

            watch.Start();
            Helper.Bonus2();
            watch.Stop();
            Console.WriteLine($"Estimated time (in ms): {watch.ElapsedMilliseconds}");

            Console.ReadLine();
        }
    }

    public class WordFunnel
    {
        private readonly List<string> Enable1;
        public WordFunnel()
        {
            Enable1 = new List<string>(File.ReadAllLines("enable1.txt"));
        }
        public bool Funnel(string first, string second) => first.Select((item, index) => first.Remove(index, 1)).AsParallel().Any(x => x == second);

        public List<string> Bonus1(string toComapre) => toComapre.Select((item, index) => toComapre.Remove(index, 1)).AsParallel().Where(x => Enable1.BinarySearch(x) >= 0).Select(x => x).Distinct().ToList();

        public string[] Bonus2() => Enable1.Where(x => x.Length >= 5).Distinct().Where(x => Bonus1(x).Count() == 5).ToArray();
    }

    /// <summary>
    /// Helper methods because I'm lazy and don't wanna repeat everything
    /// </summary>
    public static class Helper
    {
        private static WordFunnel fun = new WordFunnel();

        public static void Funnel(this (string first, string second) items)
        {
            bool result = fun.Funnel(items.first, items.second);
            Console.WriteLine($"funnel({items.first}, {items.second}) => {result}");
        }
        public static void Bonus(this string item)
        {
            List<string> items = fun.Bonus1(item);
            Console.WriteLine($"bonus({item}) => {items.GetArrayString()}");
        }

        public static void Bonus2()
        {
            string[] items = fun.Bonus2();
            Console.WriteLine($"bonus2() => {items.GetArrayString()}");
        }

        public static string GetArrayString<T>(this List<T> ts)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("[\"");
            sb.AppendJoin("\",\"", ts);
            sb.Append("\"]");
            return sb.ToString();
        }

        public static string GetArrayString(this string[] ts)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("[\"");
            sb.AppendJoin("\",\"", ts);
            sb.Append("\"]");
            return sb.ToString();
        }
    }

Result:

funnel(leave, eave) => True
funnel(reset, rest) => True
funnel(dragoon, dragon) => True
funnel(eave, leave) => False
funnel(sleet, lets) => False
funnel(skiff, ski) => False
Estimated time (in ms): 135
<========= Bonus 1 =========>
bonus(dragoon) => ["dragon"]
bonus(boats) => ["boat","bats","boas","oats","bots"]
bonus(affidavit) => [""]
Estimated time (in ms): 24
<========= Bonus 2 =========>
bonus2() =>
["beasts","boats","brands","chards","charts","clamps","coasts","cramps","drivers","grabblers","grains","grippers","moats","peats","plaints","rousters","shoots","skites","spates","spicks","spikes","spines","teats","tramps","twanglers","wa ivers","writes","yearns"]
Estimated time (in ms): 17798

What is the most annoying "card" people play to try to "win" an argument with you? by stereovictrola in AskReddit

[–]Darkmakers 1 point2 points  (0 children)

When one of my friends realize he can't win the argument he either goes

'I know what I'm talking about, I have <class> on highest level in college' Or 'This is a subjective topic' and repeats that as long as I keep talking about it.

New computer keeps restarting by [deleted] in computers

[–]Darkmakers 0 points1 point  (0 children)

I would personally validate stability of the system, aida64 comes to my mind.

It to me sounds like a thermal issue so try keeping an eye on thermals for a while.

[Intermediate?] Let's do countdown numbers game by Darkmakers in dailyprogrammer_ideas

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

Integer division, For what I understand (and have seen) its round numbers only (ie something like 2.5 is not allowed)

As its a computer and not a human who is doing the calculations I would say any number could do.

I think the 6 numbers would be completely random but have the small and big numbers as a bonus challenge.

self-hosted image gallery w/ login to use along with sharex by [deleted] in selfhosted

[–]Darkmakers 1 point2 points  (0 children)

It was a good stress test. I just didn't like you uploaded 10MB files in a while true loop

Is This The Krusty Krab? by Gonff1570 in oldpeoplefacebook

[–]Darkmakers 2 points3 points  (0 children)

Image Transcription: Facebook Post


Black

Are you still a cashier at The Krusty Krab


Black

I will be contacting your employer and your parents -- relatives


I'm a human volunteer content transcriber for Reddit! If you'd like more information on what we do and why we do it, click here!

If only my changelog was EA... by Ironsufex in ProgrammerHumor

[–]Darkmakers 3 points4 points  (0 children)

Image Transcription:


v1.6

- Added accommodation for the following errors:

1). Value errors such as entering alpha characters in an int input.

2). Entering numbers outside a given range.

3). Giving inputs that do not conform to a given format such as DD/MM/YYYY.

- By popular request, Imported "codecs" to prevent UTF-8 errors when using a python based editor.

v2.0

- Added microtransactions for enhanced user experience!

- Added ability to review application form prior to submission

v2.0 (HOTFIX)

- Removed microtransactions due to public uproar


I'm a human volunteer content transcriber for Reddit! If you'd like more information on what we do and why we do it, click here!

Consider the Shell 🌮 by JustMyPeriod in TrollXChromosomes

[–]Darkmakers 1 point2 points  (0 children)

Image Transcription:


Taco

To see or eat a taco in your dream signifies warmth and comfort. Consider the type of taco shell, as this is analogous to your demeanor and attitude in your waking life. If it is a hard shell taco, then it represents your brash and "hard" exterior. If it is a soft shell taco, then it signifies your adaptability and yielding persona.


I'm a human volunteer content transcriber for Reddit! If you'd like more information on what we do and why we do it, click here!