A micro-game "flappy bird".
The game will be installed at /usr/bin . The name of it is "1-o-flappy". You can type "1-o-flappy" to start a game. When the game starts, the "bird" will go down automatically. Press enter to control the vertical moving of the "bird" and it will go up. When the "bird" falls down or touch any rolls, the game will be over and it will show "Game over!". Press Ctrl-C to pause in a game. You will never win this game.
The title bar of the game shows: date and time, the time that the game has run(Unit: second), vertical speed, horizontal speed, the range of the rolls, and the score.
When a game starts, it will load a config file named ".1-o-flappy" that be at your home directory. If that file does not exist, the game will create it. If you want to see the default content of this file, please go to next page.
The file must contain these to run the game normally:
roll_skin -> a str
width -> an int(> 0)
p_skin -> a str
height -> an int(> 0)
blank_skin -> a str
speed_v -> an int or a float(> 0) or a str(eval(str) > 0)
v_border -> a str
speed_h -> an int or a float(> 0) or a str(eval(str) > 0)
h_border -> a str
high -> an int(> 0)
roll_range -> an int(> 0) or a str(type(eval(str)) == int and eval(str) > 0)
cooldown_tile -> an int(>= 0) or a str(type(eval(str)) == int and eval(str) >= 0)
roll_skin
means the skin of the rolls(the default is "|"
).
p_skin
means the skin of the "bird"(the default is "O"
).
blank_skin
means the skin of the blank area(the default is " "
).
v_border
means the skin of the vertical border on the right(the default is ""
).
h_border
means the skin of the horizontal border on the bottom(the default is "-"
).
You can color the skin(like "\033[42m"
).
The default content of the config file:
# The config file of Flappy.
# Skin config start
roll_skin = "|"
p_skin = "O"
blank_skin = " "
v_border = ""
h_border = "-"
# Skin config end
# Gameplay config start
width = 79
height = 18
speed_v = 20
speed_h = 4
roll_range = 3
cooldown_tile = 16
high = 15
# Gameplay config end
width
means the visible width of the checkerboard(the default is 79
).
height
means the visible height of the checkerboard(the default is 18
).
speed_v
means the vertical(right to left) moving speed of the "bird"(the default is 20
). It is also the speed of the refreshing.
speed_h
means the horizontal moving speed of the "bird"(the default is 4
).
roll_range
means the passable range of the rolls(the default is 3
).
cooldown_tile
means the value of the least separation of two rolls(the default is 16
).
high
means the initial height of the "bird".
speed_v
, speed_h
, roll_range
, cooldown_tile
can be a str
. If it is a str
, the game will read it as eval(str)
. Be sure the eval value of it is a positive, and also be sure the type of the eval value of roll_range
or cooldown_tile
is an int
. Else an error will occur.
Some usable values:
"(time.time()-start_time)" # the value of the time that game has run(Unit: s)
"(score)" # the score of the game
"(high)" # the height of the "bird"
"(time.time())" # the time that be generated by time.time
"(sum(checkerboard))" # the sum of the height of all the rolls
Q: Why the name of this game is "1-o-flappy"?
A: The real name of this game is "1-O-Flappy". "1-o-flappy" is the name of the deb archive. "1" refers to "|", it is the default skin of the rolls. "O" is the default skin of the "bird". The "1-O-" helps the name of the game avoid name conflict.
Q: I pressed enter, but why does not the "bird" go up?
A: That seems your did not press enter frequently or the setting of the repeating of the keyboard inputting is too slow.
Q: Why the game looks like a contorted space after modifying the skins in the config file?
A: That is one of the core features of this game, so enjoy it 😄
Q: Why this game is installed at /usr/bin but not /usr/games ?
A: Treat it equally with other executable files.