Munching squares: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
No edit summary
Line 1: Line 1:
{{task|Raster graphics operations}}[[Category:Graphics algorithms]]
{{task|Raster graphics operations}}[[Category:Graphics algorithms]]
Render a graphical pattern where each pixel is colored by 'x xor y'


=={{header|Mathematica}}==
=={{header|Mathematica}}==

Revision as of 09:00, 28 November 2011

Task
Munching squares
You are encouraged to solve this task according to the task description, using any language you may know.

Render a graphical pattern where each pixel is colored by 'x xor y'

Mathematica

Mathematica output #1

Output #1: <lang Mathematica> ListDensityPlot[

Table[Table[
  FromDigits[BitXor[IntegerDigits[x, 2, 8], IntegerDigits[y, 2, 8]], 
   2], {x, 0, 255}], {y, 0, 255}]]

</lang>

Mathematica output #2

Output #2: <lang Mathematica> ArrayPlot[Array[BitXor, {511, 511}]] </lang>