diff --git a/README.md b/README.md index 692211e..6bf9ae4 100644 --- a/README.md +++ b/README.md @@ -21,15 +21,15 @@ Supported Platforms **AWKTC** has been tested in the following platforms: -* Debian GNU/Linux 9 -* FreeBSD 11.1-RELEASE +* Debian GNU/Linux 10 +* FreeBSD 12.1-RELEASE How to Play ----------- ### Running the Game ### -``` shellsession +```console $ cd /path/to/AWKTC $ ./awktc.awk ``` @@ -59,7 +59,7 @@ You can change the playfield width between 4 and 24 cells. By default, the playf ### Example Minimum Width ### -``` shellsession +```console $ ./awktc.awk 4 ``` @@ -67,7 +67,7 @@ $ ./awktc.awk 4 ### Example Maximum Width ### -``` shellsession +```console $ ./awktc.awk 24 ``` @@ -76,7 +76,7 @@ $ ./awktc.awk 24 Installation ------------ -``` shellsession +```console $ git clone https://github.com/mikkun/AWKTC.git ``` @@ -88,4 +88,4 @@ Author License ------- -[MIT](./LICENSE) +[MIT License](./LICENSE) diff --git a/awktc.awk b/awktc.awk index 626ce0a..0a7fd41 100755 --- a/awktc.awk +++ b/awktc.awk @@ -4,7 +4,7 @@ # Purpose : AWKTC is Workable Klutzy Time-wasting Command # # Author : KUSANAGI Mitsuhisa -# Licence : MIT license +# License : MIT License # Usage : ./awktc.awk [width] @@ -20,7 +20,7 @@ BEGIN { MAX_LEVEL = 99; MAX_LINES = 999999; MAX_SCORE = 999999; - SCORE_UNIT = 100; + SCORE_UNIT = 10; DELAY_SEC = 0.1; READING_KEY_CMD = "((while :; do echo ''; sleep " DELAY_SEC "; done) &" \ @@ -266,7 +266,7 @@ function _is_all_clear( x) { return 1; } -function update_field( deleted_lines, is_line_created, i, x, y) { +function update_field( deleted_lines, is_line_created, points, i, x, y) { deleted_lines = 0; for (i = 0; i < PIECE_H; i++) { for (y = field_h - BORDER_H; y > PIECE_H; y--) { @@ -285,16 +285,12 @@ function update_field( deleted_lines, is_line_created, i, x, y) { } } if (deleted_lines > 0) { + points = input_w * deleted_lines ^ 2 * SCORE_UNIT * level; curr_level_exp += deleted_lines * 2 \ + int(deleted_lines / PIECE_H) \ - 1; lines += deleted_lines; - score += (deleted_lines * 2 \ - + int(deleted_lines / PIECE_H) \ - - 1) * SCORE_UNIT * level; - if (_is_all_clear()) { - score += SCORE_UNIT * 10 * (field_w - BORDER_W); - } + score += _is_all_clear() ? points * 10 : points; if (curr_level_exp >= next_level_exp) { level_up(); }