Stuff.
authorEugen Sawin <sawine@me73.com>
Thu, 05 Jan 2012 17:03:06 +0100
changeset 80ba69edadfc4c
parent 79 72b5c635d6df
child 81 a76b2fb0f21f
Stuff.
books.html
dark.css
experiments.html
factory/create_page
factory/v2012/dark.css
factory/v2012/experiments.html
factory/v2012/frame.html
factory/v2012/script.js
howiwork.html
index.html
links.html
linksend.html
personalwork.html
resume.html
script.js
     1.1 --- a/books.html	Thu Jan 05 15:32:41 2012 +0100
     1.2 +++ b/books.html	Thu Jan 05 17:03:06 2012 +0100
     1.3 @@ -91,10 +91,8 @@
     1.4          </div>
     1.5          <div id="sidebar">
     1.6            <p>           
     1.7 -	    <a href="resume.html">
     1.8 -              <img src="images/me2.png" alt="me" class="float-left" height="70" width="70" />
     1.9 -            </a>            
    1.10 -            <br />I'm a programmer,<br />
    1.11 +	    <a href="resume.html" class="float-left"></a>            
    1.12 +            I'm a programmer,<br />
    1.13              a student of computer science,<br />
    1.14              a music enthusiast.<br />
    1.15              This is my site.
     2.1 --- a/dark.css	Thu Jan 05 15:32:41 2012 +0100
     2.2 +++ b/dark.css	Thu Jan 05 17:03:06 2012 +0100
     2.3 @@ -102,32 +102,6 @@
     2.4      border: 4px solid #262626;  
     2.5  } 
     2.6  
     2.7 -#logo {
     2.8 -    border-style: none; 
     2.9 -    position: relative;
    2.10 -    margin: 0; 
    2.11 -    padding: 0;
    2.12 -    color: #F8F8F8;    
    2.13 -    /* change the values of top and left to adjust the position of the logo*/
    2.14 -    top: 40px; 
    2.15 -    left: 25px;
    2.16 -    height: 100px;
    2.17 -    width: 670px;
    2.18 -}
    2.19 -
    2.20 -#sim {
    2.21 -    border-style: none; 
    2.22 -    position: relative;
    2.23 -    margin: 0; 
    2.24 -    padding: 0;
    2.25 -    color: #F8F8F8;    
    2.26 -    /* change the values of top and left to adjust the position of the logo*/
    2.27 -    top: 37px;
    2.28 -    left: 25px;
    2.29 -    height: 30px;
    2.30 -    width: 670px;
    2.31 -}
    2.32 -
    2.33  code {
    2.34      margin: 5px 0;
    2.35      padding: 15px;
    2.36 @@ -223,6 +197,32 @@
    2.37  /* ------------------------------------------
    2.38     LAYOUT
    2.39     ------------------------------------------- */ 
    2.40 +#logo {
    2.41 +    border-style: none; 
    2.42 +    position: relative;
    2.43 +    margin: 0; 
    2.44 +    padding: 0;
    2.45 +    color: #F8F8F8;    
    2.46 +    /* change the values of top and left to adjust the position of the logo*/
    2.47 +    top: 20px; 
    2.48 +    left: 25px;
    2.49 +    height: 100px;
    2.50 +    width: 670px;
    2.51 +}
    2.52 +
    2.53 +#sim {
    2.54 +    border-style: none;
    2.55 +    position: relative;
    2.56 +    margin: 0; 
    2.57 +    padding: 0;
    2.58 +    color: #F8F8F8;    
    2.59 +    /* change the values of top and left to adjust the position of the logo*/
    2.60 +    top: 20px;
    2.61 +    left: 25px;
    2.62 +    height: 50px;
    2.63 +    width: 670px;
    2.64 +}
    2.65 +
    2.66  #wrap { 
    2.67      position: relative;
    2.68      width: 1020px;
    2.69 @@ -239,9 +239,9 @@
    2.70  #header {
    2.71      position: relative;
    2.72      width: 1020px;	
    2.73 -    height: 150px;	
    2.74 +    height: 170px;	
    2.75      margin: 0; 
    2.76 -    padding: 0;			
    2.77 +    padding: 0;		
    2.78  }
    2.79  #header h1#logo-text a {
    2.80      position: absolute;
    2.81 @@ -408,6 +408,19 @@
    2.82  /*border: 4px solid #262626;*/
    2.83  }
    2.84  
    2.85 +#sidebar a {
    2.86 +    display: inline-block;
    2.87 +    border: 4px solid #262626;
    2.88 +    margin-right: 5px;
    2.89 +    background-image: url(images/me2.png);
    2.90 +    height: 64px;
    2.91 +    width: 64px;
    2.92 +}
    2.93 +
    2.94 +#sidebar a:hover {
    2.95 +    background-image: url(images/me.png);
    2.96 +}
    2.97 +
    2.98  #random_quote {  
    2.99      color: #c95723;
   2.100      font-style: italic;
     3.1 --- a/experiments.html	Thu Jan 05 15:32:41 2012 +0100
     3.2 +++ b/experiments.html	Thu Jan 05 17:03:06 2012 +0100
     3.3 @@ -37,7 +37,8 @@
     3.4            <p>
     3.5  <!--<img src="images/world.png" alt="world map" height="280" width="100%" />
     3.6  -->
     3.7 -<canvas id="mandelbrot" width="670" height="670" onclick="draw2(event);"></canvas> 
     3.8 +<canvas id="mandelbrot" width="670" height="670" onclick="draw2(event);" onload="draw(0, 0, 0, 0, 0);">
     3.9 +</canvas> 
    3.10  <button onclick="draw(0, -2, 0, 0, 0);">Left</button>
    3.11  <button onclick="draw(0, 2, 0, 0, 0);">Right</button>
    3.12  <button onclick="draw(0, 0, -2, 0, 0)">Up</button>
    3.13 @@ -53,10 +54,8 @@
    3.14          </div>
    3.15          <div id="sidebar">
    3.16            <p>           
    3.17 -	    <a href="resume.html">
    3.18 -              <img src="images/me2.png" alt="me" class="float-left" height="70" width="70" />
    3.19 -            </a>            
    3.20 -            <br />I'm a programmer,<br />
    3.21 +	    <a href="resume.html" class="float-left"></a>            
    3.22 +            I'm a programmer,<br />
    3.23              a student of computer science,<br />
    3.24              a music enthusiast.<br />
    3.25              This is my site.
     4.1 --- a/factory/create_page	Thu Jan 05 15:32:41 2012 +0100
     4.2 +++ b/factory/create_page	Thu Jan 05 17:03:06 2012 +0100
     4.3 @@ -5,7 +5,7 @@
     4.4  from optparse import OptionParser
     4.5  
     4.6  content_dir = "v2012"
     4.7 -content_files = ("index.html", "resume.html", "howiwork.html", "personalwork.html", "books.html", "links.html", "experiments.html", "linksend.html")
     4.8 +content_files = ("index.html", "resume.html", "howiwork.html", "personalwork.html", "books.html", "links.html", "experiments.html", "linksend.html", "gameoflife.html")
     4.9  
    4.10  def create_page(frame_filename, content_filename, output_filename):
    4.11     frame_file = open(frame_filename, "r")
     5.1 --- a/factory/v2012/dark.css	Thu Jan 05 15:32:41 2012 +0100
     5.2 +++ b/factory/v2012/dark.css	Thu Jan 05 17:03:06 2012 +0100
     5.3 @@ -102,32 +102,6 @@
     5.4      border: 4px solid #262626;  
     5.5  } 
     5.6  
     5.7 -#logo {
     5.8 -    border-style: none; 
     5.9 -    position: relative;
    5.10 -    margin: 0; 
    5.11 -    padding: 0;
    5.12 -    color: #F8F8F8;    
    5.13 -    /* change the values of top and left to adjust the position of the logo*/
    5.14 -    top: 40px; 
    5.15 -    left: 25px;
    5.16 -    height: 100px;
    5.17 -    width: 670px;
    5.18 -}
    5.19 -
    5.20 -#sim {
    5.21 -    border-style: none; 
    5.22 -    position: relative;
    5.23 -    margin: 0; 
    5.24 -    padding: 0;
    5.25 -    color: #F8F8F8;    
    5.26 -    /* change the values of top and left to adjust the position of the logo*/
    5.27 -    top: 37px;
    5.28 -    left: 25px;
    5.29 -    height: 30px;
    5.30 -    width: 670px;
    5.31 -}
    5.32 -
    5.33  code {
    5.34      margin: 5px 0;
    5.35      padding: 15px;
    5.36 @@ -223,6 +197,32 @@
    5.37  /* ------------------------------------------
    5.38     LAYOUT
    5.39     ------------------------------------------- */ 
    5.40 +#logo {
    5.41 +    border-style: none; 
    5.42 +    position: relative;
    5.43 +    margin: 0; 
    5.44 +    padding: 0;
    5.45 +    color: #F8F8F8;    
    5.46 +    /* change the values of top and left to adjust the position of the logo*/
    5.47 +    top: 20px; 
    5.48 +    left: 25px;
    5.49 +    height: 100px;
    5.50 +    width: 670px;
    5.51 +}
    5.52 +
    5.53 +#sim {
    5.54 +    border-style: none;
    5.55 +    position: relative;
    5.56 +    margin: 0; 
    5.57 +    padding: 0;
    5.58 +    color: #F8F8F8;    
    5.59 +    /* change the values of top and left to adjust the position of the logo*/
    5.60 +    top: 20px;
    5.61 +    left: 25px;
    5.62 +    height: 50px;
    5.63 +    width: 670px;
    5.64 +}
    5.65 +
    5.66  #wrap { 
    5.67      position: relative;
    5.68      width: 1020px;
    5.69 @@ -239,9 +239,9 @@
    5.70  #header {
    5.71      position: relative;
    5.72      width: 1020px;	
    5.73 -    height: 150px;	
    5.74 +    height: 170px;	
    5.75      margin: 0; 
    5.76 -    padding: 0;			
    5.77 +    padding: 0;		
    5.78  }
    5.79  #header h1#logo-text a {
    5.80      position: absolute;
    5.81 @@ -408,6 +408,19 @@
    5.82  /*border: 4px solid #262626;*/
    5.83  }
    5.84  
    5.85 +#sidebar a {
    5.86 +    display: inline-block;
    5.87 +    border: 4px solid #262626;
    5.88 +    margin-right: 5px;
    5.89 +    background-image: url(images/me2.png);
    5.90 +    height: 64px;
    5.91 +    width: 64px;
    5.92 +}
    5.93 +
    5.94 +#sidebar a:hover {
    5.95 +    background-image: url(images/me.png);
    5.96 +}
    5.97 +
    5.98  #random_quote {  
    5.99      color: #c95723;
   5.100      font-style: italic;
     6.1 --- a/factory/v2012/experiments.html	Thu Jan 05 15:32:41 2012 +0100
     6.2 +++ b/factory/v2012/experiments.html	Thu Jan 05 17:03:06 2012 +0100
     6.3 @@ -1,7 +1,8 @@
     6.4  <p>
     6.5  <!--<img src="images/world.png" alt="world map" height="280" width="100%" />
     6.6  -->
     6.7 -<canvas id="mandelbrot" width="670" height="670" onclick="draw2(event);"></canvas> 
     6.8 +<canvas id="mandelbrot" width="670" height="670" onclick="draw2(event);" onload="draw(0, 0, 0, 0, 0);">
     6.9 +</canvas> 
    6.10  <button onclick="draw(0, -2, 0, 0, 0);">Left</button>
    6.11  <button onclick="draw(0, 2, 0, 0, 0);">Right</button>
    6.12  <button onclick="draw(0, 0, -2, 0, 0)">Up</button>
     7.1 --- a/factory/v2012/frame.html	Thu Jan 05 15:32:41 2012 +0100
     7.2 +++ b/factory/v2012/frame.html	Thu Jan 05 17:03:06 2012 +0100
     7.3 @@ -38,10 +38,8 @@
     7.4          </div>
     7.5          <div id="sidebar">
     7.6            <p>           
     7.7 -	    <a href="resume.html">
     7.8 -              <img src="images/me2.png" alt="me" class="float-left" height="70" width="70" />
     7.9 -            </a>            
    7.10 -            <br />I'm a programmer,<br />
    7.11 +	    <a href="resume.html" class="float-left"></a>            
    7.12 +            I'm a programmer,<br />
    7.13              a student of computer science,<br />
    7.14              a music enthusiast.<br />
    7.15              This is my site.
     8.1 --- a/factory/v2012/script.js	Thu Jan 05 15:32:41 2012 +0100
     8.2 +++ b/factory/v2012/script.js	Thu Jan 05 17:03:06 2012 +0100
     8.3 @@ -1,9 +1,10 @@
     8.4  var QUOTES_NUMBER = 39;
     8.5  var SERVER = "http://" + window.location.hostname + ":" + window.location.port;
     8.6  var simulation;
     8.7 +var gameoflife;
     8.8  
     8.9  $(document).ready(function() {   
    8.10 -    simulation = new Simulation(document.getElementById("sim"));  
    8.11 +    simulation = new Simulation(document.getElementById("sim"), 670, 50);  
    8.12      var image = new Image();
    8.13      image.onload = init_logo;
    8.14      image.src = "images/logobase.png";
    8.15 @@ -146,10 +147,10 @@
    8.16      // context.fillStyle = green.str();
    8.17      // console.log((found["max_x"] - found["min_x"]) / 2 + found["min_x"] - 2);
    8.18      // context.fillRect((found["max_x"]-found["min_x"])/2+found["min_x"]-1, 95, 2, 5);  
    8.19 -    drawMenuLines();   
    8.20 +    draw_menu_lines();   
    8.21  }
    8.22  
    8.23 -function drawMenuLines() {
    8.24 +function draw_menu_lines() {
    8.25      var canvas = document.getElementById("logo");
    8.26      var context = canvas.getContext("2d");  
    8.27      var image = context.getImageData(0, 0, menu_width, menu_height);
    8.28 @@ -224,6 +225,40 @@
    8.29      context.clearRect(menu_splits[2] - 1, 0, 2, menu_height - 1);
    8.30  }
    8.31  
    8.32 +function draw_sim_lines() {
    8.33 +    var w = 670;
    8.34 +    var h = 50;
    8.35 +    var canvas = document.getElementById("sim");
    8.36 +    var context = canvas.getContext("2d");  
    8.37 +    var image = context.getImageData(0, 0, w, h);
    8.38 +    var pixels = image.data;
    8.39 +    context.lineCap = "round";
    8.40 +    context.lineWidth = 1;
    8.41 +    var colour1a = new Colour(0, 0, 0, 0.1);
    8.42 +    context.beginPath();   
    8.43 +    context.moveTo(0, h - 1);
    8.44 +    context.lineTo(w - 1, h - 1);   
    8.45 +    context.closePath();  
    8.46 +    context.strokeStyle = colour1a.str();
    8.47 +    context.stroke(); 
    8.48 +   
    8.49 +    var colour1b = new Colour(0, 0, 0, 0.05);  
    8.50 +    context.beginPath();   
    8.51 +    context.moveTo(50, h - 1);
    8.52 +    context.lineTo(w - 51, h - 1);   
    8.53 +    context.closePath();  
    8.54 +    context.strokeStyle = colour1b.str();
    8.55 +    context.stroke();
    8.56 +   
    8.57 +    var colour1d = new Colour(0, 0, 0, 0.05);  
    8.58 +    context.beginPath();   
    8.59 +    context.moveTo(10, h - 1);
    8.60 +    context.lineTo(w - 11, h - 1);   
    8.61 +    context.closePath();  
    8.62 +    context.strokeStyle = colour1d.str();
    8.63 +    context.stroke();   
    8.64 +}
    8.65 +
    8.66  function update_logo() {
    8.67      var canvas = document.getElementById("logo");
    8.68      var context = canvas.getContext("2d");  
    8.69 @@ -241,6 +276,17 @@
    8.70      context.putImageData(image, 0, 0);
    8.71  }
    8.72  
    8.73 +function init_gameoflife() {
    8.74 +    var canvas = document.getElementById("gameoflife"); alert("h");
    8.75 +    if (cavans) {
    8.76 +        gameoflife = new Simulation(canvas, 670, 670);
    8.77 +        $("#gameoflife").mousemove(function(event) { 
    8.78 +            gameoflife.mouse_moved(mouse_pos(event, "#gameoflife")); 
    8.79 +        });
    8.80 +        alert("h");
    8.81 +    }
    8.82 +}
    8.83 +
    8.84  function Colour(r, g, b, a) {
    8.85      this.r = r;
    8.86      this.g = g;
    8.87 @@ -490,6 +536,10 @@
    8.88  function update() {
    8.89      simulation.update();
    8.90      simulation.draw();
    8.91 +    if (gameoflife) {
    8.92 +        gameoflife.update();
    8.93 +        gameoflife.draw();
    8.94 +    }
    8.95  }
    8.96  
    8.97  function Grid(width, height, cell_size) {
    8.98 @@ -510,8 +560,8 @@
    8.99      return this.cells[y][x];
   8.100  }
   8.101  Grid.prototype.pick_cell = function(x, y) {
   8.102 -    var lx = parseInt(x / this.cell_size);
   8.103 -    var ly = parseInt(y / this.cell_size);
   8.104 +    var lx = parseInt(x / this.cell_size - 0.5);
   8.105 +    var ly = parseInt(y / this.cell_size - 0.5);
   8.106      return this.cells[ly][lx];
   8.107  }
   8.108  
   8.109 @@ -567,19 +617,20 @@
   8.110      return d;
   8.111  }
   8.112  
   8.113 -function Simulation(canvas) {
   8.114 +function Simulation(canvas, w, h) {
   8.115      this.last_update = 0;
   8.116      this.last_draw = 0;
   8.117      this.last_mouse_moved = 0;
   8.118      this.redraw = new Array();   
   8.119      this.canvas = canvas;
   8.120 -    this.canvas.width = 670;
   8.121 -    this.canvas.height = 30;
   8.122 +    this.canvas.width = w;
   8.123 +    this.canvas.height = h;
   8.124      this.context = canvas.getContext("2d");    
   8.125      this.pos_queue = new Array();
   8.126      this.cell_queue = new Array();  
   8.127      var cell_size = 3;
   8.128      this.grid = new Grid(this.canvas.width, this.canvas.height, cell_size);
   8.129 +    draw_sim_lines();
   8.130  }
   8.131  Simulation.prototype.draw = function() {
   8.132      var now = $.now();
     9.1 --- a/howiwork.html	Thu Jan 05 15:32:41 2012 +0100
     9.2 +++ b/howiwork.html	Thu Jan 05 17:03:06 2012 +0100
     9.3 @@ -114,10 +114,8 @@
     9.4          </div>
     9.5          <div id="sidebar">
     9.6            <p>           
     9.7 -	    <a href="resume.html">
     9.8 -              <img src="images/me2.png" alt="me" class="float-left" height="70" width="70" />
     9.9 -            </a>            
    9.10 -            <br />I'm a programmer,<br />
    9.11 +	    <a href="resume.html" class="float-left"></a>            
    9.12 +            I'm a programmer,<br />
    9.13              a student of computer science,<br />
    9.14              a music enthusiast.<br />
    9.15              This is my site.
    10.1 --- a/index.html	Thu Jan 05 15:32:41 2012 +0100
    10.2 +++ b/index.html	Thu Jan 05 17:03:06 2012 +0100
    10.3 @@ -42,10 +42,8 @@
    10.4          </div>
    10.5          <div id="sidebar">
    10.6            <p>           
    10.7 -	    <a href="resume.html">
    10.8 -              <img src="images/me2.png" alt="me" class="float-left" height="70" width="70" />
    10.9 -            </a>            
   10.10 -            <br />I'm a programmer,<br />
   10.11 +	    <a href="resume.html" class="float-left"></a>            
   10.12 +            I'm a programmer,<br />
   10.13              a student of computer science,<br />
   10.14              a music enthusiast.<br />
   10.15              This is my site.
    11.1 --- a/links.html	Thu Jan 05 15:32:41 2012 +0100
    11.2 +++ b/links.html	Thu Jan 05 17:03:06 2012 +0100
    11.3 @@ -87,10 +87,8 @@
    11.4          </div>
    11.5          <div id="sidebar">
    11.6            <p>           
    11.7 -	    <a href="resume.html">
    11.8 -              <img src="images/me2.png" alt="me" class="float-left" height="70" width="70" />
    11.9 -            </a>            
   11.10 -            <br />I'm a programmer,<br />
   11.11 +	    <a href="resume.html" class="float-left"></a>            
   11.12 +            I'm a programmer,<br />
   11.13              a student of computer science,<br />
   11.14              a music enthusiast.<br />
   11.15              This is my site.
    12.1 --- a/linksend.html	Thu Jan 05 15:32:41 2012 +0100
    12.2 +++ b/linksend.html	Thu Jan 05 17:03:06 2012 +0100
    12.3 @@ -82,10 +82,8 @@
    12.4          </div>
    12.5          <div id="sidebar">
    12.6            <p>           
    12.7 -	    <a href="resume.html">
    12.8 -              <img src="images/me2.png" alt="me" class="float-left" height="70" width="70" />
    12.9 -            </a>            
   12.10 -            <br />I'm a programmer,<br />
   12.11 +	    <a href="resume.html" class="float-left"></a>            
   12.12 +            I'm a programmer,<br />
   12.13              a student of computer science,<br />
   12.14              a music enthusiast.<br />
   12.15              This is my site.
    13.1 --- a/personalwork.html	Thu Jan 05 15:32:41 2012 +0100
    13.2 +++ b/personalwork.html	Thu Jan 05 17:03:06 2012 +0100
    13.3 @@ -184,10 +184,8 @@
    13.4          </div>
    13.5          <div id="sidebar">
    13.6            <p>           
    13.7 -	    <a href="resume.html">
    13.8 -              <img src="images/me2.png" alt="me" class="float-left" height="70" width="70" />
    13.9 -            </a>            
   13.10 -            <br />I'm a programmer,<br />
   13.11 +	    <a href="resume.html" class="float-left"></a>            
   13.12 +            I'm a programmer,<br />
   13.13              a student of computer science,<br />
   13.14              a music enthusiast.<br />
   13.15              This is my site.
    14.1 --- a/resume.html	Thu Jan 05 15:32:41 2012 +0100
    14.2 +++ b/resume.html	Thu Jan 05 17:03:06 2012 +0100
    14.3 @@ -88,10 +88,8 @@
    14.4          </div>
    14.5          <div id="sidebar">
    14.6            <p>           
    14.7 -	    <a href="resume.html">
    14.8 -              <img src="images/me2.png" alt="me" class="float-left" height="70" width="70" />
    14.9 -            </a>            
   14.10 -            <br />I'm a programmer,<br />
   14.11 +	    <a href="resume.html" class="float-left"></a>            
   14.12 +            I'm a programmer,<br />
   14.13              a student of computer science,<br />
   14.14              a music enthusiast.<br />
   14.15              This is my site.
    15.1 --- a/script.js	Thu Jan 05 15:32:41 2012 +0100
    15.2 +++ b/script.js	Thu Jan 05 17:03:06 2012 +0100
    15.3 @@ -1,9 +1,10 @@
    15.4  var QUOTES_NUMBER = 39;
    15.5  var SERVER = "http://" + window.location.hostname + ":" + window.location.port;
    15.6  var simulation;
    15.7 +var gameoflife;
    15.8  
    15.9  $(document).ready(function() {   
   15.10 -    simulation = new Simulation(document.getElementById("sim"));  
   15.11 +    simulation = new Simulation(document.getElementById("sim"), 670, 50);  
   15.12      var image = new Image();
   15.13      image.onload = init_logo;
   15.14      image.src = "images/logobase.png";
   15.15 @@ -146,10 +147,10 @@
   15.16      // context.fillStyle = green.str();
   15.17      // console.log((found["max_x"] - found["min_x"]) / 2 + found["min_x"] - 2);
   15.18      // context.fillRect((found["max_x"]-found["min_x"])/2+found["min_x"]-1, 95, 2, 5);  
   15.19 -    drawMenuLines();   
   15.20 +    draw_menu_lines();   
   15.21  }
   15.22  
   15.23 -function drawMenuLines() {
   15.24 +function draw_menu_lines() {
   15.25      var canvas = document.getElementById("logo");
   15.26      var context = canvas.getContext("2d");  
   15.27      var image = context.getImageData(0, 0, menu_width, menu_height);
   15.28 @@ -224,6 +225,40 @@
   15.29      context.clearRect(menu_splits[2] - 1, 0, 2, menu_height - 1);
   15.30  }
   15.31  
   15.32 +function draw_sim_lines() {
   15.33 +    var w = 670;
   15.34 +    var h = 50;
   15.35 +    var canvas = document.getElementById("sim");
   15.36 +    var context = canvas.getContext("2d");  
   15.37 +    var image = context.getImageData(0, 0, w, h);
   15.38 +    var pixels = image.data;
   15.39 +    context.lineCap = "round";
   15.40 +    context.lineWidth = 1;
   15.41 +    var colour1a = new Colour(0, 0, 0, 0.1);
   15.42 +    context.beginPath();   
   15.43 +    context.moveTo(0, h - 1);
   15.44 +    context.lineTo(w - 1, h - 1);   
   15.45 +    context.closePath();  
   15.46 +    context.strokeStyle = colour1a.str();
   15.47 +    context.stroke(); 
   15.48 +   
   15.49 +    var colour1b = new Colour(0, 0, 0, 0.05);  
   15.50 +    context.beginPath();   
   15.51 +    context.moveTo(50, h - 1);
   15.52 +    context.lineTo(w - 51, h - 1);   
   15.53 +    context.closePath();  
   15.54 +    context.strokeStyle = colour1b.str();
   15.55 +    context.stroke();
   15.56 +   
   15.57 +    var colour1d = new Colour(0, 0, 0, 0.05);  
   15.58 +    context.beginPath();   
   15.59 +    context.moveTo(10, h - 1);
   15.60 +    context.lineTo(w - 11, h - 1);   
   15.61 +    context.closePath();  
   15.62 +    context.strokeStyle = colour1d.str();
   15.63 +    context.stroke();   
   15.64 +}
   15.65 +
   15.66  function update_logo() {
   15.67      var canvas = document.getElementById("logo");
   15.68      var context = canvas.getContext("2d");  
   15.69 @@ -241,6 +276,17 @@
   15.70      context.putImageData(image, 0, 0);
   15.71  }
   15.72  
   15.73 +function init_gameoflife() {
   15.74 +    var canvas = document.getElementById("gameoflife"); alert("h");
   15.75 +    if (cavans) {
   15.76 +        gameoflife = new Simulation(canvas, 670, 670);
   15.77 +        $("#gameoflife").mousemove(function(event) { 
   15.78 +            gameoflife.mouse_moved(mouse_pos(event, "#gameoflife")); 
   15.79 +        });
   15.80 +        alert("h");
   15.81 +    }
   15.82 +}
   15.83 +
   15.84  function Colour(r, g, b, a) {
   15.85      this.r = r;
   15.86      this.g = g;
   15.87 @@ -490,6 +536,10 @@
   15.88  function update() {
   15.89      simulation.update();
   15.90      simulation.draw();
   15.91 +    if (gameoflife) {
   15.92 +        gameoflife.update();
   15.93 +        gameoflife.draw();
   15.94 +    }
   15.95  }
   15.96  
   15.97  function Grid(width, height, cell_size) {
   15.98 @@ -510,8 +560,8 @@
   15.99      return this.cells[y][x];
  15.100  }
  15.101  Grid.prototype.pick_cell = function(x, y) {
  15.102 -    var lx = parseInt(x / this.cell_size);
  15.103 -    var ly = parseInt(y / this.cell_size);
  15.104 +    var lx = parseInt(x / this.cell_size - 0.5);
  15.105 +    var ly = parseInt(y / this.cell_size - 0.5);
  15.106      return this.cells[ly][lx];
  15.107  }
  15.108  
  15.109 @@ -567,19 +617,20 @@
  15.110      return d;
  15.111  }
  15.112  
  15.113 -function Simulation(canvas) {
  15.114 +function Simulation(canvas, w, h) {
  15.115      this.last_update = 0;
  15.116      this.last_draw = 0;
  15.117      this.last_mouse_moved = 0;
  15.118      this.redraw = new Array();   
  15.119      this.canvas = canvas;
  15.120 -    this.canvas.width = 670;
  15.121 -    this.canvas.height = 30;
  15.122 +    this.canvas.width = w;
  15.123 +    this.canvas.height = h;
  15.124      this.context = canvas.getContext("2d");    
  15.125      this.pos_queue = new Array();
  15.126      this.cell_queue = new Array();  
  15.127      var cell_size = 3;
  15.128      this.grid = new Grid(this.canvas.width, this.canvas.height, cell_size);
  15.129 +    draw_sim_lines();
  15.130  }
  15.131  Simulation.prototype.draw = function() {
  15.132      var now = $.now();