What if 2048 was good?

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ต.ค. 2024

ความคิดเห็น • 28

  • @DokterKaj
    @DokterKaj 2 หลายเดือนก่อน +13

    Bro said 2048 was too easy and made it easier
    FR though actually cool

    • @PatrickModels
      @PatrickModels  2 หลายเดือนก่อน +1

      Maybe too simple would be more accurate haha :)

  • @mersilvaureus1525
    @mersilvaureus1525 2 หลายเดือนก่อน +5

    May this be the start of your ride on the algorithm cuz I'd say you deserve some more views and subs!

    • @PatrickModels
      @PatrickModels  2 หลายเดือนก่อน

      I hope so too 🫡

  • @HeyGrouch
    @HeyGrouch 2 หลายเดือนก่อน +1

    pretty interesting! excited to see what you make in the future

  • @_BeastGamerAndy_
    @_BeastGamerAndy_ 2 หลายเดือนก่อน +3

    *sniff* *sniff* Why do I smell Clouds...... 1:05

  • @lethaldosegame
    @lethaldosegame 2 หลายเดือนก่อน

    what if airplanes in the night sky were like shooting stars

    • @PatrickModels
      @PatrickModels  2 หลายเดือนก่อน

      i could really use a wish right now wish right now wish right now...

  • @DereadLordLives
    @DereadLordLives 2 หลายเดือนก่อน +2

    Wait but can we play it?

    • @brunojani7968
      @brunojani7968 2 หลายเดือนก่อน

      Nonononononope

    • @PatrickModels
      @PatrickModels  2 หลายเดือนก่อน

      Unfortunately because I made it an app I'd have to pay publishing costs on Google Play and the App Store so for now it's going to be shelved :( In future I'm going to make things for the web because it's more cross platform

  • @baksoBoy
    @baksoBoy 2 หลายเดือนก่อน

    Am I dumb or are you using AwesomeWM?

    • @PatrickModels
      @PatrickModels  2 หลายเดือนก่อน +1

      Nah I'm using Sway. I used BSPWM for ~6 years but I switched to Wayland and had to leave it behind ~1 year ago

  • @isaiahimg7189
    @isaiahimg7189 2 หลายเดือนก่อน

    Cool project

  • @macchiato_1881
    @macchiato_1881 2 หลายเดือนก่อน

    Why was 6 afraid of 7? Because 2048...
    I'll show myself out.
    Btw use a state lookup matrix for the logic. That match statement is horrific.

    • @PatrickModels
      @PatrickModels  2 หลายเดือนก่อน

      Yeah the match statement is not my finest work. Could you clarify what you mean by state lookup matrix? I'm assuming you mean an n dimensional matrix where n is each cell in a row?

    • @macchiato_1881
      @macchiato_1881 2 หลายเดือนก่อน

      @@PatrickModels you have two choices on how you want to handle this case.
      A. You could move all that logic to a hash table where you just feed it the current state of the row or column, and it spits out corresponding logic. This will run the lookup operations in O(1) runtime, but is harder to implement and maintain.
      B. You could change how the merging logic is implemented. It goes like this:
      Filter out zeroes - remove zeroes from the row to simplify the merging process.
      Merging -
      Step 1. Initialize an empty accumulator.
      Step 2. For each tile in the filtered list:
      * If the accumulator is empty, add the tile to the accumulator.
      * If the accumulator is not empty and the last tile can merge with the current tile, merge them and replace the last merged element with 0.
      * If they can't merge, append the last tile to the result and update the accumulator with the current tile.
      Add zero padding - Add zeros to the end of the array to maintain the original row or column length.
      Visually, it looks something like this. Let's say you do a left swipe:
      [] merged-tiles
      (remove zero?)
      (concat (repeat (- (count tiles) (count (remove zero? merged-tiles))) 0))
      vec)))
      (defn generate-row-moves [row]
      (merge-tiles row))
      Have fun with that info!

    • @macchiato_1881
      @macchiato_1881 2 หลายเดือนก่อน

      @@PatrickModels ​ I hate youtube comments. I type a long comment and it doesn't register through anyways, you have two choices.
      A. Create a state lookup matrix or array. You could move all that logic to a table where you just feed it the current state of the row or column, and it spits out corresponding logic. This will run the lookup operations in O(1) runtime, but is harder to implement and maintain.
      B. You could change how the merging logic is implemented using accumulation. It goes like this:
      Filter out zeroes - remove zeroes from the row to simplify the merging process.
      Merging -
      Step 1. Initialize an empty accumulator.
      Step 2. For each tile in the filtered list:
      * If the accumulator is empty, add the tile to the accumulator.
      * If the accumulator is not empty and the last tile can merge with the current tile, merge them and replace the last merged element with `0`.
      * If they can't merge, append the last tile to the result and update the accumulator with the current tile.
      Add zero padding - Add zeros to the end of the array to maintain the original row or column length.
      Visually, it looks something like:
      []

    • @macchiato_1881
      @macchiato_1881 2 หลายเดือนก่อน

      @@PatrickModels here's some sample code for the second logic.
      (defn merge-tiles [tiles]
      (let [non-zero-tiles (filterv pos? tiles)
      merged-tiles (reduce (fn [acc tile]
      (let [last-tile (last acc)]
      (if (and last-tile (can-merge last-tile tile))
      (conj (vec (butlast acc)) (* 2 tile) 0)
      (conj acc tile))))
      []
      non-zero-tiles)]
      (->> merged-tiles
      (remove zero?)
      (concat (repeat (- (count tiles) (count (remove zero? merged-tiles))) 0))
      vec)))
      (defn generate-row-moves [row]
      (merge-tiles row))

    • @PatrickModels
      @PatrickModels  2 หลายเดือนก่อน

      Hmm, I'm not sure if doing it like this would fit with the architecture I've made. That said, the fact that my code wouldn't work with the proper merging algorithm is potentially a sign that I took a wrong turn somewhere along the way. My output at the moment isn't actually the next row, it's a list of changes that need to made to the row.
      A potential solution to the maintainability of the first time would be maybe having the hashmap be generated programmatically? I dunno. Much to consider because I do plan on expanding on more 2048 ideas

  • @Eldritch_
    @Eldritch_ 2 หลายเดือนก่อน +3

    now make fortnite in 4D fr

    • @PatrickModels
      @PatrickModels  2 หลายเดือนก่อน +1

      I know this comment is a joke but you've got me actually thinking about what a 4D shooting game would be like

    • @Eldritch_
      @Eldritch_ 2 หลายเดือนก่อน +1

      @@PatrickModels doom in 4D would be crazy