(HP32SII) Simon-like game - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: HP Software Libraries ( /forum-10.html)+--- Forum: General Software Library ( /forum-13.html)+--- Thread: (HP32SII) Simon-like game ( /thread-21390.html) |

(HP32SII) Simon-like game - Dave75 - 03-01-2024 07:12 PM
Hi all, here below a Simon-like game for HP32SII. The program starts generating a series of 23 random numbers (1,2,3 or 4) and store them in registers from A to W (by means of the incremental variable stored in the Y register and indirect storage STO(i) function); this is the whole sequence that has to be replicated by the user. At the beginning only the first number of the sequence is shown; if the user provide the correct value, then the first plus the second numbers are shown and so on until the sequence is replicated correctly up to the last value or a mistake is made. The sequence has to be input by the user one digit at time at the “INPUT X?” command. At the end the “score” is provided (actually the lenght of the sequence correctly provided). The program uses the indirect storage and recall of value through the A to W registers. Bye! Davide S01 LBL S CK=3B6C 15.5 S02 SF 10 S03 FIX 0 S04 1.023 S05 STO Y A01 LBL A CK=8CC5 22.5 A02 RANDOM A03 4 A04 * A05 IP A06 1 A07 + A08 RCL Y A09 STO i A10 x<>y A11 STO (i) A12 ISG Y A13 GTO A A14 0 A15 STO Z B01 LBL B CK=7062 16.5 B02 1 B03 STO+ Z B04 READY [to be entered as equation with EQN] B05 PSE B06 XEQ X C01 LBL C CK=4D46 12.0 C02 RCL Y C03 STO i C04 RCL (i) C05 PSE C06 ISG Y C07 GTO C C08 XEQ X D01 LBL D CK=BCD1 21.0 D02 RCL Y D03 STO i D04 RCL(i) D05 INPUT X D06 x≠y? D07 GTO Z D08 ISG Y D09 GTO D D10 24 D11 RCL Y D12 x>y? D13 GTO Y D14 GTO B Z01 LBL Z CK=5147 12.0 Z02 WRONG [to be entered as equation with EQN] Z03 GTO W Y01 LBL Y CK=3CFE 15.0 Y02 YOU WIN [to be entered as equation with EQN] Y03 GTO W X01 LBL X CK=B773 20.0 X02 RCL Z X03 1.00E+03 X04 / X05 1 X06 + X07 STO Y X08 RTN W01 LBL W CK=67F8 16.5 W02 SCORE [to be entered as equation with EQN] W03 RCL Z W04 ALL W05 CF 10 W06 RTN |