In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

どれだけ引けば・・・

スゴイ自販機でコンプリートするまでに、どんだけ引かないといけないのか?

抽選券とフィギュアの出る確立を2:1と仮定すると・・・

@author narutohyper
Get Adobe Flash player
by narutohyper 14 Feb 2011

    Talk

    makc3d at 14 Feb 2011 18:26
    what a hell does this do?
    greentec at 14 Feb 2011 18:31
    something like a lottery ticket?
    makc3d at 14 Feb 2011 20:07
    I tried to put this through google translator, but google sucks at japanese
    greentec at 14 Feb 2011 22:14
    Google - Awesome until you complete the vending machine, or just how should I draw? And figure out the establishment of a lottery ticket assuming 2:1
    wh0 at 14 Feb 2011 23:42
    http://en.wikipedia.org/wiki/Coupon_collector%27s_problem
    narutohyper at 15 Feb 2011 01:22
    This Facebook located in the Coca-Cola has been used in a campaign FlashApplication. It is a thing that represented the establishment.
    narutohyper at 15 Feb 2011 01:24
    http://c.cocacola.co.jp/svm/
    makc3d at 15 Feb 2011 15:03
    so "class CocaCola extends Sprite" was not a joke :(
    narutohyper at 15 Feb 2011 15:35
    There, according to this campaign is a pun: P
    Embed
/**
 * Copyright narutohyper ( http://wonderfl.net/user/narutohyper )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/weHd
 */

package
{
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    
    /**
     * スゴイ自販機でコンプリートするまでに、どんだけ引かないといけないのか?
     *
     * 抽選券とフィギュアの出る確立を2:1と仮定すると・・・
     *
     * @author narutohyper
     */
    public class CocaCola extends Sprite
    {
        public function CocaCola()
        {
            var counters:Array=[]
            var i:int = 0;
            var count:int = 91
            for (i = 0; i < count; i++)
            {
                counters[i]=0
            }
            
            var check:uint = 0;
            var random:int
            var counter:int = 0
            while (check < 91) {
                random=Math.floor(Math.random() * 3)
                if(!random) {
                    //フィギュア
                    random=Math.floor(Math.random() * 90)+1
                    counters[random]++
                    if (counters[random]==1) {
                        check++
                    }
                } else {
                    //抽選券
                    counters[0]++
                    if (counters[0]==1) {
                        check++
                    }
                }
                counter++;
            }
            
            for (i = 1; i < count; i++)
            {
                var n:int = 0;
                for (n = 0; n < counters[i]; n++)
                {
                    graphics.beginFill(i < 70?0xCC0000:0x009900);
                    graphics.drawRect(n * 4+20, i * 4, 3, 3);
                }
            }
            
            var txt:TextField = new TextField();
            txt.autoSize = TextFieldAutoSize.LEFT;
            var fmt:TextFormat = new TextFormat(null, 12, 0);
            txt.defaultTextFormat = fmt
            txt.text = "Completeまでの道のり\n抽選回数:" + counter + "回\n抽選券:" + counters[0] + "枚"
            this.addChild(txt)
            txt.x = 20;
            txt.y = 370
            
            
        }
        
    }

}