Theos
Calculate if jump is possible
Hey, I'm working on a 2D grid game (think Terraria), I want to check if a monster can make jump from point A (start) to B (target). It can adjust its horizontal/vertical speed to hit smaller/bigger jumps, same as the player can (for example by holding space for longer to jump higher).
So I'm calling this function
CanMakeJump(monster.gridPos, target.gridPos, maxJumpPower, someGravityValue)
I have no clue if my formula is even right, I'm getting weird results partially because I don't know how to incorporate horizontal velocity which should be based on monster's movementSpeed
statistic.
Code: https://pastebin.com/7WT8ULBS30 replies
Benchmarking code
Hey, so I made myself a simple template for advent of code.
Here is the code: https://pastebin.com/Z0dXuPNR
I have 3 questions:
- benchmarking takes quite some time. Around one minute I would say. Is this the expected time? I've never used this benchmark lib so I can't tell.
- I want to separate loading the input / parsing the input / solving into 3 benchmarks cuz I want to see what takes the most time, how can I do this?
- Is my template even okayish?
6 replies
❔ Unity Zenject qustion
Hey, I have a question about Zenject.
So I have a class
and I install it like this
then I have a list
List<Test> Tests
What I want to do is somehow make a for-loop that will create and add Test
to Tests
list. I want to make sure that _Smth
and _Foo
are installed using Zenject and I want to pass Id
when I create this object. From my understanding of zenject if i do var test = new Test()
it wont work cuz Something
and Foo
wont be installed right?4 replies
❔ LLVMSharp weird function
Hey, so I'm trynig to convert my class into a LLVM const.
I have a class callled NumberAST:
And I was wondering how to convert it into llvm const.
I found this thingy
LLVMValueRef.CreateConstIntOfString()
but I can't find it in the docs so i'm not sure how to use it20 replies
❔ Maximum path sum in matrix
Given a M x N grid filled with some values I need to find a path from a target node which maximizes the sum of all values along its path.
I can move in any direction. How can I do this? I've found some solutions online but they all go only from the top row to the bottom row when I need to go in all directions from any node.
93 replies