|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
本帖最后由 mnbvcxz 于 2012/9/26 10:38 编辑
REPORT zminesweeper NO STANDARD PAGE HEADING LINE-SIZE 125.
* ------------------------------------------------------------
* ABAP Minesweeper
* (c) Andrey Timofeev
* http://mrand.name/sap-abap
* license: free, "as is"
* ------------------------------------------------------------
* Installation: compile and run.
* (for SAP 4.x, use http://mrand.name/sap-abap/sweeper4.txt)
* ------------------------------------------------------------
* v1.0 2009.04.01
* initial release
*
INCLUDE <icon>.
CONSTANTS:
" >> board cell values
blank_hidden TYPE c VALUE '0',
blank_marked TYPE c VALUE 'm',
blank_opened TYPE c VALUE '.',
bomb_hidden TYPE c VALUE '*',
bomb_marked TYPE c VALUE 'M',
bomb_opened TYPE c VALUE '&',
"digit_hidden TYPE c VALUE 'A', " A B C D E F G H
"digit_marked TYPE c VALUE 'a', " a b c d e f g h
"digit_opened TYPE c VALUE '1', " 1 2 3 4 5 6 7 8
endgame_bomb_boom TYPE c VALUE 'X',
endgame_bomb_missmark TYPE c VALUE '@',
border TYPE c VALUE '#',
" >> game state
game_in VALUE '1',
game_over VALUE '2',
game_win VALUE '3'.
DATA:
board(9999) TYPE c, " 2D board, x_size * y_size + borders
ofs TYPE i, " board[ofs] = cell unique ID
min TYPE i, " board[min] .. board[max]
max TYPE i,
rdx TYPE i, " = 2 + width of board
rdy TYPE i, " = 2 + height of board
square TYPE i, " = x_size * y_size = visible area
square2 TYPE i, " = rdx * rdy = visible area + border
range TYPE i, " = max - min + 1
rest TYPE i, " = square - bomb_cnt = empty cells to invent
game TYPE c, " gamestate = 1,2,3
game_size TYPE c, " B=Beginner, I=Interm, E=Expert, C=Custom
game_time(5) TYPE c, " seconds
b_left(4) TYPE c. " unmarked bombs left
" >> eight directions: North, South, East, West, NE, NW, SE, SW
DATA: eight_directions TYPE TABLE OF i INITIAL SIZE 8 WITH HEADER LINE .
" >> cells2update list, to track board[] changes
TYPES:
BEGIN OF celltype,
offset(4) TYPE c,
color TYPE c,
END OF celltype.
DATA: cells2update TYPE TABLE OF celltype INITIAL SIZE 1000 WITH HEADER LINE.
" >> misc
CONSTANTS:
x_ofs TYPE i VALUE 1,
y_ofs TYPE i VALUE 5.
DATA:
game_time1 TYPE timestamp, " game begin
game_time2 TYPE timestamp.
" >> high_scores
CONSTANTS:
database_id_prefix(21) TYPE c VALUE 'ABAPMINESWEEPERSCORES'.
TYPES:
BEGIN OF score_line,
user LIKE sy-uname,
time(5) TYPE c,
END OF score_line.
DATA:
high_scores TYPE SORTED TABLE OF score_line
WITH UNIQUE KEY time WITH HEADER LINE,
database_id LIKE indx-srtfd. " export/import to database ID
|
-
-
ABAP扫雷.txt
38.77 KB, 下载次数: 2, 下载积分: 努力值 -5 点
ABAP扫雷程序
|