help acrion script Flash4 example "aliens game"
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: help acrion script Flash4 example "aliens game"

  1. #1
    Junior Member
    Join Date
    Mar 2000
    Posts
    1

    Post

    Dear friends we write form Italy , so, sorry for our bad English.
    We need some istructions (a sequence of action scripts) for the game
    included in Flash4 example ( game of aliens) to make win one or another
    alien with a variable percent (%) of probability.
    The game is composed by three aliens. We would like one alien win 2 times on
    100 (2%). The other two aliens win 49 times on 100 (49%).

    Thank you
    Matteo & Warren



  2. #2
    Hack
    Join Date
    Mar 2000
    Location
    Madison, WI
    Posts
    1,753

    Post

    Matteo and Warren,

    As you probably know, right now each racer is set to take a step that is from 2 to 6 pixels in length, selected randomly. The racetrack is 450 pixels long.

    I'm no statistician, but I built a little flash program that runs those races dozens of times each second and counts which alien wins each race. I discovered that if you subtract .26 from one of the three aliens' movements each step, you come real close to a 2% win ratio for that alien. So, for instance, in frame four of the sample game, if you put an if statement in the Loop While, such as: If racer = 3, Set Property... = Get Property... - .26, you'll handicap racer 3 so that he only wins about 2% of the time.

    Of course, you also need to make sure that racers=3, rather than having the computer pick a random number of racers.

    Strange thing was, racer 1 was always around 52%, racer 2 46%, and racer 3 2%, even though the speeds of racers 1 and 2 were identical.. I guess computers can't ever do anything truly randomly. Or maybe there is no such thing as true randomness. I dunno.

    If you want me to send you this alien-game-statistics-gathering .swf, just email me.

    Greg

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com