
- Flashにおいてドットパターン表現はあまり模索されていません。付属のBitmapPatternBuilderというクラスを使って、flashにおけるドットパターンを用いた表現の可能性を模索してください。

- Dot pattern expression of flash is yet-to-be explored. Pursue the possibility of dot pattern expression, with given class "BitmapPatternBuilder."

- CHECKMATEはKingの称号をもつActionScript Masterたちの、問題にFORKする(プログラムを書き換える)ことで、回答していくFlash詰め将棋です。
下記にあるKingの書いたActionScriptにForkボタンをクリックして、プログラムを改造して、Kingをうならせてください。

- CHECKMATE is chess like quiz solving contest by FORKing, meaning re-writing programs, to the quiz statement given by Kings, masters of ActionScript. Click "Fork" button and re-write scripts written by King, and impress him.
CHECKMATE
fladdict challenge for professionals forked from: fladdict challenge for professionals
- // forked from checkmate's fladdict challenge for professionals
- /**
- * Theme:
- * Play with BitmapPatterBuilder.
- * Purpose of this trial is to find the possibility of the dot pattern.
- *
- * by Takayuki Fukatsu aka fladdict
- **/
- package {
- import flash.display.Bitmap;
- import flash.display.BitmapData;
- import flash.display.Graphics;
- import flash.display.Sprite;
- import flash.display.StageScaleMode;
- public class Professional extends Sprite {
- public function Professional() {
- stage.scaleMode = StageScaleMode.NO_SCALE;
- //generate bitmap pattern.
- var pattern:BitmapData = sample1();
- //var pattern:BitmapData = sample2();
- //var pattern:BitmapData = sample3();
- var g:Graphics = graphics;
- g.beginBitmapFill(pattern);
- g.drawRect(0,0,480,480);
- g.endFill();
- }
- //most simple patern
- public function sample1():BitmapData{
- return BitmapPatternBuilder.build(
- [[1,0],
- [0,1]],
- [0xff000000, 0xffffffff]
- );
- }
- //larger pattern
- public function sample2():BitmapData{
- return BitmapPatternBuilder.build(
- [[1,0,0,1,],
- [0,1,1,0,],
- [0,1,1,0,],
- [1,0,0,1,]],
- [0xff000000, 0xffffff00]
- );
- }
- //complex pattern
- public function sample3():BitmapData{
- return BitmapPatternBuilder.build(
- [[1,1,1,1,1,0],
- [1,2,2,2,1,0],
- [1,2,1,2,1,0],
- [1,2,2,2,1,0],
- [1,1,1,1,1,0],
- [0,0,0,0,0,0]],
- [0xff000000, 0xffffffff, 0xffff0000]
- );
- }
- }
- }
- /**-----------------------------------------------------
- * Use following BitmapPatternBuilder class
- *
- * DO NOT CHANGE any codes below this comment.
- *
- * -----------------------------------------------------
- */
- import flash.display.Bitmap;
- import flash.display.BitmapData;
- import flash.display.Graphics;
- class BitmapPatternBuilder{
- /**
- * creates BitmapData filled with dot pattern.
- * First parameter is 2d array that contains color index for each pixels;
- * Second parameter contains color reference table.
- *
- * @parameter pattern:Array 2d array that contains color index for each pixel.
- * @parameter colors:Array 1d array that contains color table.
- * @returns BitmapData
- */
- public static function build(pattern:Array, colors:Array):BitmapData{
- var bitmapW:int = pattern[0].length;
- var bitmapH:int = pattern.length;
- var bmd:BitmapData = new BitmapData(bitmapW,bitmapH,true,0x000000);
- for(var yy:int=0; yy<bitmapH; yy++){
- for(var xx:int=0; xx<bitmapW; xx++){
- var color:int = colors[pattern[yy][xx]];
- bmd.setPixel32(xx, yy, color);
- }
- }
- return bmd;
- }
- /**
- * short cut function for Graphics.beginBitmapFill with pattern.
- */
- public static function beginBitmapFill(pattern:Array, colors:Array, graphics:Graphics):void{
- var bmd:BitmapData = build(pattern, colors);
- graphics.beginBitmapFill(bmd);
- bmd.dispose();
- }
- }
fladdict challenge for professionals forked from: fladdict challenge for professionals
- // forked from checkmate's fladdict challenge for professionals
- /**
- * Theme:
- * Play with BitmapPatterBuilder.
- * Purpose of this trial is to find the possibility of the dot pattern.
- *
- * by Takayuki Fukatsu aka fladdict
- **/
- package {
- import flash.display.Bitmap;
- import flash.display.BitmapData;
- import flash.display.Graphics;
- import flash.display.Sprite;
- import flash.display.StageScaleMode;
- public class Professional extends Sprite {
- public function Professional() {
- stage.scaleMode = StageScaleMode.NO_SCALE;
- //generate bitmap pattern.
- var pattern:BitmapData = sample1();
- //var pattern:BitmapData = sample2();
- //var pattern:BitmapData = sample3();
- var g:Graphics = graphics;
- g.beginBitmapFill(pattern);
- g.drawRect(0,0,480,480);
- g.endFill();
- }
- //most simple patern
- public function sample1():BitmapData{
- return BitmapPatternBuilder.build(
- [[1,0],
- [0,1]],
- [0xff000000, 0xffffffff]
- );
- }
- //larger pattern
- public function sample2():BitmapData{
- return BitmapPatternBuilder.build(
- [[1,0,0,1,],
- [0,1,1,0,],
- [0,1,1,0,],
- [1,0,0,1,]],
- [0xff000000, 0xffffff00]
- );
- }
- //complex pattern
- public function sample3():BitmapData{
- return BitmapPatternBuilder.build(
- [[1,1,1,1,1,0],
- [1,2,2,2,1,0],
- [1,2,1,2,1,0],
- [1,2,2,2,1,0],
- [1,1,1,1,1,0],
- [0,0,0,0,0,0]],
- [0xff000000, 0xffffffff, 0xffff0000]
- );
- }
- }
- }
- /**-----------------------------------------------------
- * Use following BitmapPatternBuilder class
- *
- * DO NOT CHANGE any codes below this comment.
- *
- * -----------------------------------------------------
- */
- import flash.display.Bitmap;
- import flash.display.BitmapData;
- import flash.display.Graphics;
- class BitmapPatternBuilder{
- /**
- * creates BitmapData filled with dot pattern.
- * First parameter is 2d array that contains color index for each pixels;
- * Second parameter contains color reference table.
- *
- * @parameter pattern:Array 2d array that contains color index for each pixel.
- * @parameter colors:Array 1d array that contains color table.
- * @returns BitmapData
- */
- public static function build(pattern:Array, colors:Array):BitmapData{
- var bitmapW:int = pattern[0].length;
- var bitmapH:int = pattern.length;
- var bmd:BitmapData = new BitmapData(bitmapW,bitmapH,true,0x000000);
- for(var yy:int=0; yy<bitmapH; yy++){
- for(var xx:int=0; xx<bitmapW; xx++){
- var color:int = colors[pattern[yy][xx]];
- bmd.setPixel32(xx, yy, color);
- }
- }
- return bmd;
- }
- /**
- * short cut function for Graphics.beginBitmapFill with pattern.
- */
- public static function beginBitmapFill(pattern:Array, colors:Array, graphics:Graphics):void{
- var bmd:BitmapData = build(pattern, colors);
- graphics.beginBitmapFill(bmd);
- bmd.dispose();
- }
- }
fladdict challenge for professionals forked from: fladdict challenge for professionals
- // forked from checkmate's fladdict challenge for professionals
- /**
- * Theme:
- * Play with BitmapPatterBuilder.
- * Purpose of this trial is to find the possibility of the dot pattern.
- *
- * by Takayuki Fukatsu aka fladdict
- **/
- package {
- import flash.display.Bitmap;
- import flash.display.BitmapData;
- import flash.display.Graphics;
- import flash.display.Sprite;
- import flash.display.StageScaleMode;
- public class Professional extends Sprite {
- public function Professional() {
- stage.scaleMode = StageScaleMode.NO_SCALE;
- //generate bitmap pattern.
- //var pattern:BitmapData = sample1();
- var pattern:BitmapData = sample2();
- //var pattern:BitmapData = sample3();
- var g:Graphics = graphics;
- g.beginBitmapFill(pattern);
- g.drawRect(0,0,480,480);
- g.endFill();
- }
- //most simple patern
- public function sample1():BitmapData{
- return BitmapPatternBuilder.build(
- [[1,0],
- [0,1]],
- [0xff000000, 0xffffffff]
- );
- }
- //larger pattern
- public function sample2():BitmapData{
- return BitmapPatternBuilder.build(
- [[1,0,0,1,],
- [0,1,1,0,],
- [0,1,1,0,],
- [1,0,0,1,]],
- [0xff000000, 0xffffff00]
- );
- }
- //complex pattern
- public function sample3():BitmapData{
- return BitmapPatternBuilder.build(
- [[1,1,1,1,1,0],
- [1,2,2,2,1,0],
- [1,2,1,2,1,0],
- [1,2,2,2,1,0],
- [1,1,1,1,1,0],
- [0,0,0,0,0,0]],
- [0xff000000, 0xffffffff, 0xffff0000]
- );
- }
- }
- }
- /**-----------------------------------------------------
- * Use following BitmapPatternBuilder class
- *
- * DO NOT CHANGE any codes below this comment.
- *
- * -----------------------------------------------------
- */
- import flash.display.Bitmap;
- import flash.display.BitmapData;
- import flash.display.Graphics;
- class BitmapPatternBuilder{
- /**
- * creates BitmapData filled with dot pattern.
- * First parameter is 2d array that contains color index for each pixels;
- * Second parameter contains color reference table.
- *
- * @parameter pattern:Array 2d array that contains color index for each pixel.
- * @parameter colors:Array 1d array that contains color table.
- * @returns BitmapData
- */
- public static function build(pattern:Array, colors:Array):BitmapData{
- var bitmapW:int = pattern[0].length;
- var bitmapH:int = pattern.length;
- var bmd:BitmapData = new BitmapData(bitmapW,bitmapH,true,0x000000);
- for(var yy:int=0; yy<bitmapH; yy++){
- for(var xx:int=0; xx<bitmapW; xx++){
- var color:int = colors[pattern[yy][xx]];
- bmd.setPixel32(xx, yy, color);
- }
- }
- return bmd;
- }
- /**
- * short cut function for Graphics.beginBitmapFill with pattern.
- */
- public static function beginBitmapFill(pattern:Array, colors:Array, graphics:Graphics):void{
- var bmd:BitmapData = build(pattern, colors);
- graphics.beginBitmapFill(bmd);
- bmd.dispose();
- }
- }
fladdict challenge for professionals マトリックスっぽいの
- /**
- * Theme:
- * Play with BitmapPatterBuilder.
- * Purpose of this trial is to find the possibility of the dot pattern.
- *
- * by Takayuki Fukatsu aka fladdict
- **/
- package {
- import com.flashdynamix.motion.Tweensy;
- import com.flashdynamix.motion.TweensyTimeline;
- import fl.motion.easing.Cubic;
- import flash.display.Bitmap;
- import flash.display.BitmapData;
- import flash.display.BitmapDataChannel;
- import flash.display.Graphics;
- import flash.display.Shape;
- import flash.display.Sprite;
- import flash.display.StageScaleMode;
- import flash.events.Event;
- import flash.filters.BlurFilter;
- import flash.geom.ColorTransform;
- import flash.geom.Matrix;
- import flash.geom.Point;
- import flash.text.TextField;
- import flash.text.TextFieldAutoSize;
- /**
- * 間に合わんかった上に作りたかったものとちょっとちがう。
- * さらにソースが汚すぎる。
- * 朝ワンの時間だけで作るのは無理だな。
- */
- [SWF(width = "465", height = "465", backgroundColor = "0x0", frameRate = "30")]
- public class Professional extends Sprite {
- private var patterns: Array;
- private var texts: Array;
- private var txtMatrix: Array;
- private var txtMatrix2: Matrix = new Matrix();
- private var length: int;
- private var grid: BitmapData;
- private var matrix: Matrix;
- private var frame: int;
- private var phase: int;
- private var scale: int;
- private var shape: Shape;
- private var maskSp: Sprite;
- private var bmd: BitmapData;
- private var tmpBmd: BitmapData;
- private var tmpBmd2: BitmapData;
- private var point: Point = new Point();
- private var blur: BlurFilter = new BlurFilter();
- public function Professional() {
- stage.scaleMode = StageScaleMode.NO_SCALE;
- patterns = makePatterns();
- grid = makeGrid();
- shape = new Shape();
- addChild(new Bitmap(bmd = new BitmapData(465, 465, true, 0x0), "auto", true));
- tmpBmd = bmd.clone();
- tmpBmd2 = bmd.clone();
- matrix = new Matrix();
- scale = 100;
- makeTexts();
- addEventListener(Event.ENTER_FRAME, loop);
- }
- private function makeTexts(): void
- {
- texts = [], txtMatrix = [];
- var txt: TextField = new TextField(), str: String = "MATRIX", i: int, w: Number = 0, bmd: BitmapData, m: Matrix;
- for (i = 0; i < str.length; i++ )
- {
- txt.text = str.charAt(i);
- txt.autoSize = TextFieldAutoSize.LEFT;
- //txt.textColor = 0xFFFFFF;
- txt.scaleX = txt.scaleY = 4;
- bmd = new BitmapData(txt.width, txt.height, true, 0x0);
- bmd.draw(txt, txt.transform.matrix);
- texts.push(bmd);
- w += bmd.width + 50;
- }
- w /= 2;
- w -= 78;
- var timeline: TweensyTimeline;
- for (i = 0; i < texts.length; i++ )
- {
- bmd = texts[i];
- m = new Matrix();
- m.tx = (465 - w) / 2;
- m.ty = - 100;
- txtMatrix.push(m);
- w -= bmd.width
- switch (i)
- {
- case 0:
- w -= 40;
- break;
- case 1:
- case 2:
- w -= 20;
- break;
- case 3:
- w -= 30;
- break;
- case 4:
- w -= 10;
- break;
- }
- timeline = Tweensy.to(m, { ty: (465 - bmd.height) / 2 }, 1, Cubic.easeIn, Math.random() * 3);
- timeline.onComplete = onComp;
- }
- }
- private function onComp(): void
- {
- phase ++;
- }
- private function loop(e:Event):void
- {
- var b: BitmapData;
- var m: Matrix;
- switch (phase)
- {
- case 6:
- scale ++;
- if (scale > 600) phase = 7;
- break;
- case 7:
- scale --;
- if (scale < 2) phase = 6;
- break;
- }
- matrix.a = matrix.d = scale / 300;
- matrix.tx = matrix.ty = 232
- var g:Graphics = shape.graphics;
- var pattern: BitmapData = patterns[frame % length];
- g.clear();
- g.beginBitmapFill(pattern, matrix, true, true);
- g.drawRect(0, 0, 480, 480);
- g.endFill();
- g.beginBitmapFill(grid);
- g.drawRect(0, 0, 480, 480);
- tmpBmd.lock();
- tmpBmd.fillRect(tmpBmd.rect, 0x0);
- var n: int = texts.length, i: int;
- for (i = 0; i < n; i++ )
- {
- b = texts[i];
- m = txtMatrix[i];
- tmpBmd.draw(b, m, null, null, null, true);
- }
- tmpBmd.unlock();
- tmpBmd2.lock();
- txtMatrix2.a = txtMatrix2.d = Cubic.easeIn(scale, 0.3, 150, 600);
- txtMatrix2.tx = txtMatrix2.ty = (465 - 465 * txtMatrix2.a) / 2;
- tmpBmd2.draw(tmpBmd, txtMatrix2, null, null, null, true);
- tmpBmd2.applyFilter(tmpBmd2, tmpBmd2.rect, point, blur);
- tmpBmd2.colorTransform(tmpBmd2.rect, new ColorTransform(1, 1, 1, 1, 0, 0, 0, -10));
- tmpBmd2.unlock();
- bmd.lock();
- bmd.fillRect(bmd.rect, 0x0);
- bmd.draw(shape);
- bmd.copyChannel(tmpBmd2, tmpBmd2.rect, point, BitmapDataChannel.ALPHA, BitmapDataChannel.ALPHA);
- bmd.unlock();
- frame++;
- }
- public function makePatterns(): Array
- {
- patterns = [];
- var i: int, a: Array, j: int, n: int = 13;
- length = patternArray.length / n;
- for (i = 0; i < length; i++ )
- {
- patterns.push(BitmapPatternBuilder.build(patternArray, colorArray));
- for (j = 0; j < n; j++ )
- {
- a = patternArray.pop();
- patternArray.unshift(a);
- }
- }
- return patterns;
- }
- public function makeGrid(): BitmapData
- {
- return BitmapPatternBuilder.build([[0, 0, 1], [0, 0, 1], [1, 1, 1]], [0x20000000, 0xC0000000]);
- }
- private const patternArray: Array = [[0,0,0,1,2,3,3,3,4,5,5,5,5,5,5,5,5,3,3,3,3,1,1,0,0,0,0,0,0,0,1,1,2,2,3,3,3,3,3,3,3,3,3,3,3,2,1,0,0,0,0,0],
- [0,1,1,3,3,3,5,5,5,5,5,5,6,6,5,5,5,5,5,5,3,3,2,1,0,0,0,0,1,1,2,3,3,3,4,5,5,5,5,5,5,5,5,5,3,3,3,1,0,0,0,0],
- [1,2,3,3,5,5,5,5,6,6,6,6,6,6,6,6,6,6,5,5,5,4,3,3,1,1,1,1,2,3,3,4,5,5,5,5,5,6,6,6,6,6,5,5,5,4,3,2,1,0,0,0],
- [2,3,3,5,5,5,6,6,7,7,7,7,7,7,7,7,7,6,6,6,5,5,5,3,3,2,2,3,3,3,5,5,5,5,6,6,6,6,7,7,7,6,6,6,5,5,3,3,1,0,0,0],
- [3,3,5,5,6,6,7,7,8,8,8,8,8,8,8,8,8,7,7,6,6,5,5,5,3,3,3,3,3,5,5,5,6,6,7,7,7,8,8,8,8,7,7,6,6,5,5,3,2,0,0,1],
- [3,5,5,6,6,7,8,8,9,10,11,11,11,11,11,11,10,8,8,7,7,6,5,5,5,3,3,3,5,5,6,6,7,7,8,8,8,9,9,12,13,11,10,7,6,5,5,3,3,1,1,2],
- [5,5,6,6,7,8,9,13,11,11,11,11,11,11,11,11,11,11,14,8,8,7,6,5,5,5,3,5,5,5,6,7,7,8,8,9,13,11,11,11,11,11,13,7,6,6,5,4,3,1,1,3],
- [5,6,6,7,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,13,8,8,7,6,5,5,5,5,5,6,6,15,10,11,11,11,11,11,11,11,11,11,10,8,7,6,5,5,3,2,2,3],
- [5,6,7,8,9,11,11,11,11,11,11,13,14,14,11,11,11,11,11,11,13,8,7,6,6,5,5,5,5,6,8,11,11,11,11,11,11,11,11,11,11,11,13,8,7,6,5,5,3,2,3,4],
- [6,7,8,9,10,11,11,11,11,11,16,14,14,14,14,11,11,11,11,11,11,9,8,7,6,5,5,5,5,6,6,11,11,11,11,11,11,11,11,11,11,11,10,9,7,6,5,5,3,3,3,5],
- [6,7,8,14,11,11,11,11,11,11,13,14,14,14,14,11,11,11,11,11,11,11,9,8,7,6,5,5,5,6,6,7,8,14,10,11,11,11,11,11,11,11,13,9,8,6,5,5,3,3,4,5],
- [7,8,9,11,11,11,11,11,11,11,14,9,9,9,14,13,11,11,11,11,11,11,14,8,7,6,5,5,5,5,6,7,8,9,14,11,11,11,11,11,11,11,13,9,8,6,5,5,3,3,5,5],
- [7,8,14,11,11,11,11,11,11,16,14,9,9,9,9,14,11,11,11,11,11,11,16,9,8,6,6,5,5,5,6,6,7,9,14,13,11,11,11,11,11,11,13,9,8,6,5,5,3,3,5,6],
- [7,9,10,11,11,11,11,11,11,13,9,9,8,8,9,14,11,11,11,11,11,11,11,9,8,7,6,5,5,5,5,6,7,8,9,13,11,11,11,11,11,11,13,9,8,6,5,5,4,5,5,6],
- [8,9,11,11,11,11,11,11,11,13,9,8,8,8,9,9,11,11,11,11,11,11,11,14,8,7,6,5,5,5,5,6,7,8,9,13,11,11,11,11,11,11,10,9,8,6,5,5,4,5,5,6],
- [8,9,11,11,11,11,11,11,11,14,9,8,7,8,8,9,16,11,11,11,11,11,11,10,9,7,6,5,5,5,5,6,6,8,9,13,11,11,11,11,11,11,10,9,8,6,5,5,5,5,5,6],
- [8,14,11,11,11,11,11,11,11,14,9,8,7,7,8,9,10,11,11,11,11,11,11,11,9,8,6,5,5,5,5,5,6,7,9,13,11,11,11,11,11,11,13,9,8,6,5,5,5,5,5,6],
- [8,13,11,11,11,11,11,11,11,9,8,8,7,7,8,9,13,11,11,11,11,11,11,11,9,8,7,6,5,5,5,5,6,7,9,13,11,11,11,11,11,11,13,9,8,6,5,5,5,5,6,7],
- [9,10,11,11,11,11,11,11,11,9,8,7,7,7,8,9,13,11,11,11,11,11,11,11,9,8,7,6,5,5,5,5,6,7,9,13,11,11,11,11,11,11,13,9,8,6,5,5,5,5,6,7],
- [9,13,11,11,11,11,11,11,11,9,8,7,7,7,8,9,13,11,11,11,11,11,11,11,9,8,7,6,5,5,5,5,6,7,9,13,11,11,11,11,11,11,13,9,8,6,5,5,5,5,6,7],
- [9,13,11,11,11,11,11,11,11,9,8,7,7,7,8,9,13,11,11,11,11,11,11,11,9,8,7,6,5,5,5,5,6,7,9,13,11,11,11,11,11,11,13,9,8,6,6,5,5,5,6,7],
- [9,13,11,11,11,11,11,11,11,9,8,7,7,7,8,9,13,11,11,11,11,11,11,11,9,8,7,6,5,5,5,5,6,7,9,13,11,11,11,11,11,11,13,9,8,6,6,5,5,5,6,7],
- [9,13,11,11,11,11,11,11,11,9,8,7,7,7,8,9,13,11,11,11,11,11,11,11,9,8,7,6,5,5,5,5,6,7,9,13,11,11,11,11,11,11,13,9,8,6,5,5,5,5,6,7],
- [9,13,11,11,11,11,11,11,11,9,8,7,7,7,8,9,13,11,11,11,11,11,11,11,9,8,7,6,5,5,5,5,6,7,9,13,11,11,11,11,11,11,13,9,8,6,5,5,5,5,6,7],
- [8,13,11,11,11,11,11,11,11,9,8,8,7,7,8,9,13,11,11,11,11,11,11,11,9,8,7,6,5,5,5,5,6,7,9,13,11,11,11,11,11,11,13,9,8,6,5,5,5,5,6,7],
- [8,14,11,11,11,11,11,11,11,14,9,8,7,7,8,9,10,11,11,11,11,11,11,11,9,8,6,5,5,5,5,5,6,7,9,13,11,11,11,11,11,11,13,9,8,6,5,5,5,5,5,6],
- [8,9,11,11,11,11,11,11,11,14,9,8,7,8,8,9,16,11,11,11,11,11,11,13,9,7,6,5,5,4,5,5,6,7,9,13,11,11,11,11,11,11,10,9,8,6,5,5,5,5,5,6],
- [8,9,11,11,11,11,11,11,11,13,9,8,8,8,9,9,11,11,11,11,11,11,11,13,8,7,6,5,5,4,5,5,6,7,9,13,11,11,11,11,11,11,10,9,8,7,6,5,5,5,5,6],
- [7,9,10,11,11,11,11,11,11,13,9,9,8,8,9,14,11,11,11,11,11,11,11,9,8,7,6,5,5,5,5,5,6,8,9,13,11,11,11,11,11,11,10,9,8,7,6,5,5,5,5,6],
- [7,8,14,11,11,11,11,11,11,16,14,9,9,9,9,14,11,11,11,11,11,11,11,9,8,6,6,5,5,5,5,6,7,8,9,13,11,11,11,11,11,11,16,9,8,7,6,5,5,5,5,6],
- [7,8,9,11,11,11,11,11,11,11,14,9,9,9,14,13,11,11,11,11,11,11,14,8,7,6,5,5,5,5,5,6,7,8,9,13,11,11,11,11,11,11,16,9,8,7,6,5,5,5,5,5],
- [6,7,8,14,11,11,11,11,11,11,13,14,14,14,14,11,11,11,11,11,11,11,9,8,7,6,5,5,5,5,6,6,7,8,9,13,11,11,11,11,11,11,11,14,8,7,6,6,5,5,5,5],
- [6,7,8,9,16,11,11,11,11,11,16,14,14,14,14,11,11,11,11,11,11,14,8,7,6,5,5,5,5,5,6,7,7,8,9,13,11,11,11,11,11,11,11,14,9,8,7,6,5,5,5,5],
- [5,6,7,8,9,11,11,11,11,11,11,13,14,14,11,11,11,11,11,11,10,8,7,7,6,5,5,5,5,5,6,7,8,9,14,11,11,11,11,11,11,11,11,14,9,8,7,6,6,5,5,5],
- [5,6,6,7,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,13,8,8,7,6,5,5,5,5,5,6,7,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,17,6,5,5,5],
- [5,5,6,6,7,8,9,13,11,11,11,11,11,11,11,11,11,11,14,8,8,7,6,5,5,5,5,5,5,6,15,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,6,5,5,5],
- [4,5,5,6,6,7,8,8,9,10,11,11,11,11,11,11,10,8,8,7,7,6,5,5,5,3,3,5,5,5,6,10,10,10,10,14,14,13,13,13,13,14,14,10,10,10,10,17,6,5,5,4],
- [3,4,5,5,6,6,7,7,8,8,8,9,9,9,9,8,8,8,7,7,6,5,5,5,3,3,3,4,5,5,6,6,7,7,8,8,9,9,9,9,9,9,8,8,8,7,6,6,5,5,5,3],
- [3,3,4,5,5,6,6,7,7,7,8,8,8,8,8,8,7,7,6,6,5,5,5,3,3,3,3,3,5,5,6,6,7,7,7,8,8,8,8,8,8,8,8,8,7,7,6,6,5,5,4,3],
- [2,3,3,5,5,5,6,6,7,7,7,8,8,8,8,7,7,6,6,5,5,5,3,3,2,2,3,3,5,5,5,6,6,7,7,8,8,8,8,8,8,8,8,7,7,6,6,6,5,5,3,3],
- [3,3,3,5,5,5,6,6,7,7,7,8,8,8,8,7,7,6,6,5,5,3,3,1,1,1,3,3,5,5,6,6,7,7,7,8,8,8,8,8,8,8,8,7,7,7,6,6,5,5,3,3],
- [3,3,5,5,5,6,6,7,7,8,8,8,8,8,8,8,7,6,6,5,5,3,2,1,1,2,3,3,5,5,6,6,7,8,8,8,9,9,9,9,9,9,8,8,8,7,6,6,5,5,3,3],
- [3,4,5,5,6,6,7,7,8,8,9,9,9,10,11,11,12,7,6,5,5,3,2,1,1,2,3,5,5,6,6,7,8,8,9,10,11,11,11,11,11,11,10,9,8,8,7,6,6,5,5,3],
- [3,5,5,5,6,7,7,8,9,14,10,11,11,11,11,11,12,7,6,6,5,3,3,1,2,3,4,5,6,6,7,8,8,10,11,11,11,11,11,11,11,11,11,11,10,8,8,7,6,6,5,5],
- [5,5,5,6,7,12,10,11,11,11,11,11,11,11,11,11,14,8,7,6,5,4,3,2,3,3,5,5,6,7,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,7,6,5,5],
- [5,5,5,6,12,11,11,11,11,11,11,11,11,11,11,11,14,8,7,6,5,5,3,3,3,5,5,6,7,8,9,13,11,11,11,11,11,11,14,14,11,11,11,11,11,11,13,9,8,7,6,5],
- [5,5,5,6,17,11,11,11,11,11,11,11,11,11,11,11,14,8,7,6,5,5,3,3,3,5,6,6,7,8,13,11,11,11,11,11,11,14,14,14,14,11,11,11,11,11,11,14,8,7,6,6],
- [5,5,5,6,6,7,8,14,16,11,11,11,11,11,11,11,13,8,7,6,5,5,3,3,5,5,6,7,8,9,11,11,11,11,11,11,13,14,14,14,14,13,11,11,11,11,11,11,9,8,7,6],
- [5,5,5,6,6,7,8,9,14,11,11,11,11,11,11,11,13,8,7,6,5,5,3,3,5,5,6,7,8,10,11,11,11,11,11,11,14,14,9,9,14,14,11,11,11,11,11,11,10,8,7,6],
- [5,5,5,5,6,7,8,9,14,11,11,11,11,11,11,11,13,9,7,6,5,5,3,4,5,6,7,8,9,11,11,11,11,11,11,11,14,9,9,9,9,14,11,11,11,11,11,11,11,9,8,7],
- [6,5,5,5,6,6,7,8,14,11,11,11,11,11,11,11,13,9,7,6,5,5,3,5,5,6,7,8,14,11,11,11,11,11,11,11,9,9,8,8,9,9,11,11,11,11,11,11,11,14,8,7],
- [6,5,5,5,5,6,7,8,9,16,11,11,11,11,11,11,13,9,7,6,5,5,4,5,5,6,7,9,10,11,11,11,11,11,11,13,9,8,8,8,8,9,10,11,11,11,11,11,11,10,9,7],
- [6,5,5,5,5,6,7,8,9,16,11,11,11,11,11,11,13,9,7,6,5,5,5,5,6,6,8,9,11,11,11,11,11,11,11,13,9,8,8,8,8,9,13,11,11,11,11,11,11,11,9,8],
- [6,5,5,5,5,6,7,8,9,10,11,11,11,11,11,11,13,9,7,6,5,5,5,5,6,7,8,9,11,11,11,11,11,11,11,13,9,8,7,7,8,9,13,11,11,11,11,11,11,11,9,8],
- [6,5,5,5,5,6,6,8,9,10,11,11,11,11,11,11,13,9,7,6,5,5,5,5,6,7,8,9,11,11,11,11,11,11,11,14,9,8,7,7,8,9,14,11,11,11,11,11,11,11,9,8],
- [6,5,5,5,5,5,6,8,9,13,11,11,11,11,11,11,13,9,7,6,5,5,5,5,6,7,8,13,11,11,11,11,11,11,11,14,9,8,7,7,8,9,14,11,11,11,11,11,11,11,14,8],
- [7,6,5,5,5,5,6,8,9,13,11,11,11,11,11,11,13,9,7,6,5,5,5,5,6,7,8,13,11,11,11,11,11,11,11,14,8,8,7,7,8,8,14,11,11,11,11,11,11,11,13,8],
- [7,6,5,5,5,5,6,8,9,13,11,11,11,11,11,11,13,9,7,6,5,5,5,5,6,7,8,13,11,11,11,11,11,11,11,14,8,7,7,7,7,8,14,11,11,11,11,11,11,11,13,8],
- [7,6,5,5,5,5,6,8,9,13,11,11,11,11,11,11,13,9,7,6,5,5,5,5,6,7,8,13,11,11,11,11,11,11,11,14,8,7,7,7,7,8,14,11,11,11,11,11,11,11,13,8],
- [7,6,5,5,5,5,6,8,9,13,11,11,11,11,11,11,13,9,7,6,5,5,5,5,6,7,8,13,11,11,11,11,11,11,11,14,8,8,7,7,8,8,14,11,11,11,11,11,11,11,13,8],
- [6,5,5,5,5,5,6,8,9,13,11,11,11,11,11,11,13,9,7,6,5,5,5,5,6,7,8,13,11,11,11,11,11,11,11,14,9,8,7,7,8,9,14,11,11,11,11,11,11,11,13,8],
- [6,5,5,5,5,5,6,8,9,13,11,11,11,11,11,11,13,9,7,6,5,5,5,5,6,7,8,9,11,11,11,11,11,11,11,14,9,8,7,7,8,9,14,11,11,11,11,11,11,11,9,8],
- [6,5,5,5,5,5,6,8,9,13,11,11,11,11,11,11,13,9,7,6,5,5,5,5,6,7,8,9,11,11,11,11,11,11,11,13,9,8,7,7,8,9,13,11,11,11,11,11,11,11,9,8],
- [6,5,5,4,5,5,6,8,9,10,11,11,11,11,11,11,13,9,7,6,5,5,5,5,6,7,8,9,11,11,11,11,11,11,11,13,9,8,8,8,8,9,13,11,11,11,11,11,11,11,9,8],
- [6,5,5,4,5,6,7,8,9,10,11,11,11,11,11,11,13,9,7,6,5,5,5,5,5,6,7,9,13,11,11,11,11,11,11,13,9,8,8,8,8,9,10,11,11,11,11,11,11,13,9,7],
- [6,5,5,5,5,6,7,8,9,10,11,11,11,11,11,11,13,9,8,6,5,5,5,5,5,6,7,8,14,11,11,11,11,11,11,11,9,9,8,8,9,9,11,11,11,11,11,11,11,14,8,7],
- [5,5,5,5,5,6,7,8,9,16,11,11,11,11,11,11,13,9,8,7,6,5,5,5,5,6,7,8,9,11,11,11,11,11,11,11,14,9,9,9,9,14,11,11,11,11,11,11,11,9,8,7],
- [5,5,5,5,5,6,7,8,9,16,11,11,11,11,11,11,13,9,8,7,6,5,5,5,5,6,6,7,9,10,11,11,11,11,11,11,14,14,9,9,14,14,11,11,11,11,11,11,10,9,7,6],
- [5,5,5,5,6,6,7,8,14,11,11,11,11,11,11,11,13,9,8,7,6,6,5,5,5,5,6,7,8,9,11,11,11,11,11,11,13,14,14,14,14,13,11,11,11,11,11,11,9,8,7,6],
- [5,5,5,5,6,7,8,9,14,11,11,11,11,11,11,11,13,9,8,7,7,6,5,5,5,5,6,6,7,8,13,11,11,11,11,11,11,14,14,14,14,11,11,11,11,11,11,13,8,7,6,6],
- [5,5,5,6,6,7,8,9,14,11,11,11,11,11,11,11,11,14,9,8,7,6,5,5,5,5,5,6,7,8,9,11,11,11,11,11,11,11,14,14,11,11,11,11,11,11,11,9,8,7,6,5],
- [5,5,5,6,17,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,13,7,6,5,5,5,5,5,6,7,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,7,6,5,5],
- [5,5,5,6,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,15,6,5,5,5,5,5,6,6,7,8,8,10,11,11,11,11,11,11,11,11,11,11,10,8,8,7,6,6,5,5],
- [4,5,5,6,18,10,10,10,13,14,14,14,14,14,14,14,14,10,10,10,10,6,5,5,5,3,4,5,5,6,6,7,8,8,9,10,11,11,11,11,11,11,10,9,8,8,7,6,6,5,5,3],
- [3,5,5,5,6,6,7,7,8,8,8,8,8,8,8,8,8,8,7,7,6,6,5,5,4,3,3,3,5,5,6,6,7,7,8,8,8,8,8,8,8,8,8,8,7,7,6,6,5,5,3,3],
- [3,3,5,5,5,6,6,6,7,7,7,7,7,7,7,7,7,7,6,6,6,5,5,5,3,3,3,3,3,5,5,5,6,6,7,7,7,7,7,7,7,7,7,7,6,6,5,5,5,3,3,3],
- [3,3,4,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,5,3,3,2,2,2,3,3,4,5,5,5,6,6,6,6,6,6,6,6,6,6,5,5,5,4,3,3,2,1],
- [2,3,3,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3,3,3,1,1,1,1,2,3,3,5,5,5,5,5,5,6,6,5,5,5,5,5,5,3,3,2,1,0,0]];
- private const colorArray: Array = [0x0, 0x8000, 0xC000, 0xE000, 0x2000E000, 0x2000FF00, 0x4000FF00, 0x6000FF00, 0x8000FF00, 0xA000FF00, 0xE000E000, 0xFF00FF00, 0xC000E000, 0xE000FF00, 0xC000FF00, 0xA000E000, 0xFF00E000, 0x8000E000, 0x6000E000];
- }
- }
- /**-----------------------------------------------------
- * Use following BitmapPatternBuilder class
- *
- * DO NOT CHANGE any codes below this comment.
- *
- * -----------------------------------------------------
- */
- import flash.display.Bitmap;
- import flash.display.BitmapData;
- import flash.display.Graphics;
- class BitmapPatternBuilder{
- /**
- * creates BitmapData filled with dot pattern.
- * First parameter is 2d array that contains color index for each pixels;
- * Second parameter contains color reference table.
- *
- * @parameter pattern:Array 2d array that contains color index for each pixel.
- * @parameter colors:Array 1d array that contains color table.
- * @returns BitmapData
- */
- public static function build(pattern:Array, colors:Array):BitmapData{
- var bitmapW:int = pattern[0].length;
- var bitmapH:int = pattern.length;
- var bmd:BitmapData = new BitmapData(bitmapW,bitmapH,true,0x000000);
- for(var yy:int=0; yy<bitmapH; yy++){
- for(var xx:int=0; xx<bitmapW; xx++){
- var color:int = colors[pattern[yy][xx]];
- bmd.setPixel32(xx, yy, color);
- }
- }
- return bmd;
- }
- /**
- * short cut function for Graphics.beginBitmapFill with pattern.
- */
- public static function beginBitmapFill(pattern:Array, colors:Array, graphics:Graphics):void{
- var bmd:BitmapData = build(pattern, colors);
- graphics.beginBitmapFill(bmd);
- bmd.dispose();
- }
- }
fladdict challenge for professionals forked from: fladdict challenge for professionals
- // forked from checkmate's fladdict challenge for professionals
- /**
- * Theme:
- * Play with BitmapPatterBuilder.
- * Purpose of this trial is to find the possibility of the dot pattern.
- *
- * by Takayuki Fukatsu aka fladdict
- **/
- /**
- * (forked from Murai's code)
- * http://wonderfl.net/code/e9dee3eb5c7414aea0248344f204c1b397adc0ac
- */
- package {
- import flash.display.Bitmap;
- import flash.display.BitmapData;
- import flash.display.BlendMode;
- import flash.display.Graphics;
- import flash.display.Sprite;
- import flash.display.StageScaleMode;
- import flash.events.*;
- import flash.geom.Matrix;
- [SWF(width=465,height=465,frameRate=60,backgroundColor=0x000000)]
- public class ProfessionalAnim extends Sprite {
- private var poses:Array = [
- [
- [0,0,0,0,0,0,0,0,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,1,1,1,1,0,0,0],
- [0,0,1,0,1,1,0,1,0,0],
- [0,0,1,0,1,1,0,1,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,1,0,0,1,0,0,0],
- [0,0,0,1,0,0,1,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,1,1,0,0,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,1,1,1,1,0,0,0],
- [0,0,1,0,1,1,0,1,0,0],
- [0,0,0,1,1,0,1,0,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,1,0,0,1,0,0,0],
- [0,0,0,1,0,1,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,1,1,0,0,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,1,1,1,1,0,0,0],
- [0,1,1,0,1,1,0,1,0,0],
- [0,0,0,0,1,1,1,0,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,1,0,0,1,0,0,0],
- [0,0,1,0,0,1,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,1,1,0,0,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,1,1,1,1,0,0,0],
- [0,0,1,0,1,1,0,1,0,0],
- [0,0,1,0,1,1,0,1,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,1,0,0,1,0,0,0],
- [0,0,0,1,0,0,1,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,1,1,0,0,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,1,1,1,1,0,0,0],
- [0,0,1,0,1,1,0,1,0,0],
- [0,0,1,0,1,1,0,0,0,0],
- [0,0,0,0,1,1,0,0,0,0],
- [0,0,0,1,0,0,1,0,0,0],
- [0,0,0,1,0,0,0,1,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,1,1,0,0,0,0],
- [0,0,0,0,1,1,0,0,1,0],
- [0,0,0,1,1,1,1,1,0,0],
- [0,0,1,0,1,1,0,0,0,0],
- [0,0,1,0,1,1,0,0,0,0],
- [0,0,0,0,1,1,1,0,0,0],
- [0,0,0,1,0,0,0,0,0,0],
- [0,0,0,1,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,1,1,0,0,0,0],
- [0,0,0,0,1,1,0,1,0,0],
- [0,0,0,1,1,1,1,1,0,0],
- [0,0,1,0,1,1,0,0,0,0],
- [0,0,1,0,1,1,0,0,0,0],
- [0,0,0,0,1,1,1,0,0,0],
- [0,0,0,1,0,0,1,0,0,0],
- [0,0,0,1,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,1,1,0,0,0,0],
- [0,0,0,0,1,1,0,0,1,0],
- [0,0,0,1,1,1,1,1,0,0],
- [0,0,1,0,1,1,0,0,0,0],
- [0,0,1,0,1,1,0,0,0,0],
- [0,0,0,0,1,1,1,0,0,0],
- [0,0,0,1,0,0,1,0,0,0],
- [0,0,0,1,0,0,0,0,0,0],
- [0,0,0,0,0,0,0,0,0,0]
- ]
- ];
- private var pattern:BitmapData;
- private var pos:Number = 0;
- private var spd:Number = 0;
- private var film0:Film;
- private var film3:Film;
- public function ProfessionalAnim() {
- stage.scaleMode = StageScaleMode.NO_SCALE;
- var map:Array = [];
- for each (var pose:Array in poses) {
- for (var i:int=0; i<pose.length; i++) {
- map[i] ||= [];
- for (var j:int=0; j<5; j++) {
- map[i] = map[i].concat(pose[i]);
- }
- }
- }
- pattern = BitmapPatternBuilder.build( map, [0xFFFFFFFF, 0xFF000000] );
- film0 = new Film(pattern, 465, 465);
- film3 = new Film(pattern, 465 / 8, 20);
- film3.scaleX = film3.scaleY = 8;
- film3.blendMode = BlendMode.MULTIPLY;
- addChild(film0);
- addChild(film3);
- film3.y = 150;
- addEventListener(Event.ENTER_FRAME, function(event:Event):void {
- var spd2:Number = mouseX / 465 * 10 * 5;
- spd += (spd2 - spd) * 0.04;
- pos += spd * 2;
- pos %= (pattern.width * 2);
- film0.update(pos);
- film3.update(pos);
- film3.alpha = 1 - Math.abs((spd2 + 10) % 20 - 10);
- });
- }
- }
- }
- import flash.display.Shape;
- import flash.geom.Matrix;
- class Film extends Shape {
- private var pattern:BitmapData;
- private var drawWidth:int;
- private var drawHeight:int;
- public function Film(pattern:BitmapData, drawWidth:int, drawHeight:int) {
- this.pattern = pattern;
- this.drawWidth = drawWidth;
- this.drawHeight = drawHeight;
- }
- public function update(scroll:Number):void {
- var mtx:Matrix = new Matrix();
- mtx.a = mtx.d = 2;
- mtx.tx = -scroll;
- graphics.clear();
- graphics.beginBitmapFill(pattern, mtx);
- graphics.drawRect(0, 0, drawWidth, drawHeight);
- graphics.endFill();
- }
- }
- /**-----------------------------------------------------
- * Use following BitmapPatternBuilder class
- *
- * DO NOT CHANGE any codes below this comment.
- *
- * -----------------------------------------------------
- */
- import flash.display.Bitmap;
- import flash.display.BitmapData;
- import flash.display.Graphics;
- class BitmapPatternBuilder{
- /**
- * creates BitmapData filled with dot pattern.
- * First parameter is 2d array that contains color index for each pixels;
- * Second parameter contains color reference table.
- *
- * @parameter pattern:Array 2d array that contains color index for each pixel.
- * @parameter colors:Array 1d array that contains color table.
- * @returns BitmapData
- */
- public static function build(pattern:Array, colors:Array):BitmapData{
- var bitmapW:int = pattern[0].length;
- var bitmapH:int = pattern.length;
- var bmd:BitmapData = new BitmapData(bitmapW,bitmapH,true,0x000000);
- for(var yy:int=0; yy<bitmapH; yy++){
- for(var xx:int=0; xx<bitmapW; xx++){
- var color:int = colors[pattern[yy][xx]];
- bmd.setPixel32(xx, yy, color);
- }
- }
- return bmd;
- }
- /**
- * short cut function for Graphics.beginBitmapFill with pattern.
- */
- public static function beginBitmapFill(pattern:Array, colors:Array, graphics:Graphics):void{
- var bmd:BitmapData = build(pattern, colors);
- graphics.beginBitmapFill(bmd);
- bmd.dispose();
- }
- }



notice:





