Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Mobile Phone Email to Text Message Gateways

   1  
   2  AT&T
   3    number@mobile.att.net
   4  CellularOne
   5    number@mobile.celloneusa.com    
   6  Cingular
   7    number@mobile.mycingular.com
   8  Nextel
   9    number@messaging.nextel.com
  10  Sprint
  11    number@messaging.sprintpcs.com
  12  T-Mobile
  13    number@tmomail.net
  14  US Cellular
  15    number@email.uscc.net
  16  Verizon
  17    number@vtext.com
  18  Virgin Mobile
  19    number@vmobl.com

Wolfram-style cellular automata

Modified from Rick Muller's recipe
   1  
   2  from appuifw import *
   3  import e32, random
   4  
   5  app.body = c = Canvas()
   6  w, h =  c.size
   7  
   8  rule = [(22/pow(2,i)) % 2 for i in range(8)]  # rule 22
   9  first_row = [0] * w
  10  first_row[w/2] = 1   # start with one point
  11  # first_row = [random.randint(0,1) for i in range(w)]   # random start
  12  rows = [first_row]
  13  
  14  # iterate more rows
  15  for i in range(h-1):
  16      d = rows[-1]  # previous row data
  17      new = [rule[ 4*d[(j-1)%w] +2*d[j] +d[(j+1)%w]] for j in range(w)]
  18      rows.append(new)
  19  
  20  # render
  21  for y in range(h):
  22      for x in range(w):
  23          if rows[y][x]: c.point((x,y), 0)
  24  
  25  e32.ao_sleep(5)    # wait 5 sec then quit

See the screenshot.
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS