Saturday, May 24, 2014

Unimpressive/Unimpressive Code


    public static boolean permutation(List values, int index) {
        return permutation(values, values.size() - 1, index);
    }

    private static boolean permutation(List values, int n, int index) {
        if ((index == 0) || (n == 0)) {
            return (index == 0);
        }
        Collections.swap(values, n, n - (index % n));
        return permutation(values, n - 1, index / n);
    }

Give it a list, and an index and it will do the permutatation associated with that index. It runs out of integers at 12 items as 12! > Integer.MAX_VALUE

Sunday, May 4, 2014

Why the Singularity is bullshit.

I've done a lot of thinking on the issue. After I solved a few of the theoretical problems, and I've got to say, it's really kind of silly. The claim that AI could improve its design and then cause a runaway explosion of intelligence is quite simply wrong. In fact, the entire idea of the singularity is based on a wrong notion of what intelligence is and how it functions. Which really should be something people should have figured out at square one before moving on and pontificating. But, it wasn't like any of the AI programs were doing anything, and you might as well use that time to daydream about it.

Intelligence takes real work. You don't just have it. You build your brain with what patterns you see and recognize, which means you need to be exposed to them and experience things, and test things within actual reality rather than trying to do physics in one's own head. Intelligence is a bit like the scientific method being automatically implemented on 3 pounds of neurons.

There is no such thing as a free lunch. 

You can't make the scientific method work twenty times as fast if you use a bunch of science to improve the scientific method. You cannot use to do the real intellectual work of understanding things, predicting them, knowing the underlying patterns, to improve the actual work it takes to do that. Just as doubling a functioning AI's computer processor wouldn't make it twice as smart. Just as making a human exist for two seconds for every second wouldn't make her smarter, it would simply allow her to get to the same wrong answer in half the time and not be one iota more intelligent (it would make her an unstoppable devil with a pointed stick though).

Sunday, April 27, 2014

Don't respect my beliefs for no reason.

You should not respect my belief that given any mysterious occurrence I will believe that it isn't magical or supernatural but rather natural phenomenon acting in a previously unknown way. It earns that respect by thus far in the history of mysteries being correct 100% of the time thus far. Your belief that a cosmic superman poofed everything into existence and then had to fix it later on by donning a human suit and sacrificing himself to himself, equally should not unquestioning get respect but be evaluated according to it's actual likelihood of being true.

The claim that 'I respect your beliefs, you are are being cruel by not respecting mine' is a red herring. It's patronizing and disrespectful to me. It's saying you think I would prefer to walk around believing false notions being coddled and unquestioned, more than I would want a small amount of discomfort learning that one of my beliefs is actually false and then being able to correct the notion. -- It's insulting to me to suppose I would prefer the former to the later.

Tuesday, April 22, 2014

Turned off Anon posting.

I got too annoyed with the spam. It was getting all auto filtered but it emailed me about the spam it was filtering off.

Wednesday, April 16, 2014

Hitler Table Talks

So the whole Hitler as a Christian thing came up again, and so I dug around for the original German hoping for the google to save me. And Der Spiegel did publish some of them piecemeal in 1980, and digitized the collection. Of which the major one talking about Christianity is:

http://www.spiegel.de/spiegel/print/d-14317956.html


Only under the effects of the Germanic spirit has gradually lost his Christianity openly Bolshevik character; it has become fairly portable. While it dies, the Jew will again start with the early Christianity, Bolshevism.
One has the high level of Roman art and culture in temples such as flats compare with what brought the Bolshevik underworld back in the catacombs as a new Christian culture. At that time, destroying all the libraries, and today we see in Russia the same: a depression on a very low, all the same level.
At that time and until the Middle Ages, the most terrible tortures, tortures and burns in the name of Christianity, and today the same in the name of Bolshevism. From the Saul a Paul from the Mordechai was a Karl Marx.
If we eradicate this pest, we accomplish a deed for humanity, our men out there still can do no idea of their meaning.



Is traditionally held to say, via the Trever Roper translations via the French conman guy.


 In the old days, as now, destruction of art and civilisation.
The Bolsheviks of their day, what didn't they destroy in Rome,
in Greece and elsewhere? They've behaved in the same way
amongst us and in Russia.
One must compare the art and civilisation of the Romans —
their temples, their houses — with the art and civilisation repre-
sented at the same period by the abject rabble of the catacombs.
In the old days, the destruction of the libraries. Isn't that what
happened in Russia? The result: a frightful levelling-down.
Didn't the world see, carried on right into the Middle Ages,
the same old system of martyrs, tortures, faggots? Of old, it was
in the name of Christianity. To-day, it's in the name of
Bolshevism.
Yesterday, the instigator was Saul: the instigator to-day,
Mardochai.
Saul has changed into St. Paul, and Mardochai into Karl Marx.
By exterminating this pest, we shall do humanity a service of
which our soldiers can have no idea.


The latter seems to suppose that Christianity should be exterminated. The more proper version says the Bulshevik corruption of Christianity should be.

Saturday, February 22, 2014

Why insects are stupid, but seem pretty smart. Evolution And Intelligence

The error with thinking that some life forms are intelligent when they are basically rather simple automatons is the underlying intelligence of our brains is an evolutionary algorithm in and of itself. So the products of evolution always look intelligent. But, that's not because they are, but because intelligence is similarly an evolutionary process carried out within our brains.

It's why the design of highly evolved structures look intelligent. Because intelligence is a type of evolution carried out within neurons rewiring the best predictive pathways in the brain. In short that's the reason behind the flaw in the design argument.

It isn't that the supposed intelligence behind nature is real and evolution is therefore fake. But, the intelligence in our heads is a form of evolution and the evolution in nature looks very similar. Not because it's an illusion, as many wrongly argue, but because they are similar. They are doing the same thing. But, not "being intelligent" but "being evolved."

I've wanted to write a book on that little insight for a while now. But, it explains why people think intelligent design feels so intuitive. -- Because it is, and for deep reasons.

Evolution is well understood and highly established. Intelligence is nebulous and generally vague at best and hugely unknown. Saying intelligence explains evolution, takes absolutely robust science and throws it down a rabbit hole. Saying evolution explains intelligence, takes a rabbit hole and gives it some substance and explanation.

The truth behind the design argument is that it really does look designed. It looks like something very intelligent made it work just like that, knowing all this stuff about how things work and engineering. And it's not an illusion, it's a category mistake. It evolved, but that's how intelligence works to, so saying the causes seem similar is obviously accurate but not because intelligence is behind nature. But, because nature is behind intelligence.

The universal acid flows down hill, not up.

Tuesday, February 18, 2014

I updated my Field Diamond Squared Algorithm Demo.

http://tatarize.nfshost.com/FieldDiamondSquare.htm

Much more drag the background, see the infinite. Also, fixed a few errors I made when I made it to just produce a static one off rather than the full implementation.

Monday, February 17, 2014

Pulled out of thin error.

I'm going to start using this all the time rather than the "air" version.

6 links found on google.

Wednesday, December 25, 2013

Saturday, November 30, 2013

Kmeans++ Color Quantization seeding.

So I was checking through a few color quantization algorithms and read the procedures needed for the Kmeans++ algorithm which is just Kmeans but it is initially seeded by finding maximally distinct colors from all previous color entries. And I was like hey, I totally already solved that problem!


In fact, I made a color dictionary of maximally distinct colors from all previous colors so to do the whole color quantization routine with an optimized initial seed, I can just feed it N digits of my lookup table that basically fits the gamut perfectly.

private static final String[] indexcolors = new String[]{
        "#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059",
        "#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79762", "#004D43", "#8FB0FF", "#997D87",
        "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80",
        "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100",
        "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F",
        "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09",
        "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66",
        "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C",
        
        "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81",
        "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00",
        "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700",
        "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329",
        "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C",
        "#83AB58", "#001C1E", "#D1F7CE", "#004B28", "#C8D0F6", "#A3A489", "#806C66", "#222800",
        "#BF5650", "#E83000", "#66796D", "#DA007C", "#FF1A59", "#8ADBB4", "#1E0200", "#5B4E51",
        "#C895C5", "#320033", "#FF6832", "#66E1D3", "#CFCDAC", "#D0AC94", "#7ED379", "#012C58",
        
        "#7A7BFF", "#D68E01", "#353339", "#78AFA1", "#FEB2C6", "#75797C", "#837393", "#943A4D",
        "#B5F4FF", "#D2DCD5", "#9556BD", "#6A714A", "#001325", "#02525F", "#0AA3F7", "#E98176",
        "#DBD5DD", "#5EBCD1", "#3D4F44", "#7E6405", "#02684E", "#962B75", "#8D8546", "#9695C5",
        "#E773CE", "#D86A78", "#3E89BE", "#CA834E", "#518A87", "#5B113C", "#55813B", "#E704C4",
        "#00005F", "#A97399", "#4B8160", "#59738A", "#FF5DA7", "#F7C9BF", "#643127", "#513A01",
        "#6B94AA", "#51A058", "#A45B02", "#1D1702", "#E20027", "#E7AB63", "#4C6001", "#9C6966",
        "#64547B", "#97979E", "#006A66", "#391406", "#F4D749", "#0045D2", "#006C31", "#DDB6D0",
        "#7C6571", "#9FB2A4", "#00D891", "#15A08A", "#BC65E9", "#FFFFFE", "#C6DC99", "#203B3C",

        "#671190", "#6B3A64", "#F5E1FF", "#FFA0F2", "#CCAA35", "#374527", "#8BB400", "#797868",
        "#C6005A", "#3B000A", "#C86240", "#29607C", "#402334", "#7D5A44", "#CCB87C", "#B88183",
        "#AA5199", "#B5D6C3", "#A38469", "#9F94F0", "#A74571", "#B894A6", "#71BB8C", "#00B433",
        "#789EC9", "#6D80BA", "#953F00", "#5EFF03", "#E4FFFC", "#1BE177", "#BCB1E5", "#76912F",
        "#003109", "#0060CD", "#D20096", "#895563", "#29201D", "#5B3213", "#A76F42", "#89412E",
        "#1A3A2A", "#494B5A", "#A88C85", "#F4ABAA", "#A3F3AB", "#00C6C8", "#EA8B66", "#958A9F",
        "#BDC9D2", "#9FA064", "#BE4700", "#658188", "#83A485", "#453C23", "#47675D", "#3A3F00",
        "#061203", "#DFFB71", "#868E7E", "#98D058", "#6C8F7D", "#D7BFC2", "#3C3E6E", "#D83D66",
        
        "#2F5D9B", "#6C5E46", "#D25B88", "#5B656C", "#00B57F", "#545C46", "#866097", "#365D25",
        "#252F99", "#00CCFF", "#674E60", "#FC009C", "#92896B"
    };

Wednesday, November 20, 2013

The Joys of the Hookah

(I don't smoke but digitizing this)

THE JOYS OF THE HOOKAH*.

Though some may smoke segar, cheroot,
Or others' taste a pipe may suit,
They can't with thee the palm dispute,
                                             My Hookah.
When oft in boats I've been confin'd,
And ev'ry festive scene resigned,
Thou hast consol'd my drooping mind,
                                             My Hookah.
Whilst slow the pinnace seem'd to glide,
Along the Gunga's barren side,
What pleasing comfort thou supplied,
                                             My Hookah.
And when for weeks no change I've seen,
No fertile banks or meadows green,
With thee I've ne'er dejected been,
                                             My Hookah.
In gloomy jungles, where, alas!
No friend was near to quaff the glass,
Still did the hours contented pass,
                                             My Hookah.
And if the season bred disease,
From stagnant jeels or wither'd trees,
They smoke dispell'd the noxious breeze,
                                             My Hookah.
Expos'd to Sol's meridian power,
Or delug'd by the pelting shower,
Thou cheer'dst me in the gloomy hour,
                                             My Hookah.
In camps where oft untimely fell,
The valiant youth by fever's spell,
They fumes for ever kept me well,
                                             My Hookah.
From lengthen'd march the foe to meet,
Assail'd by thirst, expos'd to heat,
The conflict gain'd! I'd joyful greet
                                             My Hookah.
By arduous duty now deprest,
My strength exhausted, still no rest,
To me though then wert doubly blest,
                                             My Hookah.
Then as I sat beneath a tree,
If shade there haply chanc'd to be,
I seiz'd thy snake with extasy,
                                             My Hookah.
And now with evils still more trying,
To grieve for friends, departed, dying,
Alas! I often smok'd thee sighing,
                                             My Hookah.
The heart which can refuse a tear
For those who fall in war's career,
Can ne'er deserve thy envy'd cheer,
                                             My Hookah.
And if by chance in party dining,
Where conversation see'd declining,
I never thought of once repining,
                                             My Hookah.
But if that silence should be broke,
I did as others did, I spoke,
And then resumed thy snake to smoke,
                                             My Hookah.
Should lovely women deign partake,
A whiff or two for smoking's sake,
What odour would it give thy snake,
                                             My Hookah.
Not nectar would I wish to sip,
Allow'd that blest Munall to grip,
Which has been press'd by woman's lip,
                                             My Hookah.
If Hookahs can such pleasure give,
And smokers can such joys recieve,
Oh! let me smoke thee while I live,
                                             My Hookah.

Notes:
Verse
1st, "Cheroot," an Eastern name for segar.
3d, "Gunga." the native appellation for the Ganges,
5th, "Jungle", thick forests.
6th, "Jeel," large pools formed by the rains; and from their stagnant state, rendering the neighbourhood peculiarly unhealthy.
11th, "Snake," the name given to the long flexible tube which conveys the smoke.
17th "Munall," the part applied to the mouth; made of gold, silver, or agate,

Sunday, November 10, 2013

Field Terrain Fractals

It occurs to me that treating fractals as fields that iterate from the previous and are solvable recursively for some subset so long as it doesn't diverge from the entire infinite field actually provides for not just a much better diamond squared fractal but rather for an infinite array of different types of fractals. There are basically only noise algorithms to do landscape like things, but if you take my algorithm and simply use it to recursively iterate the iterations within a limited scope you can produce a hell of a lot of different fractals.

Not to say they aren't useful, but most fractal iterations simply iterate and store the entire fractal in memory. To some extent that's not really needed. You could create a series of linear fractions say by starting by in infinite random field and then each iteration inserting the midpoint offset displacement just along the width. You'd get the 1d midpoint replacement fractal in infinite rows.  Or perhaps more useful you could apply say a box blur to a landscape, insert additional area with average random offset and repeat each iteration.

If (iteration == 5) {
     request sliver of the Iteration5 from iteration4 requested + 1 on each side,
     Apply a block blur (or frankly any convolution), and return the center bit that is accurately blurred.
}

You could likely produce pretty good landscape noise by inserting progressively less random additional points between all your current points and then applying a blur to all points. Even larger Gaussian blurs wouldn't be too difficult. In fact, there are some artifacts in diamond squared that cannot be fixed. Some points simply have different probability curves based on their location. If you always got the maximum possible random number every time, for a diamond squared field, you'll notice a *VERY* apparent pattern.


This typically blends into the noise and only matters for the standard deviation of the pattern. So long as they average at 0, it isn't very obvious (if you have run so that on average you deviate in some direction, it becomes apparent). It doesn't really have to be this way.

Saturday, November 9, 2013

Field Diamond Squared Fractal Terrain Algorithm

The traditional Diamond Squared algorithm for generating fractal terrain has a number of constraints that make it really hard to use.

https://code.google.com/p/fractalterraingeneration/wiki/Diamond_Square
Gives a pretty good rundown of the cons:

* The map must be stored in memory, because pixels reference other pixels.
* Because it must be stored in memory, memory becomes a constraint. [...]
* The map must have a width and height of 2x + 1 pixels.
* Has 'creasing' artifacts if wrapping isn't used.
* Wrapping isn't always wanted.

I have solved all of these. And simplified the algorithm.


The traditional algorithm is that you set 4 corners to random values and wrap around the edges.

0 0
0 0


You double the height and width. Then each place you have four corners available to you, you insert the average of those corners and a slight random offset.

0   0
  1   1
0   0
  1   1

Due to the wrapping. You have four diamonds.

Then after all the diamond steps are done, you add in the square sections.

0 2 0 2
2 1 2 1
0 2 0 2
2 1 2 1

Keeping in mind it wraps around.


----

My solution is to simply view the base step as an infinite field of purely random values. This seems harder to conceptualize. But, it fixes the problems. You can't create an infinite field with twice the width as an infinite field. But, if you note, the next iteration doesn't require anything more than 1 away from the current iteration.

Even without any wrapping you can take:
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0

And diverge.

0   0   0   0
  1 2 1 2 1
0 2 0 2 0 2 0
  1 2 1 2 1
0 2 0 2 0 2 0
  1 2 1 2 1
0   0   0   0

We went from a 4x4 to a 5x5. Next it goes to a 7x7 then a 11x11 then a (2n-3)x(2n-3)...

So we can simply reverse this with our well formed request.

If we want 1000x1000 block of data say at the range [0-1000], [0-1000] at 24 iterations (which under the traditional method would require 2^48 bits of memory to store), we can request:

[0,1000] [0,1000] @ 24 which means we divide the range in half rounding towards the larger area and increasing the bounds by 1.
We need the range:
-1 to 501 @ 23
Then:
-1 to 252 @ 22
Then:
-1 to 127 @ 21
Then:
-1 to 65 @ 20
Then:
-1 to 34 @ 19
Then:
-1 to 17 @ 18
Then:
-1 to 10 @ 17
Then:
-1 to 6 @ 16
Then:
-1 to 4 @ 15
Then:
-1 to 3 @ 14
Then:
-1 to 3 @ 13
...
...
Then:
-1 to 3 @ 1
Then:
-1 to 3 @ 0 which simply returns a field of 4x4 random numbers.


Rather than all that nonsense with wrapping and seeding and making what is actually a special case of the base case, we can simply reduce the algorithm to:

getTerrain(x0,y0,x1,y1,iterations) {
    if (iterations == 0) return maxtrixOf(random numbers);
    map = getTerrain(floor(x0/2) - 1, floor(y0/2) - 1, ceiling(x1/2), ceiling(y1/2), iterations-1);
    make a newmap twice as large.
    copy values from map into x*2,y*2 locations in newmap.
    apply diamond where possible. +- smaller random offset
    apply square where possible. +- smaller random offset
    return requested area from within newmap. (This is typically newmap from [1,(n-1)] [1,(n-1]
}

Done.

That's the entire algorithm. No more constraints and it's easier. On top of this the number of iterations doesn't control the size of the field but rather smoothness, of the underlying fractal. And since the base case is seen as an infinite field of purely random numbers, it goes on forever even at just a couple iterations as the iterations has no bearing on the size (it's always infinite).

On top of this rather than using a random number, you can use the the x, y, and iterations to make a pseudorandom but deterministic number like through a SHA1 hash. Then you can page from within the same area, forever without needing to have calculated all of it to start. You can create an infinite landscape without needing infinite memory to start, and returning to the same coordinates will give you the same results, and it doesn't matter which way you took to get there. 'There' will be deterministic.

---

I hacked together a working bit of the code in javascript:

http://tatarize.nfshost.com/FieldDiamondSquare.htm

Stealing liberally from http://www.somethinghitme.com/2009/12/06/terrain-generation-with-canvas-and-javascript/

---

Also check my newer algorithm Olsen Noise (though still lacking a javascript implementation) which corrects the artifacting and allows it to be changed into N dimensions. It also, simplifies. The algorithm even more.

http://godsnotwheregodsnot.blogspot.com/2014/08/3d-olsen-noise.html


Saturday, October 19, 2013

Sunday, September 29, 2013

Firefly Symphony Clips

Rich people and unethical behavior.



It turns out that rich people don't need to be polite, they have money.

Saturday, September 14, 2013

Chapman Cohen -- Fragile Things quote.

These gods of the ancient world sent rain and gave their followers good health; they answered prayers; they sent their faithful worshippers to a prepared heaven and their enemies to a prepared hell. But as man’s worship declined so the objects of the worship declined also. Gods are fragile things, they may be killed by a whiff of science or a dose of common sense. They thrive on servility and shrink before independence. They feed upon worship as kings do upon flattery. That is why the cry of gods at all times is “Worship us or we perish.” A dethroned monarch may retain some of his human dignity while driving a taxi for a living. But a god without his thunderbolt is a poor object. -- Chapman Cohen, The Devil

Thursday, September 5, 2013

West Virginia BOE v. Barnette

In a concurring opinion via wikipedia:
"Words uttered under coercion are proof of loyalty to nothing but self-interest," wrote Black and Douglas in a concurring opinion. "Love of country must spring from willing hearts and free minds, inspired by a fair administration of wise laws enacted by the people's elected representatives within the bounds of express constitutional prohibitions."

Update: Full paragraph rather than wiki synopsis.

Words uttered under coercion are proof of loyalty to nothing but self-interest. Love of country must spring from willing hearts and free minds, inspired by a fair administration of wise laws enacted by the people's elected representatives within the bounds of express constitutional prohibitions. These laws must, to be consistent with the First Amendment, permit the widest toleration of conflicting viewpoints consistent with a society of free men. 


http://www.law.cornell.edu/supct/html/historics/USSC_CR_0319_0624_ZC.html

Monday, August 19, 2013

One of the saddest things in history, Ignaz Semmelweis

Semmelweis was outraged by the indifference of the medical profession and began writing open and increasingly angry letters to prominent European obstetricians, at times denouncing them as irresponsible murderers. His contemporaries, including his wife, believed he was losing his mind, and in 1865 he was committed to an asylum. In an ironic twist of fate, he died there of septicaemia only 14 days later, possibly as the result of being severely beaten by guards.
He effectively figured out germ theory and how to combat it. And was so angry at the medical community for not accepting his conclusions that he wrote enough irate letters attacking them that they locked him up, beat him, and he died of an infection. He basically was the guy who put medicine in the black. It was the case prior to him, that alternative medicine practitioners did better than traditional medicine because alternative medicine kept you away from traditional medicine which killed you. That you could bleed on a battlefield of a wound and stand a better chance of surviving than if you were taken to a clinic. Women would have children in the street rather than go to the clinic staffed with doctors and would beg to go to the midwife clinic. Prior to the 19th century, medicine was worse than voodoo because for as weird and nonsensical as voodoo is, they didn't kill you unlike medicine. Today we are very cognisant of this. The reason for the reliance on outpatient surgery is not high turn over and getting patients out as quick as possible for the sake of money, but because hospitals are not safe places to stay for long periods and the sooner they can boot you out the better your rates of avoiding post-op infections.