4 kyu

Play FlappyBird : Advance Bravely

Description:

Play FlappyBird : Advance Bravely

About FlappyBird

FlappyBird is a very interesting mobile phone games, you can look at here for more infomation.

How to solve this Kata?

Your task is very simple.Write a function gameframe, let the bird safety flying from the start point to the end point.

There are two input parameters, map and hight. See example:

      ------this is the map,given by a Array,12 rows and 4 columns
      |     all □ are space, the bird can fly freely
     □□□■
     □□□■
     □□☆■------☆ is a bonus score, You need to consider the location
     □□□■       of the bouns and the location of the exit, as much as
     □□□■        possible to get it, unless cannot reach the exit
     □□□■
     □□□B --------there is the end point, ■ is pipe, and only one □
     □□□■        can pass, you should return a string Array, that
     □□□■        contains 4 action of bird,let bird flying from A to B
   A □□□■
   | □□□■
   | □□□■
   |  
   ---there is your bird start point
      out of map, given by a val height(1-12) in the function
      
 ◆◆◆◆A little suggestion, you can first try to write some code,    ◆◆◆◆
 ◆◆◆◆let the birds fly to the end (without consideration of bonus),◆◆◆◆
 ◆◆◆◆          so the code can be randomly tested 1 and 2,         ◆◆◆◆
 ◆◆◆◆                  and then optimize it                        ◆◆◆◆

This is an interactive game, run this function in the test, every times means that the bird move forward 4 grid.

Your output is the bird's action in each grid, it's an array, like this:

        ["TAP","TAP","TAP","TAP"]

The bird has a default action(move forward) in front of other actions, You don't need to return it, you only need to return the bird 4 times up and down movement. There are five types of output string:

"TAPTAPTAPTAP"   =>up 3 grid
"TAPTAPTAP"      =>up 2 grid
"TAPTAP"         =>up 1 grid
"TAP"            =>keep balance
""(empty string) =>down 1-3 grid

When output is an empty string, it's means stop TAP, and then the bird began to fall, and will become more and more fast(1 to 3).

Some example for action:

        B                                     |    B→↓  --------1st ""
        ↑              B                      |      B→↓  ------2nd ""
        ↑              ↑          B           |        ↓
      B→↑            B→↑        B→↑      B→B  |        B→↓  ----3rd ""
                                              |          ↓
                                              |          ↓
                                              |          B→B  --4th "TAP"
 "TAPTAPTAPTAP"  "TAPTAPTAP"  "TAPTAP"  "TAP" |  example of ["","","","TAP"]

More example look at the local testcase, I preload a simple solution, it can pass the local test, you can see how to play this game.

Scores Count

  • Basic score: 1 frame +10 point
  • Bonus scores: +100 point, +200 point, +500 point. There is only one bonus score in one map.

Friendly reminder: The primary task is to avoid obstacles and flying to exit, but the score is also an important standard of test, if you want to pass the final test, you should catch more scores.

Finally, you will have to prove your courage with Five random test:

  • Random test 1 :Pass random test with 100 frame and basic scores(1000)
  • Random test 2 :Pass random test with 500 frame and basic scores(5000)
  • Random test 3 :Pass random test with 1000 frame and 25000 scores
  • Random test 4 :Pass random test with 5000 frame and 120000 scores
  • Random test 5 :Pass random test with 20000 frame and 500000 scores

Classic Games Series

Games
Puzzles

Stats:

CreatedFeb 24, 2016
PublishedFeb 26, 2016
Warriors Trained370
Total Skips11
Total Code Submissions761
Total Times Completed45
JavaScript Completions45
Total Stars23
% of votes with a positive feedback rating95% of 21
Total "Very Satisfied" Votes19
Total "Somewhat Satisfied" Votes2
Total "Not Satisfied" Votes0
Total Rank Assessments4
Average Assessed Rank
4 kyu
Highest Assessed Rank
4 kyu
Lowest Assessed Rank
4 kyu
Ad
Contributors
  • myjinxin2015 Avatar
  • kazk Avatar
  • docgunthrop Avatar
Ad