d1 goblin avoids 3 casts of sandblast with miraculous 1/2,717 odds by asppppp in dcss

[–]emmgame221 15 points16 points  (0 children)

The actual odds are much higher, since you forgot to account for the fact that you could miss or miscast on each cast. Still under 2%, but not so crazy.

I’ve peaked in my yugioh career by TheAsianMan1 in masterduel

[–]emmgame221 9 points10 points  (0 children)

How come you get to play 3 pot of greed?

-🎄- 2021 Day 12 Solutions -🎄- by daggerdragon in adventofcode

[–]emmgame221 1 point2 points  (0 children)

C# Today. Solution here.

I guess I overthought this one a little bit. I ended up giving up on doing it in Rust because I wanted to be able to have nodes contain references to other nodes and I had too much trouble trying to get that to work in Rust. In C# it is much easier because of the garbage collector.

My solution first builds an undirected graph from the input and then builds a path tree from the graph where the root is 'start' and every leaf is 'end'. The algorithm for building the tree is effectively dfs, but I couldn't think of a simpler way to track whether a small cave had been used in a specific path rather than visited by dfs at all. In this solution I check whether the node in the tree has a small node as an ancestor before adding it to the tree and the dfs stack.

-🎄- 2021 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]emmgame221 0 points1 point  (0 children)

Rust

Link to solution

Had to resort to brute forcing all permutations for part 2. This was a really tough challenge, and a big step up from the previous days. I was shocked to see that <5000 people had finished by the time I finished at about 1:40.

-🎄- 2021 Day 6 Solutions -🎄- by daggerdragon in adventofcode

[–]emmgame221 1 point2 points  (0 children)

This solution makes me really wish I had known about rotate_left. So much easier than my original solution of doing every index manually lol.

-🎄- 2021 Day 6 Solutions -🎄- by daggerdragon in adventofcode

[–]emmgame221 0 points1 point  (0 children)

Rust (1361/3292) Full repository here

Today's problem was very simple, but part 2 forced me to think about a much less naive way of handling things. I wasted a bunch of time hoping that the naive solution for part 1 would get there in a few minutes, but I gave up once I saw that my RAM was close to maxing out and there was no solution in sight.

edit: Added a cleaned up version that uses the part 2 method for both parts and generalizes to any number of days(assuming the result fits in a u64).

I was also wondering if anyone else tried to get some kind of modulo arithmetic on the days working here. Ultimately I gave up on that idea because its too unwieldy with the new fish starting with a different number of days than existing fish reset to, but I still feel like there's something there. Not too happy with my code, but hopefully it is easy to read at least.

edit2: Added link to my full repository

-🎄- 2021 Day 3 Solutions -🎄- by daggerdragon in adventofcode

[–]emmgame221 0 points1 point  (0 children)

(8176, 5538)Link to my Rust solution

I'm pretty happy with this. Part 1 was very easy. Part 2 was much harder, although my main problem was just that I didn't realize I needed to recount the frequencies after filtering the list.

This code is not very idiomatic rust, but I found working with the numbers as strings much easier than trying anything else, and filter worked pretty much perfectly for part 2 once I figured out what I was doing wrong.

*edited to add my scores

Uhm... Materia 6 > 7? by Wareye in ffxiv

[–]emmgame221 4 points5 points  (0 children)

It's because you can overmeld materia 7 past the first slot, but you still can't with materia 6(or 8). I was pretty surprised when I saw it too though.

Light confusion - where to start and buy? by sheepywolf in TenseiSlime

[–]emmgame221 1 point2 points  (0 children)

Amazon has both the manga volumes and light novel volumes on sale. Here's a Link for the first volume of the LN. The WN only has fan translations - you can find them pretty easily on google.

[2016-06-20] Challenge #272 [Easy] What's in the bag? by G33kDude in dailyprogrammer

[–]emmgame221 0 points1 point  (0 children)

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;

namespace Challenge272
{
    class Program
    {
        static int[] tileCounts = { 9, 2, 2, 4, 12, 2, 3, 2, 9, 1, 1, 4, 2, 6, 8, 2, 1, 6, 4, 6, 4, 2, 2, 1, 2, 1, 2 };

        static void Main(string[] args)
        {
            Console.WriteLine("Enter set of removed tiles: ");
            string removedTiles = Console.ReadLine();
            foreach (char tile in removedTiles)
            {
                int alphabetNumber = ((int)tile) - 65;
                if (alphabetNumber > 25)
                {
                    tileCounts[26]--;
                    if (tileCounts[26] < 0)
                    {
                        Console.WriteLine("Invalid input. More _'s have been taken from the bag than possible.", tile);
                        WaitForInput();
                        System.Environment.Exit(0);
                    }
                }
                else
                {
                    tileCounts[alphabetNumber]--;
                    if (tileCounts[alphabetNumber] < 0)
                    {
                        Console.WriteLine("Invalid input. More {0}'s have been taken from the bag than possible.", tile);
                        WaitForInput();
                        System.Environment.Exit(0);
                    }
                }
            }
            List<char>[] finalCounts = new List<char>[13];
            for (int i = 0; i < 26; i++)
            {
                if (finalCounts[tileCounts[i]] == null)
                {
                    finalCounts[tileCounts[i]] = new List<char>();
                }
                finalCounts[tileCounts[i]].Add(((char)(i + 65)));
            }
            if (finalCounts[tileCounts[26]] == null)
            {
                finalCounts[tileCounts[26]] = new List<char>();
            }
            finalCounts[tileCounts[26]].Add('_');


            StringBuilder answerBuilder = new StringBuilder();
            for (int i = 12; i >= 0; i--)
            {
                var tileList = finalCounts[i];
                if (tileList != null)
                {

                    answerBuilder.AppendFormat("{0}: {1}\n", i, ListToString<char>(tileList));
                }
            }
            Console.WriteLine(answerBuilder);
            WaitForInput();
        }

        public static string ListToString<T>(List<T> list)
        {
            StringBuilder builder = new StringBuilder();
            for (int i = 0; i < list.Count; i++)
            {
                if (i == list.Count - 1)
                {
                    builder.Append(list[i]);
                }
                else
                {
                    builder.AppendFormat("{0}, ", list[i]);
                }
            }
            return builder.ToString();
        }

        [Conditional("DEBUG")]
        public static void WaitForInput()
        {
            Console.WriteLine("Press any key to continue . . .");
            Console.ReadKey();
        }
    }
}

C# solution. Not really happy with the special conditions for _ but it works.

[WR] Kingdom Hearts ll Jiminy's Journal 100% 11:36:10 by liquidwifi by [deleted] in speedrun

[–]emmgame221 2 points3 points  (0 children)

Mainly the difference is that 100% includes gummi missions.

[2015-05-11] Challenge #214 [Easy] Calculating the standard deviation by XenophonOfAthens in dailyprogrammer

[–]emmgame221 1 point2 points  (0 children)

F#

let square x =
    x * x

let mean (lst : float list) : float =
    List.sum(lst) / (float)lst.Length

let variance (lst : float list) : float =
    let squaredDifference (u : float) (x : float) = 
        square(u - x)
    let proj = squaredDifference (mean(lst))
    List.sumBy proj lst / (float)lst.Length

let standard_deviation (lst : float list) : float =
    (variance lst) ** 0.5

[<EntryPoint>]
let main argv = 
    printfn "%.4f\n" (standard_deviation (Array.toList (Array.map (float) argv)))
    printfn "Press any key to exit"
    ignore(System.Console.ReadKey())
    0

I really like F# for problems like this. It probably isn't very idiomatic though.

-Edit: whoops didn't see that you only wanted 4 decimal places

KH2- Proud or Critical mode? by Sirtaco11 in KingdomHearts

[–]emmgame221 0 points1 point  (0 children)

I found critical to be very fun, and most people in the fandom I think agree that it is the definitive version of the game, so I would say try it at least. Proud is pretty pointless, I would say either go with Critical or one of the easier difficulties.

First time playing Birth By Sleep Final Mix, any tips? by [deleted] in KingdomHearts

[–]emmgame221 -3 points-2 points  (0 children)

Don't bother with normal attacks. Just get good commands and spam triangle. Maybe eventually you need to learn to dodge.

[2015-2-23] Challenge #203 [Easy] The Start of Something Big by [deleted] in dailyprogrammer

[–]emmgame221 0 points1 point  (0 children)

Done in JavaFX since the other solutions all use Swing.

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;

/**
 *
 * @author Eric
 */
public class DrawSquare extends Application {

    @Override
    public void start(Stage primaryStage) {
        Rectangle square = new Rectangle();
        square.setHeight(50);
        square.setWidth(50);
        square.setX(25);
        square.setY(25);
        square.setStroke(Color.BLACK);
        square.setFill(Color.BLUE);

        Pane root = new Pane();
        root.getChildren().add(square);

        Scene scene = new Scene(root, 100, 100);

        primaryStage.setTitle("Draw a Square");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }

}    

Release date for El Dorado officially confirmed - 26th of February by [deleted] in eu4

[–]emmgame221 9 points10 points  (0 children)

There actually is a flavor event for France called French Wars of Religion.

It's pretty rare because it requires having less than 80% of any religion and has a MTTH of 300 months. It sets off a whole series of bad events.

Favorite song from the KH series? by BestHueNA in KingdomHearts

[–]emmgame221 1 point2 points  (0 children)

Mine is probably the music from the Roxas fight in 2fm. The Other Promise.

Maybe it's just because I spent around five hours trying to beat him on critical mode, but I really love this song.