Kaenguruu24
Kaenguruu24
CC#
Created by Kaenguruu24 on 7/31/2024 in #help
Determine the positions of nodes inside of a graph
No description
28 replies
CC#
Created by Kaenguruu24 on 5/12/2024 in #help
Conveyor Placement System
I've been looking around but all I can find are solutions on how to move items on conveyors. However, my struggles are currently on how to make a placement system that works for me. Here is how it should work: You select an input object (imagine it as a button). From there you can move your mouse to a dot in a grid where you want to place the first part of the conveyor. As long as you left click somewhere, you add the current mouse position (snapped to a grid) as part of the conveyor and then you can set the next point. When you select an output, it will add the output to the conveyor and stop. Now, if you want to add a second output, you can click anywhere on the conveyor (again snapped to a grid) to "extend" the conveyor from there. Some things it also needs to do: Snake-like behaviour, so never in the opposite direction of where you are coming from. Other belts can cross anywhere. My main issue right now is that I'm unsure how to setup the code. I already have a version, but it just adds the points to a List<Vector2> and then draws them in order. So if the list looks like this: [Vector2(0, 0), Vector2(100, 0), Vector2(100, 100)] it would draw from (0,0) to (100,0) and from (100,0) to (100,100). This works as long as we ignore point 4 because my current implementation does not allow for multiple connections. Honestly, it all looks a bit like how you would model an NFA so maybe that would be an approach? Any help is appreciated.
2 replies
CC#
Created by Kaenguruu24 on 3/21/2024 in #help
Converting Regex to a DFA
I am currently developing a small simulation in which I can create and edit DFA's (Deterministic Finite Automata). The idea came from a video I saw about regex engines and that one of those actually uses this to parse regex. I am aware that Regex isn't just "Regex" and that there are many different "flavours" but I'd like to at least implement those who are like the base thing. What I've found so far is that I should first create an NFA and then, through some algorithms, convert that one into a DFA. However, at the moment, I'm struggling with the very first thing, which is converting a regex pattern into something like a tree structure. I've searched for libraries that do this but haven't found anything that I could use. Any ideas how to "parse" regex in the sense of splitting it into "tokens"? As an example: [a-z]|[A-Z] should basically get converted to
{
"or_branches" : [
"[a-z]",
"[A-Z]"
]
}
{
"or_branches" : [
"[a-z]",
"[A-Z]"
]
}
4 replies
CC#
Created by Kaenguruu24 on 3/10/2024 in #help
Sending key presses to other applications without Windows Forms
Because I'm working with the Godot game engine for the graphics interface, I'm kinda restricted with their Mono implementation. That prevents me from using the windows forms stuff. So I've tried the solutions using user32.dll but they only work when I move my mouse. I assume that is happening because of the following: I have a touchscreen with a button. When that button is pressed, there should be the according key action. I think that because of the touch input, it's doing some funky stuff with the window focus and that results in the behaviour described above. Code looks as follows:
44 replies