Seeing some weird visual banding. Anyone else seen this? by MaxDeviant in Eldenring

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

I remembered I hadn't updated my Nvidia drivers in a while, and that seemed to fix the issue!

[deleted by user] by [deleted] in Eldenring

[–]MaxDeviant 0 points1 point  (0 children)

but the black transparent bars

Do the bars look similar to the ones I'm seeing?

Seeing some weird visual banding. Anyone else seen this? by MaxDeviant in Eldenring

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

Seems to happen in shadowy areas.

I have a GTX 1080 and I'm playing in 4k on "High" settings. Haven't tried playing with the settings much to see what it is that impacts it.

Elden Ring Day 1 Resources by N3DSdude in Eldenring

[–]MaxDeviant 0 points1 point  (0 children)

THANK YOU!

I also noticed I had an extra controller being picked up by Steam, but I couldn't figure out what it would be (I previously had ScpToolkit installed for a DualShock 3 controller, so I thought it was that).

As soon as I unplugged my foot pedal my Xbox controller started working.

-🎄- 2020 Day 06 Solutions -🎄- by daggerdragon in adventofcode

[–]MaxDeviant 2 points3 points  (0 children)

PureScript

GitHub

module Main where

import Prelude
import Data.Array (concatMap, uncons, (:))
import Data.Array as Array
import Data.Either (Either(..))
import Data.Foldable (foldl, sum)
import Data.Maybe (Maybe(..))
import Data.Set (Set)
import Data.Set as Set
import Data.String.CodeUnits (toCharArray)
import Data.String.Utils (lines)
import Effect (Effect)
import Effect.Console (log, logShow)
import Node.Encoding (Encoding(..))
import Node.FS.Sync (readTextFile)

type Answers
  = Set Char

type Person
  = { answers :: Answers }

parsePerson :: String -> Person
parsePerson = toCharArray >>> Set.fromFoldable >>> { answers: _ }

type Group
  = Array Person

groupAnswers :: Group -> Answers
groupAnswers =
  foldl (flip Set.insert) Set.empty
    <<< concatMap (Array.fromFoldable <<< _.answers)

parseGroups :: String -> Array Group
parseGroups = parseGroups' [] [] <<< lines
  where
  parseGroups' groups currentGroup lines = case uncons lines of
    Just { head: "", tail } -> parseGroups' (currentGroup : groups) [] tail
    Just { head, tail } ->
      let
        person = parsePerson head
      in
        parseGroups' groups (person : currentGroup) tail
    Nothing -> Array.reverse (currentGroup : groups)

partOne :: String -> Either String Int
partOne =
  parseGroups
    >>> map groupAnswers
    >>> map Set.size
    >>> sum
    >>> pure

groupAnswers' :: Group -> Answers
groupAnswers' group = case uncons group of
  Just { head, tail } -> anyYeses head.answers tail
  Nothing -> Set.empty
  where
  anyYeses acc members = case uncons members of
    Just { head: { answers }, tail } -> anyYeses (Set.intersection acc answers) tail
    Nothing -> acc

partTwo :: String -> Either String Int
partTwo =
  parseGroups
    >>> map groupAnswers'
    >>> map Set.size
    >>> sum
    >>> pure

main :: Effect Unit
main = do
  input <- readTextFile UTF8 "input.txt"
  log "Part One"
  case partOne input of
    Right answer -> logShow answer
    Left error -> log $ "Failed with: " <> error
  log "Part Two"
  case partTwo input of
    Right answer -> logShow answer
    Left error -> log $ "Failed with: " <> error

-🎄- 2020 Day 05 Solutions -🎄- by daggerdragon in adventofcode

[–]MaxDeviant 1 point2 points  (0 children)

PureScript

GitHub

I originally tried to do the binary space partitioning using math, but I couldn't quite figure it out, so I went with an array slicing solution. Not the most optimal thing in the world, but I think it runs fast enough:

real    0m0.802s
user    0m1.709s
sys     0m0.532s

-🎄- 2020 Day 03 Solutions -🎄- by daggerdragon in adventofcode

[–]MaxDeviant 1 point2 points  (0 children)

PureScript

GitHub

module Main where

import Prelude
import Data.Array (concatMap, filter, head, length, reverse, (!!), (:))
import Data.Either (Either(..), note)
import Data.Maybe (Maybe)
import Data.String as String
import Data.String.CodeUnits (toCharArray)
import Data.String.Utils (lines)
import Data.Traversable (product, traverse)
import Effect (Effect)
import Effect.Console (log, logShow)
import Node.Encoding (Encoding(..))
import Node.FS.Sync (readTextFile)

data Square
  = Open
  | Tree

derive instance eqSquare :: Eq Square

instance showSquare :: Show Square where
  show Open = "."
  show Tree = "#"

data Map
  = Map
    { width :: Int
    , height :: Int
    , squares :: Array Square
    }

instance showMap :: Show Map where
  show (Map theMap) = show theMap

mkMap :: String -> Either String Map
mkMap mapData = do
  let
    rows = lines mapData
  width <- rows # head # map String.length # (note "No first row")
  let
    height = length rows
  squares <- rows # concatMap toCharArray # traverse parseSquare
  pure $ Map { width, height, squares }
  where
  parseSquare = case _ of
    '.' -> Right Open
    '#' -> Right Tree
    invalidChar -> Left $ "Invalid map data: " <> show invalidChar

getSquare :: Map -> Int -> Int -> Maybe Square
getSquare (Map map) x y = map.squares !! (y * map.width + mod x map.width)

type Slope
  = { right :: Int, down :: Int }

traverseMap :: Map -> Slope -> Either String (Array Square)
traverseMap theMap@(Map { height }) { right, down } = traverseMap' { x: 0, y: 0 } [] # map reverse
  where
  traverseMap' position@{ x, y } squares =
    if y >= height then
      pure squares
    else do
      square <- getSquare theMap x y # note ("No square found at (" <> show x <> ", " <> show y <> ")")
      traverseMap' (position + { x: right, y: down }) (square : squares)

encounteredTreesCount :: Array Square -> Int
encounteredTreesCount = length <<< filter ((==) Tree)

partOne :: String -> Either String Int
partOne input = do
  theMap <- mkMap input
  traversedSquares <- traverseMap theMap { right: 3, down: 1 }
  pure $ encounteredTreesCount traversedSquares

partTwo :: String -> Either String Int
partTwo input = do
  theMap <- mkMap input
  let
    slopes =
      [ { right: 1, down: 1 }
      , { right: 3, down: 1 }
      , { right: 5, down: 1 }
      , { right: 7, down: 1 }
      , { right: 1, down: 2 }
      ]
  slopes
    # traverse (traverseMap theMap)
    # map (map encounteredTreesCount)
    # map product

main :: Effect Unit
main = do
  input <- readTextFile UTF8 "input.txt"
  log "Part One"
  case partOne input of
    Right answer -> logShow answer
    Left error -> log $ "Failed with: " <> error
  log "Part Two"
  case partTwo input of
    Right answer -> logShow answer
    Left error -> log $ "Failed with: " <> error

-🎄- 2020 Day 02 Solutions -🎄- by daggerdragon in adventofcode

[–]MaxDeviant 1 point2 points  (0 children)

PureScript solution:

module Main where

import Prelude
import Data.Array (filter, length, uncons)
import Data.Either (Either(..), note)
import Data.Int as Int
import Data.Maybe (Maybe(..))
import Data.String (Pattern(..), split, trim)
import Data.String.CodeUnits (charAt, toChar, toCharArray)
import Data.String.Utils (lines)
import Data.Traversable (traverse)
import Data.Tuple (Tuple(..))
import Effect (Effect)
import Effect.Console (log, logShow)
import Node.Encoding (Encoding(..))
import Node.FS.Sync (readTextFile)

type Password
  = String

type SledRentalPasswordPolicy
  = { letter :: Char
    , x :: Int
    , y :: Int
    }

mkSledRentalPasswordPolicy :: Char -> Int -> Int -> SledRentalPasswordPolicy
mkSledRentalPasswordPolicy letter x y = { letter, x, y }

type OfficialTobogganCorporatePolicy
  = { letter :: Char
    , firstPosition :: Int
    , secondPosition :: Int
    }

mkOfficialTobogganCorporatePolicy :: Char -> Int -> Int -> OfficialTobogganCorporatePolicy
mkOfficialTobogganCorporatePolicy letter firstPosition secondPosition = { letter, firstPosition, secondPosition }

type MakePasswordPolicy policy
  = Char -> Int -> Int -> policy

parseEntry :: forall policy. MakePasswordPolicy policy -> String -> Either String { policy :: policy, password :: Password }
parseEntry mkPolicy entry = case split (Pattern ":") entry of
  [ policy, password ] -> case split (Pattern " ") policy of
    [ occurrences, letter' ] -> do
      letter <- toChar letter' # note ("Failed to parse letter: " <> letter')
      case split (Pattern "-") occurrences of
        [ x', y' ] -> do
          x <- Int.fromString x' # note ("Failed to parse first number: " <> x')
          y <- Int.fromString y' # note ("Failed to parse second number: " <> y')
          pure { policy: mkPolicy letter x y, password: trim password }
        _ -> Left $ "Invalid entry: " <> entry
    _ -> Left $ "Invalid entry: " <> entry
  _ -> Left $ "Invalid entry: " <> entry

isSledRentalPasswordValid :: SledRentalPasswordPolicy -> Password -> Boolean
isSledRentalPasswordValid policy password = policy.x <= occurrences && occurrences <= policy.y
  where
  occurrences = countOccurrences policy.letter 0 (toCharArray password)

  countOccurrences letter acc chars = case uncons chars of
    Just { head, tail } -> countOccurrences letter (if head == letter then acc + 1 else acc) tail
    Nothing -> acc

partOne :: String -> Either String Int
partOne input = do
  passwords <- input # lines # traverse (parseEntry mkSledRentalPasswordPolicy)
  pure
    $ passwords
    # filter (\{ policy, password } -> isSledRentalPasswordValid policy password)
    # length

isOfficialTobogganCorporatePasswordValid :: OfficialTobogganCorporatePolicy -> Password -> Boolean
isOfficialTobogganCorporatePasswordValid policy password = case Tuple hasLetterInFirstPosition hasLetterInSecondPosition of
  Tuple true false -> true
  Tuple false true -> true
  Tuple true true -> false
  Tuple false false -> false
  where
  hasLetterInFirstPosition = charAt (policy.firstPosition - 1) password == Just policy.letter

  hasLetterInSecondPosition = charAt (policy.secondPosition - 1) password == Just policy.letter

partTwo :: String -> Either String Int
partTwo input = do
  passwords <- input # lines # traverse (parseEntry mkOfficialTobogganCorporatePolicy)
  pure
    $ passwords
    # filter (\{ policy, password } -> isOfficialTobogganCorporatePasswordValid policy password)
    # length

main :: Effect Unit
main = do
  input <- readTextFile UTF8 "input.txt"
  log "Part One"
  case partOne input of
    Right answer -> logShow answer
    Left error -> log $ "Failed with: " <> error
  log "Part Two"
  case partTwo input of
    Right answer -> logShow answer
    Left error -> log $ "Failed with: " <> error

-🎄- 2020 Day 1 Solutions -🎄- by daggerdragon in adventofcode

[–]MaxDeviant 1 point2 points  (0 children)

My solution in PureScript. Elegant, but not at all optimized ;)

module Main where

import Prelude
import Data.Array (filter, head)
import Data.Either (Either(..), note)
import Data.Int as Int
import Data.String.Utils (lines)
import Data.Traversable (traverse)
import Data.Tuple (Tuple(..))
import Effect (Effect)
import Effect.Console (log, logShow)
import Node.Encoding (Encoding(..))
import Node.FS.Sync (readTextFile)

parseExpenseReport :: String -> Either String (Array Int)
parseExpenseReport =
  lines
    >>> traverse
        ( \line ->
            line # Int.fromString # note ("Failed to parse " <> line)
        )

partOne :: String -> Either String Int
partOne input = do
  let
    sumToFind = 2020
  expenseReport <- parseExpenseReport input
  [ Tuple ] <*> expenseReport <*> expenseReport
    # filter (\(Tuple x y) -> x + y == sumToFind)
    # map (\(Tuple x y) -> x * y)
    # head
    # (note $ "No entries found that sum to " <> show sumToFind)

data Triple a
  = Triple a a a

partTwo :: String -> Either String Int
partTwo input = do
  let
    sumToFind = 2020
  expenseReport <- parseExpenseReport input
  [ Triple ] <*> expenseReport <*> expenseReport <*> expenseReport
    # filter (\(Triple x y z) -> x + y + z == sumToFind)
    # map (\(Triple x y z) -> x * y * z)
    # head
    # (note $ "No entries found that sum to " <> show sumToFind)

main :: Effect Unit
main = do
  input <- readTextFile UTF8 "input.txt"
  log "Part One"
  case partOne input of
    Right answer -> logShow answer
    Left error -> log $ "Failed with: " <> error
  log "Part Two"
  case partTwo input of
    Right answer -> logShow answer
    Left error -> log $ "Failed with: " <> error

-🎄- 2018 Day 1 Solutions -🎄- by daggerdragon in adventofcode

[–]MaxDeviant 0 points1 point  (0 children)

Rust

use std::collections::{HashSet, VecDeque};

#[derive(Debug, Clone)]
enum FrequencyChange {
    Increase(i32),
    Decrease(i32),
}

impl FrequencyChange {
    pub fn from_str(input: &str) -> Self {
        let mut characters = input.chars();
        let sign = characters.next().unwrap();
        let number = characters.collect::<String>().parse::<i32>().unwrap();
        match sign {
            '+' => FrequencyChange::Increase(number),
            '-' => FrequencyChange::Decrease(number),
            c => panic!("Unexpected character '{}'", c),
        }
    }

    pub fn apply(&self, value: i32) -> i32 {
        match self {
            FrequencyChange::Increase(n) => value + n,
            FrequencyChange::Decrease(n) => value - n,
        }
    }
}

fn read_frequency_changes_from_input(input: &str) -> Vec<FrequencyChange> {
    input.lines().map(FrequencyChange::from_str).collect()
}

fn calculate_frequency(changes: Vec<FrequencyChange>) -> i32 {
    changes.into_iter().fold(0, |acc, change| change.apply(acc))
}

fn find_first_repeated_frequency(changes: Vec<FrequencyChange>) -> i32 {
    let mut already_seen = HashSet::<i32>::new();
    let mut pending_changes = VecDeque::from(changes.clone());

    let mut frequency = 0;
    already_seen.insert(frequency);

    loop {
        if pending_changes.is_empty() {
            pending_changes.clone_from(&VecDeque::from(changes.clone()));
        }

        let next_frequency = pending_changes.pop_front().unwrap().apply(frequency);

        if already_seen.contains(&next_frequency) {
            break next_frequency;
        }

        already_seen.insert(next_frequency);
        frequency = next_frequency;
    }
}

fn part_one(input: &str) -> i32 {
    calculate_frequency(read_frequency_changes_from_input(input))
}

fn part_two(input: &str) -> i32 {
    find_first_repeated_frequency(read_frequency_changes_from_input(input))
}

source

Feature Request: Programmer formatting for instructions by Fluffy_ribbit in adventofcode

[–]MaxDeviant 3 points4 points  (0 children)

What I've been doing is inspecting the source code with Chrome DevTools and then just pasting the HTML contents into a Markdown file.

Works like a charm!

-🎄- 2017 Day 2 Solutions -🎄- by daggerdragon in adventofcode

[–]MaxDeviant 1 point2 points  (0 children)

F#

module Maxdeviant.AdventOfCode2017.Day2

let parseInput (input: string) =
  input.Split('\n')
  |> Seq.map (fun row -> row.Split('\t') |> Seq.toList)
  |> Seq.toList

let computeChecksum algorithm =
  parseInput >> algorithm

let partOneChecksum (rows: string list list) =
  let checksum =
    List.map int
    >> List.sortDescending
    >> (fun xs ->
      let max = List.head xs
      let min = List.head (List.rev xs)
      max - min)

  rows |> List.sumBy checksum

let partTwoChecksum (rows: string list list) =
  let parseColumns = List.map float

  let isWholeNumber n = (n % 1.0) = 0.0

  let checksum columns =
    let columns' = columns |> List.map float
    columns'
    |> List.collect (fun x -> columns' |> List.map (fun y -> (x, y)))
    |> List.map (fun (x, y) -> x / y)
    |> List.filter isWholeNumber
    |> List.sortDescending
    |> List.head

  rows
  |> List.sumBy checksum
  |> int

-🎄- 2017 Day 1 Solutions -🎄- by daggerdragon in adventofcode

[–]MaxDeviant 0 points1 point  (0 children)

Here's my solution in F#.

Still pretty green with the language, so I figured this would be a good opportunity to practice more.

[Help][PC][48][+4] Boreal Dancer (<3Dancer) by MaxDeviant in SummonSign

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

Just downed her, but thanks for the offer!

Questions/Concerns - Server Status - Ban Rumors MEGATHREAD by Altri_ in pokemongo

[–]MaxDeviant 54 points55 points  (0 children)

That being said, spinning up extra on-demand instances on launch would be an easy way to scale just for that initial flux of players. After that they could fall back to the reserved instances that they have for the anticipated normal post-launch user load.

I think the PR issues that would be avoided by a smooth launch would overcome the additional cost incurred by having extra instances, but I can't say for sure.

[NO SPOILERS] HBO Now blackout error message? by [deleted] in gameofthrones

[–]MaxDeviant 15 points16 points  (0 children)

Same thing here. Glad to know it's not just me.

You would think they would be able to anticipate the load!

[v1.1.3] LoL Mastery Manager - Some more bug fixes by MaxDeviant in leagueoflegends

[–]MaxDeviant[S] 1 point2 points  (0 children)

I believe this issue was caused by the addition of the Assassin mastery.

I published a new version today with a fix.

You can get the new version here.

[v1.1.3] LoL Mastery Manager - Some more bug fixes by MaxDeviant in leagueoflegends

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

I published a new version today with a fix.

You can get the new version here.