On example where no Hamilton path is possible to make Hamilton cycle - hamiltonian-cycle

https://www.youtube.com/watch?v=3xeYcRYccro&list=PLoJC20gNfC2gmT_5WgwYwGMvgCjYVsIQg&index=32
12:10 states that that example is a Hamilton path. This is an example to shew that a Hamilton path cannot make a Hamilton graph. Indeed all verteces are covered by the red line. A Hamilton path is that touches all verteces once. Satisfied. If we add an edge from right upper to right lower, won't we have a Hamilton cycle. We can then start at one vertex, run all other 3 and finish at the beginning. Once. Why not a Hamilton cycle.

Look carefully at the question. It says: "Can a hamilton path ALWAYS be used to form an ham-cycle?"
So if you find only one example that has an ham-path but not an ham-cycle the answer is no.
The graph you're suggesting (upper and lower right vertices connected) surely has both path and cycle, but it does not answer to the question.
The other important thing is that removing an arch is different from adding one. You can see that taking a subset of a cycle is basically taking "almost the same object"; when you instead add an arch you create a new instance, a new graph that is different from the other. It's quite difficult to understand...

Related

Why are shaders called shader?

I can't find the word in any dictionary, neither in regular ones nor etymology ones. Only Wikipedia says:
The modern use of "shader" was introduced to the public by Pixar with their "RenderMan Interface Specification, Version 3.0" originally published in May 1988.
I know it's a program that runs on the GPU, but how did the Pixar guys come up with the name shader for it?
Although shader is not part of most dictionaries, the noun shading should be. dictionary.com, for example, defines it as
a slight variation or difference of color, character, etc.
This is is exactly what a shader does: It allows the programmer to add variations of color to a surface.
Shades is a very very very important factor in human vision. It allows recognizing shapes. And it's so because we live in a planet with plenty of shades, because of mainly Sun.
Realism needs shades. The Sun is not the only light. Conclusion: Good coloring implies shading from one or several lights. "Shaders" is the natural name for that programs that do it.

Unity erase parts of an image

Good day, I was wondering on how can I implement an effect like the ones on the sweepstakes where you scratch the grey part and reveal a number underneath it. I was wondering how can I implement that in unity, I don't have any clue where to start, thanks in advance.
the idea is, I have 2 overlapping objects, A and B, whereas when I click on a part of B it will be removed and will show a part of A, both A and B are sprite images though
This is not really related to Unity as such. This relates more to a general technical solution for a visual representation you would like to do.
So, let's skip the Unity part.
But even then the question is very general and hard to respond to. There are many ways to achieve this, depending on the result you want.
You could apply a quad object, with a grey texture on top of whatever number box you have and then either use shaders to show the number as you "scratch it". Or you could remove the grey square when clicking it (different behaviour). Or you could do the old school approach and replace pixels, as you "scratch" the box.
Only to mention a few ideas.
But still, the question is very general and hard to answer as it pertains to a general idea, and not so much a concrete question.
Look into how to build Fog of war shader. I would achieve this by rendering A and B with two separate cameras then as you scratch it off it would reveal B in the scratched area.

Increasing OpenGL's far clip plane distance

I'm trying to make a C++ OpenGL representation of our Solar System as a way to teach myself OpenGL, so please keep your answers simple.
The problem I have is that planets are very far away, so everything else is beyond the clipping plane when viewing from any given planet. How do I move the clipping of C++ OpenGL 3.1 plane to, say, 2000000000? I'd prefer a simple code snippet if you can.
I've looked up SO and forum posts about this, but they're either so old that nothing applies (using legacy APIs or just dead links), or so complex that I can't work out what they're saying.
Clipping planes are defined by the perspective projection matrix.
If you use glFrustum, change the last argument passed to it to 2000000000.0.
If you use your own matrix, set 10th element of your matrix array to:
(2000000000.0+nearClippingPlane)/(nearClippingPlane-2000000000.0)
(the formula is (far+near)/(near-far))
and 14th to:
(-4000000000.0*nearClippingPlane)/(2000000000.0-nearClippingPlane)
(the formula is (-2.0*near*far)/(far-near))
2000000000 is very big value, however, so Z-fighting may occur if you add details such as mountains.

How does pathfinding in RTS video games work?

In a game such as Warcraft 3 or Age of Empires, the ways that an AI opponent can move about the map seem almost limitless. The maps are huge and the position of other players is constantly changing.
How does the AI path-finding in games like these work? Standard graph-search methods (such as DFS, BFS or A*) seem impossible in such a setup.
Take the following with a grain of salt, since I don't have first-person experience with pathfinding.
That being said, there are likely to be different approaches, but I think standard graph-search methods, notably (variants of) A* are perfectly reasonable for strategy games. Most strategy games I know seem to be based on a tile system, where the map is comprised of little squares, which are easily mapped to a graph. One example would be StarCraft II (Screenshot), which I'll keep using as an example in the remainder of this answer, because I'm most familiar with it.
While A* can be used for real-time strategy games, there are a few drawbacks that have to be overcome by tweaks to the core algorithm:
A* is too slow
Since an RTS is by definion "real time", waiting for the computation to finish will frustrate the player, because the units will lag. This can be remedied in several ways. One is to use Multi-tiered A*, which computes a rough course before taking smaller obstacles into account. Another obvious optimization is to group units heading to the same destination into a platoon and only calculate one path for all of them.
Instead of the naive approach of making every single tile a node in the graph, one could also build a navigation mesh, which has fewer nodes and could be searched faster – this requires tweaking the search algorithm a little, but it would still be A* at the core.
A* is static
A* works on a static graph, so what to do when the landscape changes? I don't know how this is done in actual games, but I imagine the pathing is done repeatedly to cope with new obstacles or removed obstacles. Maybe they are using an incremental version of A* (PDF).
To see a demonstration of StarCraft II coping with this, go to 7:50 in this video.
A* has perfect information
A part of many RTS games is unexplored terrain. Since you can't see the terrain, your units shouldn't know where to walk either, but often they do anyway. One approach is to penalize walking through unexplored terrain, so units are more reluctant to take advantage of their omniscience, another is to take the omniscience away and just assume unexplored terrain is walkable. This can result in the units stumbling into dead ends, sometimes ones that are obvious to the player, until they finally explore a path to the target.
Fog of War is another aspect of this. For example, in StarCraft 2 there are destructible obstacles on the map. It has been shown that you can order a unit to move to the enemy base, and it will start down a different path if the obstacle has already been destroyed by your opponent, thus giving you information you should not actually have.
To summarize: You can use standard algorithms, but you may have to use them cleverly. And as a last bonus: I have found Amit’s Game Programming Information interesting with regard to pathing. It also has links to further discussion of the problem.
This is a bit of a simple example, but it shows that you can make the illusion of AI / Indepth Pathfinding from a non-complex set of rules: Pac-Man Pathfinding
Essentially, it is possible for the AI to know local (near by) information and make decisions based on that knowledge.
A* is a common pathfinding algorithm. This is a popular game development topic - you should be able to find numerous books and websites that contain information.
Check out visibility graphs. I believe that is what they use for path finding.

Anybody know how to get ahold of SAM76 source code for Linux?

resistors.org site and foxthompson.net download links are stale/broken.
http://www.resistors.org/index.php/The_SAM76_programming_language
Every other link I've been able to track down on the 'net (mostly in old newsgroup posts) are broken. E-mails to the respective webmasters all bounced.
I have a morbid curiosity for arcane programming languages, and SAM76 sounded really interesting to look into and mess around with.
There are quite a few lisp folks lurking on this site, so figured somebody might have a lead... as I heard SAM76 had some early redimentary functional programming ideas.
Extra credit: link to track down a copy of the SAM76 manual!
Wayback has a copy of S76.exe for DOS and Windows
http://web.archive.org/web/20070505122813/http://www.resistors.org/index.php/The_SAM76_programming_language
http://wikivisually.com/wiki/SAM76
http://encycl.opentopia.com/term/Sam76
http://encycl.opentopia.com/term/Algorithms_in_Sam76
======================= F R E E W A R E =======================
User-Supported Software
If you are using this program and find it to be of value
your $20 contribution will be appreciated.
A contribution of $30 will bring you the SAM76 language
manual and other useful and interesting documentation.
SAM76 Inc., Box 257 RR1
Pennington, N.J., 08534
U.S.A.
Regardless of whether you make a contribution,
you are encouraged to copy and share this program.
> ---------------------------------------------------
http://web.archive.org/web/20110726163455/http://www.hypernews.org/HyperNews/get/computing/lang-list/2/2/1.html
I believe the R.E.S.I.S.T.O.R.s (have no idea what the letters
mean) was a group of kids who played with computers and
electronics in Claude Kagan's barn in Pennington, N.J. near
Princeton. Because the developer of TRAC, Calvin Mooers,
spent the rest of his life inventing the software patent and
sued everyone in sight, Claude (whose employer, Western
Electric Laboratories was sued by Mooers) created a very
similar language called "SAM76" supposedly based on S7 and M6
"languages from Bell Labs". I have the original tutorial
manual written and illustrated by the R.E.S.... and versions
on paper tape for the Altair and TRS-80 floppy disk. I think
it looked more like #os#is;; but you could change all the
special characters and command names so it could be made to
look EXACTLY like TRAC. Claude wrote some neat graphic games
for the TRS-80 in SAM76/TRAC.
http://web.archive.org/web/20110726163335/http://www.hypernews.org/HyperNews/get/computing/lang-list/2/2/1/3.html
Yes, we RESISTORS did indeed meet in Claude's barn which was filled with old telephone and computer equipment. Claude's version of TRAC started on the PDP-8, migrated to the PDP-10, and for the legal reasons mentioned ended up as SAM-76. (FYI, SAM stands either for "Strachey and McIlroy" or "Same As Mooers". RESISTORS always stood for "Radically Emphatic Students Interested in Science, Technology, and Other Research Studies" as much as it stood for anything.
Starting when we were members of the RESISTORS, Peter Eichenberger and I wrote a PDP-10 TRAC processor and later reimplemented it for the PDP-11, eventually adding a little multi-terminal time-sharing monitor. We kept a lower profile than Western Electric (either that, or as 19 year olds we had no noticable assets) so we and Mooers stayed on cordial terms.
I don't know if this is useful, but on this page there is an email adress dsf#hci.ucsd.edu which seems to be Dave Fox's one, the guy who maintained the page hosting the SAM76 file.
There's a pile of information in the old SIMTEL archives, specifically CPMUG Volume 34, which is included in the nearly 13G download here including example code. You have your choice of "DSK" and "ARK" (ARC) format images. The standard {file} utility knows what format it's in {CPMUG034.ARC: ARC archive data, dynamic LZW} SIG/M v. 53 also has SAM76 information and you can find it here.

Resources