header

 

More links

AutoHotkey | Android | Arduino | COMM140Fractals | Grammar Checkers | Knots | A Million Dots Activity |  Processing | Processing for Scratch Users | Redbubble | Tutorials | Weather | World Time Meeting Planner | Favicon Generator.

Home > Tutorials > Processing > Processing Examples > Arecibo Message V001

Arecibo Message V001

 

Arecibo message

 

processing code

/*
 * The Message 
 * https://en.wikipedia.org/wiki/Arecibo_message
 * program by Rupert Russell
 * Licence Createive Commons 
 * Under the following terms:
 * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
 * ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
 * No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
 * https://en.wikipedia.org/wiki/Arecibo_message 
 */

float[][] distances;
float maxDistance;
int spacer;
int black; 
int white;
int rowe;
int column;
int pixelSize = 50;
int m; // message 
int[] message = {0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,1,0,0,0,1,1,0,0,0,0,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0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1,1,1,1,0,1,0,0,1,1,1,1,0,0,0};  // The Message

void setup() {
  // size( (pixelSize * 23) + 10, (pixelSize * 73) + 10 );
  size(1160, 3660);
  
  rectMode(CORNER);  // Default rectMode is CORNER
  strokeWeight(1);
  noLoop();  // Run once and stop
  black = 0;
  white = 255;
  m = 0 ; // start at the first pixel in the message
  
}

void draw() {
  
  
  for (int r = 0; r < 73; r = r +1){
    
    for (int c = 0; c < 23; c = c+1) { // 22 columns in the message
    if (message[m] == 0) {
      fill(white);  // Set fill to white  
      stroke(black);
    }
    if (message[m] == 1) {
      fill(black);  // Set fill to black
      stroke(black);
    }
      rect(c * pixelSize , r * pixelSize  , pixelSize , pixelSize );
      m = m + 1; // read the next pixel in the message
      
      if (c > 23) {
        r = r + 1;
        c = 0;
      } 
    }
    
    
  
  }
  save("the message px50.png");
  exit(); // end the program
  
}
code formatter

http://www.onformative.com/codeformatter/

 


 

APA citation:
Russell, R. (2016, July 05, 07:26 am). Arecibo Message V001.
     Retrieved November 22, 2024, from http://www.rupert.id.au/tutorials/processing/examples/Arecibo_message_001/index.php

Last refreshed: November 22 2024. 10:13.47 am

rupert dot russell at acu dot edu dot au Support Wikipedia

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.


720 visits since August 30, 2015