Griffin's user avatar
Griffin's user avatar
Griffin's user avatar
Griffin
  • Member for 11 years, 1 month
  • Last seen this week
Stats
4,715
reputation
175k
reached
32
answers
4
questions
Loading…
About
<html>
<head>
<script type="text/javascript">

var alphabet = 'abcdefghijklmnopqrstuvwxyz'
var current = [];
var shapes = [];

function createBox( x, y ) {
    b = document.createElement( 'button' );
    b.style.position = 'absolute';
    b.style.width = '5px';
    b.style.height = '5px';
    b.style.left = ( 100 + 20*x ) + 'px';
    b.style.top = ( 100 + 20*y ) + 'px';
    b.tx = alphabet[x];
    b.ty = alphabet[y];
    b.onclick = function( e ) { current.push( [ e.target.tx, e.target.ty ] ) };
    return b;
}

function trasferCurrent( type ) {
    s = '';
    for ( i=0; i<current.length; i++ ) {
        s += current[ i ][0] + current[ i ][1];
    }
    shapes.push( s+type );
    current = [];
}

window.onload = function() {
    for ( x=0; x<10; x++ ) {
        for ( y=0; y<18; y++ ) {
            b = createBox( x, y );
            document.body.appendChild( b );
        }
    }
    b1 = document.getElementById( 'b1' );
    b2 = document.getElementById( 'b2' );
    b3 = document.getElementById( 'b3' );
    b4 = document.getElementById( 'b4' );
    b9 = document.getElementById( 'b9' );

    b1.onclick = b2.onclick = b3.onclick = b4.onclick = b9.onclick = function( e ) {
        trasferCurrent( e.target.id[1] );
    };
};
</script>

</head>
<body>
<button id="b1">end white</button>
<button id="b2">end black</button>
<button id="b3">end hole</button>
<button id="b4">end ghost</button>
<button id="b9">end line</button>
</body>
</html>
3
gold badges
29
silver badges
29
bronze badges
255
Score
26
Posts
72
Posts %
131
Score
8
Posts
22
Posts %
90
Score
2
Posts
6
Posts %
31
Score
3
Posts
8
Posts %
26
Score
5
Posts
14
Posts %
23
Score
2
Posts
6
Posts %
Top posts
View all questions and answers
answer
87
Aug 19, 2011
question
76
Aug 13, 2011
answer
22
Mar 16, 2012
answer
18
Mar 27, 2012
answer
13
Jun 26, 2012
answer
12
Jul 21, 2012
answer
7
Jan 16, 2013
answer
6
Jul 30, 2012