# Random Scrambler

**URL:** <https://forum.kirupa.com/t/random-scrambler/175282>\
**Category:** contests\
**Created:** [January 13, 2006, 3:09am UTC](https://forum.kirupa.com/t/random-scrambler/175282 "2006-01-13T03:09:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![E\_Slayer](https://avatars.discourse-cdn.com/v4/letter/e/71e660/32.png) [@E\_Slayer](https://forum.kirupa.com/u/E_Slayer)\
**Post date:** [January 13, 2006, 3:09am UTC](https://forum.kirupa.com/t/random-scrambler/175282/1 "2006-01-13T03:09:49Z")

</div>

Well, this entry is certainly well within regulations, since even including ‘}’ lines, it’s still only 25 lines. Kinda simplistic, I know, but it’s the first thing I came up with.

```auto
tiles = [[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, 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, 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]];
_root.createEmptyMovieClip("artist", 1);
function randomize() {
    for (i=0; i<=9; i++) {
        for (j=0; j<=9; j++) {
            tiles*[j] = random(3);
        }
    }
    _root.artist.clear();
    for (i=0; i<=9; i++) {
        for (j=0; j<=9; j++) {
            _root.artist.moveTo(i*40, j*40);
            _root.artist.beginFill(0xBBC9FF, 50*tiles*[j]);
            _root.artist.lineTo(i*40+40, j*40);
            _root.artist.lineTo(i*40+40, j*40+40);
            _root.artist.lineTo(i*40, j*40+40);
        }
    }
}
randomize();
function onEnterFrame() {
    while (_root.tiles[Math.floor(_root._xmouse/40)][Math.floor(_root._ymouse/40)] == 1 || _root.tiles[Math.floor(_root._xmouse/40)][Math.floor(_root._ymouse/40)] == 2) {
        _root.randomize();
    }
}

```

Just move the mouse to see it scramble the tiles.
