Jump to content

24 game/ABAP: Difference between revisions

m
Fixed syntax highlighting.
m (→‎RPN Code: Left off closing tag.)
m (Fixed syntax highlighting.)
 
Line 3:
Firstly we need to make a Reverse Polish Notation parser. To make it easier, I simply put this in the report used in the game itself. The following data declarations should be common to both for ease of use.
===Global Data===
<langsyntaxhighlight ABAPlang="abap">report z24_with_rpn
constants: c_eval_to type i value 24,
c_tolerance type f value '0.0001'.
Line 9:
gv_val type f,
gv_pac type p,
gv_chk type c.</langsyntaxhighlight>
 
===RPN Code===
<langsyntaxhighlight ABAPlang="abap">" Log a message from the RPN Calculator.
form rpn_log using lv_msg type string.
write : / 'RPN Message: ', lv_msg.
Line 183:
 
ev_out = 'X'.
endform.</langsyntaxhighlight>
 
===24 Game===
Line 190:
 
The supplied Random Number Generator seems to highly favour a five as the first digit as well (It does occasionally take on other values). It doesn't appear to be a seeding issue, as the other numbers appear sufficiently random.
<syntaxhighlight lang="abap">
<lang ABAP>
selection-screen begin of block main with frame title lv_title.
parameters:
Line 328:
importing
ran_int = ev_val.
endform.</langsyntaxhighlight>
9,486

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.