We’re rewarding the question askers & reputations are being recalculated! Read more.
4,349
reputation
2
25
28

Griffin

<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>
31
answers
4
questions
~129k
people reached
  • Member for 8 years, 3 months
  • 200 profile views
  • Last seen 12 mins ago

Top tags (33)

Score 239
Posts 25
Posts % 71
Score 119
Posts 8
Score 87
Posts 2
Score 31
Posts 3
Score 26
Posts 4
Score 23
Posts 2

Top posts (35) All Questions Answers | Votes Newest

View all questions and answers

Badges (55)

Gold

2

Rarest

Silver

25

Rarest

Bronze

28

Rarest