Loading [MathJax]/extensions/Safe.js


Post Reply 
Powerball Generator!
09-13-2024, 07:18 AM (This post was last modified: 09-13-2024 10:25 AM by Thomas Klemm.)
Post: #5
RE: Powerball Generator!
A bit shorter:
Code:
00 { 95-Byte Prgm }
01▸LBL "PBALL"
02 CLA
03 6
04 1
05 DIM "PBALL"
06 INDEX "PBALL"
07 1.005
08 STO 00
09▸LBL 01
10 RCL 00
11 1
12 STOIJ
13 69
14 XEQ 00
15 [FIND]
16 GTO 01
17 STOEL
18 ├" "
19 AIP
20 ISG 00
21 GTO 01
22 6
23 1
24 STOIJ
25 26
26 XEQ 00
27 STOEL
28 ├" PB: "
29 AIP
30 AVIEW
31 RTN
32▸LBL 00
33 RAN
34 ×
35 IP
36 1
37 +
38 END

Changes

The subroutine at LBL 00 generates a random number from 1 to X.
This makes the checks at the boundaries unnecessary.
I also use the register 00 instead of the global variable "CNT".
But that's more a matter of taste.
There's no obvious reason to store a result in the register 10 since it's never used.
So I removed it.
I also removed CLD since I don't think it's needed.
If the increment of a loop control number is 1, it can be omitted as it is the default.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Powerball Generator! - rlk281 - 05-23-2024, 09:42 PM
RE: Powerball Generator! - carey - 05-24-2024, 12:36 PM
RE: Powerball Generator! - rlk281 - 05-24-2024, 04:18 PM
RE: Powerball Generator! - knife31 - 09-13-2024, 04:11 AM
RE: Powerball Generator! - Thomas Klemm - 09-13-2024 07:18 AM
RE: Powerball Generator! - Thomas Klemm - 09-13-2024, 07:37 AM
RE: Powerball Generator! - lrdheat - 09-13-2024, 08:26 PM
RE: Powerball Generator! - John Keith - 09-14-2024, 11:27 AM
RE: Powerball Generator! - DGM - 09-14-2024, 06:40 PM
RE: Powerball Generator! - Dashier - 09-23-2024, 12:39 PM
RE: Powerball Generator! - Thomas Klemm - 09-13-2024, 10:20 PM
RE: Powerball Generator! - AnnoyedOne - 09-14-2024, 12:41 PM
RE: Powerball Generator! - C.Ret - 09-14-2024, 03:13 PM
RE: Powerball Generator! - AnnoyedOne - 09-14-2024, 03:45 PM
RE: Powerball Generator! - Thomas Klemm - 09-14-2024, 04:43 PM
RE: Powerball Generator! - lrdheat - 09-23-2024, 02:04 PM
RE: Powerball Generator! - DGM - 09-23-2024, 03:52 PM
RE: Powerball Generator! - vaklaff - 09-23-2024, 04:17 PM
RE: Powerball Generator! - DGM - 09-23-2024, 05:26 PM
RE: Powerball Generator! - vaklaff - 09-23-2024, 06:02 PM
RE: Powerball Generator! - DGM - 09-23-2024, 08:28 PM
RE: Powerball Generator! - John Keith - 09-23-2024, 09:24 PM
RE: Powerball Generator! - AnnoyedOne - 09-23-2024, 05:36 PM
RE: Powerball Generator! - AnnoyedOne - 09-23-2024, 06:18 PM



User(s) browsing this thread: 1 Guest(s)