Im working on running traffic lights on four cases by using case structure and Flat-sequence structure. For example, there is green light on first case, and the rest of the three cases should have red light. As soon as the first case approaches to red light, the second case moves towards the green light. All these are controlled by specific time delays. The flat sequence structure is running the traffic lights properly in all the four cases, but, when I insert case structure, it only runs one case and does not activate the other cases. How can i make the VI run all the four cases simultaneously??
First off, this is an old CLD exam. There should be a wealth of examples available from a quick search. That said, some suggestions: never use a flat-sequence structure. Ever. Instead you need to use some combination of a state machine and subVIs. NI has a prep kit for the CLD (below). Check it out, it’ll show you what a state machine is in LabVIEW and how to take advantage of subVIs.
http://www.ni.com/gate/gb/GB_EKITCLDEXMPRP/US
Related
So I know very little about programming all around. I'm adept at photoshop and I'm looking to automate the numbering system for making these paint by number kits. I convert the images into vector format and set a maximum number of color variations. I then use adobe illustrator to create the outlined partitions of the image by color. This is all well and good, it's automated and efficient as far as I need.
My dilemma is that I do not have a system that can number these partitions in a clear and uniform fashion. I must do this tediously in photoshop, taking hours to finish.
I am looking to create or find a system that will do this last step automatically.
My vison for how this would look would be numbers, 1-20 or so depending on the set color cap, evenly distributed across each partition in uniform font and size. The idea is that there would be a grid of 1 number (this number would be the reference to the color needed in this partition) spread across larger partitions and only a few of 1 number on the smaller partitions. It would hopefully look like so:
You can see here how tedious this can become.
I don't know how to accomplish this, but I'm wondering how complicated this process would be in theory and would it be better for me to learn how to do it myself, hire a professional, or continue the hand numbering. It's creating a labor cap on my small business that is preventing me from further growth.
Any and all help is very much appreciated; if I can provide more context or specifications I would be more than happy to do so. Thank you!
Just for fun I've managed to tweak old Johnware's script (Circle Fill). Now it can fill with given letters (numbers for example). It works to a degree, but the result far from ideal:
Probably it can be used for start.
I believe a real programmer could make it way better.
My tweaked version of the script is here: https://disk.yandex.ru/d/Ze4-1DQoNRVF1g
Update
I'm improved the script further. Now it:
works more precise
handles several selected paths
remembers values in the dialog window
sets font size
Here is the is the updated version of the script: https://disk.yandex.ru/d/0pcpLDGrfQKMJA
It took me about 15 minutes to do this:
But I had to to split some complex paths with a Knife tool. Sometimes the script throws a some mystical error. I've just selected another set of paths an run the scripts again and again.
It is not a final result but it's close. I think it's much faster that to do it manually.
It can be done with script to some degree. It will work fine for simply forms. But for complicated forms it will be too hard to calculate where you need to put all numbers and how many number will be enough.
But I saw scripts that can fill any form with any symbols. So it's possible to fill any form with numbers, I think, technically.
Of course, if you aren't a seasoned coder it makes no sense to try to do it at home. You need a pro (not even me).
And I see another very simply options as well:
It doesn't even need a script. What do you think?
I've been playing with the basic CloudBalance example, and have given it input of one Computer and two Processes. Both processes are too much to fit on the computer, so only one should go on. However, when solving the solution (albeit with negative HardScore) is that both Processes are on the Computer. I understand there is not actual solution for both Processes, but shouldn't the result only have one Process assigned to the Computer, and the other not assigned? How would I need to change the setup to make that happen?
Look at Overconstrained Planning in the docs. By default, OptaPlanner will assign all Processes, because assigning to null is not an option.
I want to know how to represent a coffee machine using a Deterministic finite automata?
I've tried a lot to do this job.
I represented each and every processes as a set,by putting one to one correspondence with Natural numbers.
But I still don't know how to represent it using DFA.
First, try to imagine the states your automaton can be in. Something like:
Off, Ready, Working
Afterwards imagine the buttons or inputs you have to perform to switch between these states. Do not forget to define every input on every state. If you leave out several transitions, the automaton is not deterministic therefore is an NFA. Transitions could be:
0 for power off/on
1 for start/stop working
Off -0-> Ready
Ready -1-> Working
Ready -0-> Off
Working -1-> Ready (4 for the actual working process)
Off -1-> Off
Working -0-> Working (nothing happens in this cases)
Just connect the states with the given transitions, and voilá!
i'm developing a 2d game , rts game, is sort of like COC (Clash of Clans). cool mobile game,huh. but i run into some problem with path-finding, as usual,i do path-finding algorithm once every agent was placed somewhere in screen by finger-touch,but in some case, this incur performance penalty, and your mobile phone will be very hot as your agents increase suddenly and simultaneously.
actually,no matter what path-finding i use,e.g a*,dijkstra, or something special(maybe optimal),which is always time-comsuming process throughout the whole game loop ,especially massive agents on less powerfull mobile cpu. as far as i know, some game like this, shortest path is not the focus (will people care about the path agent walk through intentionally?) instead of efficient and naturally path-finding. so my mind come up with some solutions,maybe impractical.
solution 1 : use some cheaper path-finding algorithm, could be graph related or somethingelse because shortest path doesn't matter.
solution 2 : put some limits on ai module to process agent for path-finding, e.g upper limit to path-finding algorithm calls at interval,that is,just one or two agents of the those agents got planning, let rest of them plann after several game frames. as you know ,its drawback is obvious.
the above is what i thougt. hope your game dev disciplined guys give me brilliant idea , tricks, i'll appricate. thank you very much.
EDIT:
here is my related pseudo code,and procedure cresspond to my game logic.
//inside logic thread
procedure putonagent
if (need to put agent on world space)
//do standard a* path-finding for an agent
path_list=do_aStar_path_finding(attacktargetpos,startpos);
and then enqueue path_list;
......
end
the path_list's queue finally used by visual agents for stepping forward. any hints?
Look up "Hierarchical pathfinding" Say you're driving to a city far away, you don't plan the entire path before you get in the car!
Pathfinding is usually done in steps, like it's not one function call, after N iterations it'll return (and indicate it's not complete) so it can be run at the next available time. Basically rather than a function with locals think operator() and state variables as members of a class.
To make it fast you can make the heuristic crap with A* pathfinding, suppose I use a heuristic of 10* the distance-as-the-crow-flies, it may not find the shortest path but it will have a strong preference for heading towards the target rather than "fanning out" and exploring further around the closed region.
I have been playing Bejeweled Blitz for a while now. Yes, it is an addiction. In thinking about the game, I have observed that on some boards, the bottom runs dry (no moves) leaving only the top part of the board playable. Frequently that part of the board drys up, and one is left with moves in area cleared by the last move.
The board never runs completely dry, so clearly the program is doing some sorts of calculation that allows it to choose what to drop to prevent it from running dry.
I have noticed in this 'mode' that it is very common for the algorithm to drop jewels which causes more non-dry area to appear in the horizontal area. Perhaps less frequent is a drop which seems designed to open up the bottom part of the board again.
So my question is "How would one go about designing an algorithm guarantee that there is always a move available.?"
I wrote three-in-a-row game a while ago and the way I dealt with that problem is by selecting gems to drop at random and counting all valid moves. If selected gems did not provide at least 1 valid move I would select another set of gems and so on.
This is solvable by exploring the space of possible "jewel drops" and then you apply a rating based on your rules you have asked for. Higher rating could mean follows rule and low ratings mean not following then you choose one slot with the highest rating.
This is not easy to explain, but a rule based approach should do the trick.