Munching squares: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
No edit summary
Line 2: Line 2:


=={{header|Mathematica}}==
=={{header|Mathematica}}==
[[File:xorpattern3.png|Mathematica output #1|thumb|200px]]
Output #1:
<lang Mathematica>
<lang Mathematica>
ListDensityPlot[
ListDensityPlot[
Line 8: Line 10:
2], {x, 0, 255}], {y, 0, 255}]]
2], {x, 0, 255}], {y, 0, 255}]]
</lang>
</lang>
output:
[[File:xorpattern3.png]]


[[File:xorpattern4.png|Mathematica output #2|thumb|200px]]
Output #2:
<lang Mathematica>
<lang Mathematica>
ArrayPlot[Array[BitXor, {511, 511}]]
ArrayPlot[Array[BitXor, {511, 511}]]
</lang>
</lang>
output:
[[File:xorpattern4.png]]

Revision as of 08:58, 28 November 2011

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

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>