This is an electron configuration program I recently finished for the 84+C. It calculates the configuration for all 118 elements. Includes normal and noble gas configurations. I would like to do more with the program, though I currently don't have any ideas.

http://www.cemetech.net/programs/index.php?mode=file&id=984





Edit:
I would like to make a Doors version when I figure out how to.
Also, I'm thinking of putting the Element's name/symbol next to the atomic number, but that will require at least 400 extra lines of code.

Edit:
Apparently there are exceptions to the periodic trend, which makes some of the info displayed on this program incorrect Sad. Only solution is to change each exception individually, and while I do that, I could add the elements' names and symbols Wink.
Version 0.2 should be released soon.Smile It now correctly gives the configurations for all the elements, even the exceptions to the trends, the element's symbol, and a much cleaner display, even though it is twice as big and a little bit slower.Sad Doors version coming very near future, and more info on each element will be coming eventually.
Cool! Can I have the source code so that I may turn it into a normal B&W Calc program?
willwac wrote:
Cool! Can I have the source code so that I may turn it into a normal B&W Calc program?
Sure, If you want. I don't have a B&W calculator, so I can't do it, but it would be easily convertible. Here's the code for version 0.2.
Code:
:ClrHome
:0→C
:0→D
:0→E
:0→F
:0→G
:0→H
:0→I
:0→J
:0→K
:0→L
:0→M
:0→N
:0→O
:0→P
:0→Q
:0→R
:0→S
:0→T
:0→U
:Repeat B=1 or B=0
:ClrHome
:Disp "Noble Gas Notation?"
:Input "(Yes=1,No=0)",B
:End
:Repeat A=1 or A=2 or A=3 or A=4 or A=5 or A=6 or A=7 or A=8 or A=9 or A=10 or A=11 or A=12 or A=13 or A=14 or A=15 or A=16 or A=17 or A=18 or A=19 or A=20 or A=21 or A=22 or A=23 or A=24 or A=25 or A=26 or A=27 or A=28 or A=29 or A=30 or A=31 or A=32 or A=33 or A=34 or A=35 or A=36 or A=37 or A=38 or A=39 or A=40 or A=41 or A=42 or A=43 or A=44 or A=45 or A=46 or A=47 or A=48 or A=49 or A=50 or A=51 or A=52 or A=53 or A=54 or A=55 or A=56 or A=57 or A=58 or A=59 or A=60 or A=61 or A=62 or A=63 or A=64 or A=65 or A=66 or A=67 or A=68 or A=69 or A=70 or A=71 or A=72 or A=73 or A=74 or A=75 or A=76 or A=77 or A=78 or A=79 or A=80 or A=81 or A=82 or A=83 or A=84 or A=85 or A=86 or A=87 or A=88 or A=89 or A=90 or A=91 or A=92 or A=93 or A=94 or A=95 or A=96 or A=97 or A=98 or A=99 or A=100 or A=101 or A=102 or A=103 or A=104 or A=105 or A=106 or A=107 or A=108 or A=109 or A=110 or A=111 or A=112 or A=113 or A=114 or A=115 or A=116 or A=117 or A=118
:ClrHome
:Input "Atomic Number=",A
:End
:A→V
:While A≥1 and C<2
:A-1→A
:C+1→C
:End
:While A≥1 and D<2
:A-1→A
:D+1→D
:End
:While A≥1 and E<6
:A-1→A
:E+1→E
:End
:While A≥1 and F<2
:A-1→A
:F+1→F
:End
:While A≥1 and G<6
:A-1→A
:G+1→G
:End
:While A≥1 and H<2
:A-1→A
:H+1→H
:End
:While A≥1 and I<10
:A-1→A
:I+1→I
:End
:While A≥1 and J<6
:A-1→A
:J+1→J
:End
:While A≥1 and K<2
:A-1→A
:K+1→K
:End
:While A≥1 and L<10
:A-1→A
:L+1→L
:End
:While A≥1 and M<6
:A-1→A
:M+1→M
:End
:While A≥1 and N<2
:A-1→A
:N+1→N
:End
:While A≥1 and O<14
:A-1→A
:O+1→O
:End
:While A≥1 and P<10
:A-1→A
:P+1→P
:End
:While A≥1 and Q<6
:A-1→A
:Q+1→Q
:End
:While A≥1 and R<2
:A-1→A
:R+1→R
:End
:While A≥1 and S<14
:A-1→A
:S+1→S
:End
:While A≥1 and T<10
:A-1→A
:T+1→T
:End
:While A≥1 and U<6
:A-1→A
:U+1→U
:End
:If V=24
:Then
:1→H
:5→I
:End
:If V=27
:Then
:1→H
:10→I
:End
:If V=41
:Then
:1→K
:4→L
:End
:If V=42
:Then
:1→K
:5→L
:End
:If V=44
:Then
:1→K
:7→L
:End
:If V=45
:Then
:1→K
:8→L
:End
:If V=46
:Then
:0→K
:10→L
:End
:If V=47
:Then
:1→K
:10→L
:End
:If V=57
:Then
:0→O
:1→P
:End
:If V=58
:Then
:1→O
:1→P
:End
:If V=64
:Then
:7→O
:1→P
:End
:If V=78
:Then
:1→N
:9→P
:End
:If V=79
:Then
:1→N
:10→P
:End
:If V=89
:Then
:0→S
:1→T
:End
:If V=90
:Then
:0→S
:2→T
:End
:If V=91
:Then
:2→S
:1→T
:End
:If V=92
:Then
:3→S
:1→T
:End
:If V=93
:Then
:4→S
:1→T
:End
:If V=96
:Then
:7→S
:1→T
:End
:If V=103
:Then
:0→T
:1→U
:End
:Disp ""
:Disp ""
:Disp ""
:Disp ""
:If B=0
:Then
:If C≥1
:Then
:Output(2,1,"1s")
:Output(2,3,C)
:End
:If D≥1
:Then
:Output(2,6,"2s")
:Output(2,8,D)
:End
:If E≥1
:Then
:Output(2,11,"2p")
:Output(2,13,E)
:End
:If F≥1
:Then
:Output(2,16,"3s")
:Output(2,18,F)
:End
:If G≥1
:Then
:Output(2,21,"3p")
:Output(2,23,G)
:End
:If H≥1
:Then
:Output(3,1,"4s")
:Output(3,3,H)
:End
:If I≥1
:Then
:Output(3,6,"3d")
:Output(3,8,I)
:End
:If J≥1
:Then
:Output(3,11,"4p")
:Output(3,13,J)
:End
:If K≥1
:Then
:Output(3,16,"5s")
:Output(3,18,K)
:End
:If V=46
:Then
:Output(3,16,"4d10")
:Else
:If L≥1
:Then
:Output(3,21,"4d")
:Output(3,23,L)
:End
:End
:If M≥1
:Then
:Output(4,1,"5p")
:Output(4,3,M)
:End
:If N≥1
:Then
:Output(4,6,"6s")
:Output(4,8,N)
:End
:If O≥1
:Then
:Output(4,11,"4f")
:Output(4,13,O)
:End
:If V=57
:Then
:Output(4,11,"5d1")
:Else
:If P≥1
:Then
:Output(4,16,"5d")
:Output(4,18,P)
:End
:End
:If Q≥1
:Then
:Output(4,21,"6p")
:Output(4,23,Q)
:End
:If R≥1
:Then
:Output(5,1,"7s")
:Output(5,3,R)
:End
:If S≥1
:Then
:Output(5,6,"5f")
:Output(5,8,S)
:End
:If V=89 or V=90
:Then
:Output(5,6,"6d")
:Output(5,8,T)
:Else
:If T≥1
:Then
:Output(5,11,"6d")
:Output(5,13,T)
:End
:End
:If V=103
:Then
:Output(5,11,"7p1")
:Else
:If U≥1
:Then
:Output(5,16,"7p")
:Output(5,18,U)
:End
:End
:End
:If B=1
:Then
:If V≤2
:Then
:Output(3,1,"1s")
:Output(3,3,C)
:End
:If V>2 and V≤10
:Then
:Output(3,1,"[He] 2s")
:Output(3,8,D)
:If E≥1
:Then
:Output(3,11,"2p")
:Output(3,13,E)
:End
:End
:If V>10 and V≤18
:Then
:Output(3,1,"[Ne] 3s")
:Output(3,8,F)
:If G≥1
:Then
:Output(3,11,"3p")
:Output(3,13,G)
:End
:End
:If V>18 and V≤36
:Then
:Output(3,1,"[Ar] 4s")
:Output(3,8,H)
:If I≥1
:Then
:Output(3,11,"3d")
:Output(3,13,I)
:End
:If J≥1
:Then
:Output(3,16,"4p")
:Output(3,18,J)
:End
:End
:If V=46
:Then
:Output(3,1,"[Kr] 4d10")
:End
:If V>36 and V≤54 and V≠46:Then
:Output(3,1,"[Kr] 5s"
:Output(3,8,K)
:If L≥1
:Then
:Output(3,11,"4d")
:Output(3,13,L)
:End
:If M≥1
:Then
:Output(3,16,"5p")
:Output(3,18,M)
:End
:End
:If V=57
:Then
:Output(3,1,"[Xe] 6s2 5d1")
:End
:If V>54 and V≤86 and V≠57:Then
:Output(3,1,"[Xe] 6s")
:Output(3,8,N)
:If O≥1
:Then
:Output(3,11,"4f")
:Output(3,13,O)
:End
:If P≥1
:Then
:Output(3,16,"5d")
:Output(3,18,P)
:End
:If Q≥1
:Then
:Output(3,21,"6p")
:Output(3,23,Q)
:End
:End
:If V>86 and V≤118
:Then
:Output(3,1,"[Rn] 7s")
:Output(3,8,R)
:If S≥1
:Then
:Output(3,11,"5f")
:Output(3,13,S)
:End
:If V=89 or V=90
:Then
:Output(3,11,"6d")
:Output(3,13,T)
:Else
:If T≥1
:Then
:Output(3,16,"6d")
:Output(3,18,T)
:End
:End
:If V=103
:Then
:Output(3,16,"7p1")
:Else
:If U≥1
:Then
:Output(3,21,"7p")
:Output(3,23,U)
:End
:End
:End
:End
:If V=1
:Then
:Output(1,20,"H")
:End
:If V=2
:Then
:Output(1,20,"He")
:End
:If V=3
:Then
:Output(1,20,"Li")
:End
:If V=4
:Then
:Output(1,20,"Be")
:End
:If V=5
:Then
:Output(1,20,"B")
:End
:If V=6
:Then
:Output(1,20,"C")
:End
:If V=7
:Then
:Output(1,20,"N")
:End
:If V=8
:Then
:Output(1,20,"O")
:End
:If V=9
:Then
:Output(1,20,"F")
:End
:If V=10
:Then
:Output(1,20,"Ne")
:End
:If V=11
:Then
:Output(1,20,"Na")
:End
:If V=12
:Then
:Output(1,20,"Mg")
:End
:If V=13
:Then
:Output(1,20,"Al")
:End
:If V=14
:Then
:Output(1,20,"Si")
:End
:If V=15
:Then
:Output(1,20,"P")
:End
:If V=16
:Then
:Output(1,20,"S")
:End
:If V=17
:Then
:Output(1,20,"Cl")
:End
:If V=18
:Then
:Output(1,20,"Ar")
:End
:If V=19
:Then
:Output(1,20,"K")
:End
:If V=20
:Then
:Output(1,20,"Ca")
:End
:If V=21
:Then
:Output(1,20,"Sc")
:End
:If V=22
:Then
:Output(1,20,"Ti")
:End
:If V=23
:Then
:Output(1,20,"V")
:End
:If V=24
:Then
:Output(1,20,"Cr")
:End
:If V=25
:Then
:Output(1,20,"Mn")
:End
:If V=26
:Then
:Output(1,20,"Fe")
:End
:If V=27
:Then
:Output(1,20,"Co")
:End
:If V=28
:Then
:Output(1,20,"Ni")
:End
:If V=29
:Then
:Output(1,20,"Cu")
:End
:If V=30
:Then
:Output(1,20,"Zn")
:End
:If V=31
:Then
:Output(1,20,"Ga")
:End
:If V=32
:Then
:Output(1,20,"Ge")
:End
:If V=33
:Then
:Output(1,20,"As")
:End
:If V=34
:Then
:Output(1,20,"Se")
:End
:If V=35
:Then
:Output(1,20,"Br")
:End
:If V=36
:Then
:Output(1,20,"Kr")
:End
:If V=37
:Then
:Output(1,20,"Rb")
:End
:If V=38
:Then
:Output(1,20,"Sr")
:End
:If V=39
:Then
:Output(1,20,"Y")
:End
:If V=40
:Then
:Output(1,20,"Zr")
:End
:If V=41
:Then
:Output(1,20,"Nb")
:End
:If V=42
:Then
:Output(1,20,"Mo")
:End
:If V=43
:Then
:Output(1,20,"Tc")
:End
:If V=44
:Then
:Output(1,20,"Ru")
:End
:If V=45
:Then
:Output(1,20,"Rh")
:End
:If V=46
:Then
:Output(1,20,"Pd")
:End
:If V=47
:Then
:Output(1,20,"Ag")
:End
:If V=48
:Then
:Output(1,20,"Cd")
:End
:If V=49
:Then
:Output(1,20,"In")
:End
:If V=50
:Then
:Output(1,20,"Sn")
:End
:If V=51
:Then
:Output(1,20,"Sb")
:End
:If V=52
:Then
:Output(1,20,"Te")
:End
:If V=53
:Then
:Output(1,20,"I")
:End
:If V=54
:Then
:Output(1,20,"Xe")
:End
:If V=55
:Then
:Output(1,20,"Cs")
:End
:If V=56
:Then
:Output(1,20,"Ba")
:End
:If V=57
:Then
:Output(1,20,"La")
:End
:If V=58
:Then
:Output(1,20,"Ce")
:End
:If V=59
:Then
:Output(1,20,"Pr")
:End
:If V=60
:Then
:Output(1,20,"Nd")
:End
:If V=61
:Then
:Output(1,20,"Pm")
:End
:If V=62
:Then
:Output(1,20,"Sm")
:End
:If V=63
:Then
:Output(1,20,"Eu")
:End
:If V=64
:Then
:Output(1,20,"Gd")
:End
:If V=65
:Then
:Output(1,20,"Tb")
:End
:If V=66
:Then
:Output(1,20,"Dy")
:End
:If V=67
:Then
:Output(1,20,"Ho")
:End
:If V=68
:Then
:Output(1,20,"Er")
:End
:If V=69
:Then
:Output(1,20,"Tm")
:End
:If V=70
:Then
:Output(1,20,"Yb")
:End
:If V=71
:Then
:Output(1,20,"Lu")
:End
:If V=72
:Then
:Output(1,20,"Hf")
:End
:If V=73
:Then
:Output(1,20,"Ta")
:End
:If V=74
:Then
:Output(1,20,"W")
:End
:If V=75
:Then
:Output(1,20,"Re")
:End
:If V=76
:Then
:Output(1,20,"Os")
:End
:If V=77
:Then
:Output(1,20,"Ir")
:End
:If V=78
:Then
:Output(1,20,"Pt")
:End
:If V=79
:Then
:Output(1,20,"Au")
:End
:If V=80
:Then
:Output(1,20,"Hg")
:End
:If V=81
:Then
:Output(1,20,"Tl")
:End
:If V=82
:Then
:Output(1,20,"Pb")
:End
:If V=83
:Then
:Output(1,20,"Bi")
:End
:If V=84
:Then
:Output(1,20,"Po")
:End
:If V=85
:Then
:Output(1,20,"At")
:End
:If V=86
:Then
:Output(1,20,"Rn")
:End
:If V=87
:Then
:Output(1,20,"Fr")
:End
:If V=88
:Then
:Output(1,20,"Ra")
:End
:If V=89
:Then
:Output(1,20,"Ac")
:End
:If V=90
:Then
:Output(1,20,"Th")
:End
:If V=91
:Then
:Output(1,20,"Pa")
:End
:If V=92
:Then
:Output(1,20,"U")
:End
:If V=93
:Then
:Output(1,20,"Np")
:End
:If V=94
:Then
:Output(1,20,"Pu")
:End
:If V=95
:Then
:Output(1,20,"Am")
:End
:If V=96
:Then
:Output(1,20,"Cm")
:End
:If V=97
:Then
:Output(1,20,"Bk")
:End
:If V=98
:Then
:Output(1,20,"Cf")
:End
:If V=99
:Then
:Output(1,20,"Es")
:End
:If V=100
:Then
:Output(1,20,"Fm")
:End
:If V=101
:Then
:Output(1,20,"Md")
:End
:If V=102
:Then
:Output(1,20,"No")
:End
:If V=103
:Then
:Output(1,20,"Lr")
:End
:If V=104
:Then
:Output(1,20,"Rf")
:End
:If V=105
:Then
:Output(1,20,"Db")
:End
:If V=106
:Then
:Output(1,20,"Sg")
:End
:If V=107
:Then
:Output(1,20,"Bh")
:End
:If V=108
:Then
:Output(1,20,"Hs")
:End
:If V=109
:Then
:Output(1,20,"Mt")
:End
:If V=110
:Then
:Output(1,20,"Ds")
:End
:If V=111
:Then
:Output(1,20,"Rg")
:End
:If V=112
:Then
:Output(1,20,"Cn")
:End
:If V=113
:Then
:Output(1,20,"Uut")
:End
:If V=114
:Then
:Output(1,20,"Fl")
:End
:If V=115
:Then
:Output(1,20,"Uup")
:End
:If V=116
:Then
:Output(1,20,"Lv")
:End
:If V=117
:Then
:Output(1,20,"Uus")
:End
:If V=118
:Then
:Output(1,20,"Uuo")
:End
Easy. All I have to do is change some output locations.
That's pretty cool. I wrote one of these before in Java that generated the box diagrams as well, but I never intended to distribute it, so I never quite finished it. You can take a look at that here if you wish. (Run it with "javac Electron.java && java Electron".)

It's always nice to see new programs for the TI-84+ CSE, either TI-BASIC or Assembly. The CSE needs more software.
Would you be interested in some suggestions for optimization? There is a massive amount of optimization that could be done in this particular program. Smile
like the ugly mess of 0->(variable here) that begins the program?
That's definitely one example. More glaring, though, is:

Code:
Repeat A=1 or A=2 or A=3 or A=4 or A=5 or A=6 or A=7 or A=8 or A=9 or A=10 or A=11 or A=12 or A=13 or A=14 or A=15 or A=16 or A=17 or A=18 or A=19 or A=20 or A=21 or A=22 or A=23 or A=24 or A=25 or A=26 or A=27 or A=28 or A=29 or A=30 or A=31 or A=32 or A=33 or A=34 or A=35 or A=36 or A=37 or A=38 or A=39 or A=40 or A=41 or A=42 or A=43 or A=44 or A=45 or A=46 or A=47 or A=48 or A=49 or A=50 or A=51 or A=52 or A=53 or A=54 or A=55 or A=56 or A=57 or A=58 or A=59 or A=60 or A=61 or A=62 or A=63 or A=64 or A=65 or A=66 or A=67 or A=68 or A=69 or A=70 or A=71 or A=72 or A=73 or A=74 or A=75 or A=76 or A=77 or A=78 or A=79 or A=80 or A=81 or A=82 or A=83 or A=84 or A=85 or A=86 or A=87 or A=88 or A=89 or A=90 or A=91 or A=92 or A=93 or A=94 or A=95 or A=96 or A=97 or A=98 or A=99 or A=100 or A=101 or A=102 or A=103 or A=104 or A=105 or A=106 or A=107 or A=108 or A=109 or A=110 or A=111 or A=112 or A=113 or A=114 or A=115 or A=116 or A=117 or A=118

Which should just be:

Code:
Repeat A>=1 and A<=118
And this entire chunk of code can be converted into a single Output(...sub()) command:
Code:
:If V=1
:Then
:Output(1,20,"H")
:End
:If V=2
:Then
:Output(1,20,"He")
:End
[...]
:If V=117
:Then
:Output(1,20,"Uus")
:End
:If V=118
:Then
:Output(1,20,"Uuo")
:End
merthsoft wrote:
That's definitely one example. More glaring, though, is:

Code:
Repeat A=1 or A=2 or A=3 or A=4 or A=5 or A=6 or A=7 or A=8 or A=9 or A=10 or A=11 or A=12 or A=13 or A=14 or A=15 or A=16 or A=17 or A=18 or A=19 or A=20 or A=21 or A=22 or A=23 or A=24 or A=25 or A=26 or A=27 or A=28 or A=29 or A=30 or A=31 or A=32 or A=33 or A=34 or A=35 or A=36 or A=37 or A=38 or A=39 or A=40 or A=41 or A=42 or A=43 or A=44 or A=45 or A=46 or A=47 or A=48 or A=49 or A=50 or A=51 or A=52 or A=53 or A=54 or A=55 or A=56 or A=57 or A=58 or A=59 or A=60 or A=61 or A=62 or A=63 or A=64 or A=65 or A=66 or A=67 or A=68 or A=69 or A=70 or A=71 or A=72 or A=73 or A=74 or A=75 or A=76 or A=77 or A=78 or A=79 or A=80 or A=81 or A=82 or A=83 or A=84 or A=85 or A=86 or A=87 or A=88 or A=89 or A=90 or A=91 or A=92 or A=93 or A=94 or A=95 or A=96 or A=97 or A=98 or A=99 or A=100 or A=101 or A=102 or A=103 or A=104 or A=105 or A=106 or A=107 or A=108 or A=109 or A=110 or A=111 or A=112 or A=113 or A=114 or A=115 or A=116 or A=117 or A=118

Which should just be:

Code:
Repeat A>=1 and A<=118
I did do that in v0.1, but I changed it to that in v0.2 to disable decimals, which may make the code act funny
FrozenFire49 wrote:
I did do that in v0.1, but I changed it to that in v0.2 to disable decimals, which may make the code act funny
Then you should do this:
Code:
Repeat A>=1 and A<=118 and A=int(A
KermMartian wrote:
FrozenFire49 wrote:
I did do that in v0.1, but I changed it to that in v0.2 to disable decimals, which may make the code act funny
Then you should do this:
Code:
Repeat A>=1 and A<=118 and A=int(A
I feel noobish. That should decrease the size about 1000 bytes. Neutral

Also, why was v0.2 rejected, I can't open up the PM. Confused
It was because you uploaded BMP screenshots, which are about 100x larger than GIF or PNG screenshots. Please re-upload with GIF or PNG screenshots (you can convert them using MS Paint or the GIMP, or use jsTIfied).
Version 0.21 is now in the archives.

http://www.cemetech.net/programs/index.php?mode=file&id=984

In v0.21, with help from Merth and Kerm, I changed:
Code:
:Repeat A=1 or A=2 or A=3 ... A=117 or A=118
:ClrHome
:Input "Atomic Number=",A
:End
to:
Code:
:Repeat A≥1 and A≤118
:ClrHome
:Input "Atomic Number=",A
:A+0.5→A
:int(A)→A
:End
Which makes it over 500 bytes smaller and alot faster.Cool
LuxenD wrote:
like the ugly mess of 0->(variable here) that begins the program?
How would I clean up the mess and compact it?
KermMartian wrote:
And this entire chunk of code can be converted into a single Output(...sub()) command
As you could probably guess, I'm not that familiar with some of the commands. Could you give more detail?

Code:
:0→C
:0→D
:0→E
:0→F
:0→G
:0→H
:0→I
:0→J
:0→K
:0→L
:0→M
:0→N
:0→O
:0→P
:0→Q
:0→R
:0→S
:0→T
:0→U

should be

Code:
DelVar CDelVar DDelVar EDelVar FDelVar GDelVar HDelVar IDelVar JDelVar KDelVar LDelVar MDelVar NDelVar ODelVar PDelVar QDelVar RDelVar SDelVar TDelVar U

There's a "bug" in the BASIC parser that makes DelVar not need a newline or : after it, saving you a byte there.

Additionally, I'm not sure

Code:
:A+0.5→A
:int(A)→A

Is right. What are you trying to accomplish there? If someone enters 5.99, that's going to make A=6, which is weird. Shouldn't it equal 5, or prompt the user again? If you're trying to round, just use the round( token.

Quote:
As you could probably guess, I'm not that familiar with some of the commands. Could you give more detail?

TI-Basic Developer is a great resource. From that page:
The sub( command is used to get a substring, or a specific part of a string. It takes three arguments: string is the source string to get the substring from, start is the index of the token to start from, and length is the length of the substring you want. For example:

Code:

:sub("TI-BASIC",4,5
    "BASIC"
:sub("TI-BASIC",5,2
    "AS"
FrozenFire49 wrote:
Version 0.21 is now in the archives.

http://www.cemetech.net/programs/index.php?mode=file&id=984

LuxenD wrote:
like the ugly mess of 0->(variable here) that begins the program?
How would I clean up the mess and compact it?
Assuming those numbers are used to store the number of electronics in each successive valence shell, you should use a 21-(ish?) element list rather than 21 separate numeric variables. This will allow the rest of your program to be written much more compactly. Among other things, this will let you compact this:
Code:
:A→V
:While A≥1 and C<2
:A-1→A
:C+1→C
:End
:While A≥1 and D<2
:A-1→A
:D+1→D
:End
:While A≥1 and E<6
:A-1→A
:E+1→E
:End
:While A≥1 and F<2
:A-1→A
:F+1→F
:End
:While A≥1 and G<6
:A-1→A
:G+1→G
:End
:While A≥1 and H<2
:A-1→A
:H+1→H
:End
:While A≥1 and I<10
:A-1→A
:I+1→I
:End
:While A≥1 and J<6
:A-1→A
:J+1→J
:End
:While A≥1 and K<2
:A-1→A
:K+1→K
:End
:While A≥1 and L<10
:A-1→A
:L+1→L
:End
:While A≥1 and M<6
:A-1→A
:M+1→M
:End
:While A≥1 and N<2
:A-1→A
:N+1→N
:End
:While A≥1 and O<14
:A-1→A
:O+1→O
:End
:While A≥1 and P<10
:A-1→A
:P+1→P
:End
:While A≥1 and Q<6
:A-1→A
:Q+1→Q
:End
:While A≥1 and R<2
:A-1→A
:R+1→R
:End
:While A≥1 and S<14
:A-1→A
:S+1→S
:End
:While A≥1 and T<10
:A-1→A
:T+1→T
:End
:While A≥1 and U<6
:A-1→A
:U+1→U
:End
to this:

Code:
A->V // back up number of electrons
1->X // which list element we're looking at
{2,2,6,2,6,2,10,6,2,10,6,2,14,10,6,2,14,10,6->L2 // valence capacities
dim(L2->dim(L1
Fill(0,L1 // L1 will be for the actual shell fill of this atom
While A>0
A-1->A
1+L1(X->L1(X
If L1(X)=L2(X
X+1->X
End


KermMartian wrote:
And this entire chunk of code can be converted into a single Output(...sub()) command
As you could probably guess, I'm not that familiar with some of the commands. Could you give more detail?[/quote] Once you deal with learning lists, we can go into tricks to compact substring picking.
Here is the code so far
Code:
::DCS
:"0000000D30000000B030000000000D000D000003D0000030000BD000000300000003B00D3000D0000000000000000
000000000012000000030D000121200030DD030002121000D0300000002100000000000000000000000000DB003D000
3000000B3000000D00000300000D300000D000D000000000030000000003D0000000"
:ClrHome
:DelVar BDelVar CDelVar DDelVar EDelVar FDelVar GDelVar HDelVar IDelVar JDelVar KDelVar LDelVar MDelVar NDelVar ODelVar PDelVar QDelVar RDelVar SDelVar TDelVar U
:ClrHome
:Menu("Noble Gas Notation?","Yes",1,"No",0
:Lbl 1
:1→B
:Lbl 0
:Repeat A≥1 and A≤118 and A=int(A
:ClrHome
:Input "Atomic Number=",A
:End
:A→V
:1→X
:{2,2,6,2,6,2,10,6,2,10,6,2,14,10,6,2,14,10,6}→∟LEVEL
:dim(∟LEVEL→dim(∟SHELL
:Fill(0,∟SHELL
:While A>0
:A-1→A
:1+∟SHELL(X→∟SHELL(X
:If ∟SHELL(X)=∟LEVEL(X
:X+1→X
:End
:If V=24
:Then
:1→∟SHELL(6
:5→∟SHELL(7
:End
:If V=27
:Then
:1→∟SHELL(6
:10→∟SHELL(7
:End
:If V=41
:Then
:1→∟SHELL(9
:4→∟SHELL(10
:End
:If V=42
:Then
:1→∟SHELL(9
:5→∟SHELL(10
:End
:If V=44
:Then
:1→∟SHELL(9
:7→∟SHELL(10
:End
:If V=45
:Then
:1→∟SHELL(9
:8→∟SHELL(10
:End
:If V=46
:Then
:0→∟SHELL(9
:10→∟SHELL(10
:End
:If V=47
:Then
:1→∟SHELL(9
:10→∟SHELL(10
:End
:If V=57
:Then
:0→∟SHELL(13
:1→∟SHELL(14
:End
:If V=58
:Then
:1→∟SHELL(13
:1→∟SHELL(14
:End
:If V=64
:Then
:7→∟SHELL(13
:1→∟SHELL(14
:End
:If V=78
:Then
:1→∟SHELL(12
:9→∟SHELL(14
:End
:If V=79
:Then
:1→∟SHELL(12
:10→∟SHELL(14
:End
:If V=89
:Then
:0→∟SHELL(17
:1→∟SHELL(18
:End
:If V=90
:Then
:0→∟SHELL(17
:2→∟SHELL(18
:End
:If V=91
:Then
:2→∟SHELL(17
:1→∟SHELL(18
:End
:If V=92
:Then
:3→∟SHELL(17
:1→∟SHELL(18
:End
:If V=93
:Then
:4→∟SHELL(17
:1→∟SHELL(18
:End
:If V=96
:Then
:7→∟SHELL(17
:1→∟SHELL(18
:End
:If V=103
:Then
:0→∟SHELL(18
:1→∟SHELL(19
:End
:Disp ""
:Disp ""
:Disp ""
:Disp ""
:If B=0
:Then
:If ∟SHELL(1)≥1
:Then
:Output(2,1,"1s")
:Output(2,3,∟SHELL(1
:End
:If ∟SHELL(2)≥1
:Then
:Output(2,6,"2s")
:Output(2,8,∟SHELL(2
:End
:If ∟SHELL(3)≥1
:Then
:Output(2,11,"2p")
:Output(2,13,∟SHELL(3
:End
:If ∟SHELL(4)≥1
:Then
:Output(2,16,"3s")
:Output(2,18,∟SHELL(4
:End
:If ∟SHELL(5)≥1
:Then
:Output(2,21,"3p")
:Output(2,23,∟SHELL(5
:End
:If ∟SHELL(6)≥1
:Then
:Output(3,1,"4s")
:Output(3,3,∟SHELL(6
:End
:If ∟SHELL(7)≥1
:Then
:Output(3,6,"3d")
:Output(3,8,∟SHELL(7
:End
:If ∟SHELL(8)≥1
:Then
:Output(3,11,"4p")
:Output(3,13,∟SHELL(8
:End
:If ∟SHELL(9)≥1
:Then
:Output(3,16,"5s")
:Output(3,18,∟SHELL(9
:End
:If V=46
:Then
:Output(3,16,"4d10")
:Else
:If ∟SHELL(10)≥1
:Then
:Output(3,21,"4d")
:Output(3,23,∟SHELL(10
:End
:End
:If ∟SHELL(11)≥1
:Then
:Output(4,1,"5p")
:Output(4,3,∟SHELL(11
:End
:If ∟SHELL(12)≥1
:Then
:Output(4,6,"6s")
:Output(4,8,∟SHELL(12
:End
:If ∟SHELL(13)≥1
:Then
:Output(4,11,"4f")
:Output(4,13,∟SHELL(13
:End
:If V=57
:Then
:Output(4,11,"5d1")
:Else
:If ∟SHELL(14)≥1
:Then
:Output(4,16,"5d")
:Output(4,18,∟SHELL(14
:End
:End
:If ∟SHELL(15)≥1
:Then
:Output(4,21,"6p")
:Output(4,23,∟SHELL(15
:End
:If ∟SHELL(16)≥1
:Then
:Output(5,1,"7s")
:Output(5,3,∟SHELL(16
:End
:If ∟SHELL(17)≥1
:Then
:Output(5,6,"5f")
:Output(5,8,∟SHELL(17
:End
:If V=89 or V=90
:Then
:Output(5,6,"6d")
:Output(5,8,∟SHELL(18
:Else
:If ∟SHELL(18)≥1
:Then
:Output(5,11,"6d")
:Output(5,13,∟SHELL(18
:End
:End
:If V=103
:Then
:Output(5,11,"7p1")
:Else
:If ∟SHELL(19)≥1
:Then
:Output(5,16,"7p")
:Output(5,18,∟SHELL(19
:End
:End
:End
:If B=1
:Then
:If V≤2
:Then
:Output(3,1,"1s")
:Output(3,3,∟SHELL(1
:End
:If V>2 and V≤10
:Then
:Output(3,1,"[He] 2s")
:Output(3,8,∟SHELL(2
:If ∟SHELL(3)≥1
:Then
:Output(3,11,"2p")
:Output(3,13,∟SHELL(3
:End
:End
:If V>10 and V≤18
:Then
:Output(3,1,"[Ne] 3s")
:Output(3,8,∟SHELL(4
:If ∟SHELL(5)≥1
:Then
:Output(3,11,"3p")
:Output(3,13,∟SHELL(5
:End
:End
:If V>18 and V≤36
:Then
:Output(3,1,"[Ar] 4s")
:Output(3,8,∟SHELL(6
:If ∟SHELL(7)≥1
:Then
:Output(3,11,"3d")
:Output(3,13,∟SHELL(7
:End
:If ∟SHELL(8)≥1
:Then
:Output(3,16,"4p")
:Output(3,18,∟SHELL(8
:End
:End
:If V=46
:Then
:Output(3,1,"[Kr] 4d10")
:End
:If V>36 and V≤54 and V≠46:Then
:Output(3,1,"[Kr] 5s"
:Output(3,8,∟SHELL(9
:If ∟SHELL(10)≥1
:Then
:Output(3,11,"4d")
:Output(3,13,∟SHELL(10
:End
:If ∟SHELL(11)≥1
:Then
:Output(3,16,"5p")
:Output(3,18,∟SHELL(11
:End
:End
:If V=57
:Then
:Output(3,1,"[Xe] 6s2 5d1")
:End
:If V>54 and V≤86 and V≠57:Then
:Output(3,1,"[Xe] 6s")
:Output(3,8,∟SHELL(12
:If ∟SHELL(13)≥1
:Then
:Output(3,11,"4f")
:Output(3,13,∟SHELL(13
:End
:If ∟SHELL(14)≥1
:Then
:Output(3,16,"5d")
:Output(3,18,∟SHELL(14
:End
:If ∟SHELL(15)≥1
:Then
:Output(3,21,"6p")
:Output(3,23,∟SHELL(15
:End
:End
:If V>86 and V≤118
:Then
:Output(3,1,"[Rn] 7s")
:Output(3,8,∟SHELL(16
:If ∟SHELL(17)≥1
:Then
:Output(3,11,"5f")
:Output(3,13,∟SHELL(17
:End
:If V=89 or V=90
:Then
:Output(3,11,"6d")
:Output(3,13,∟SHELL(18
:Else
:If ∟SHELL(18)≥1
:Then
:Output(3,16,"6d")
:Output(3,18,∟SHELL(18
:End
:End
:If V=103
:Then
:Output(3,16,"7p1")
:Else
:If ∟SHELL(19)≥1
:Then
:Output(3,21,"7p")
:Output(3,23,∟SHELL(19
:End
:End
:End
:End
I left out the atomic symbols part of the code because I haven't worked on that part yet. Also,note the Doors icon in there.Very Happy

The list thing and the other stuff that I added makes the program a lot faster, but it added the 500 bytes back on.
KermMartian wrote:
And this entire chunk of code can be converted into a single Output(...sub()) command:
Code:
:If V=1
:Then
:Output(1,20,"H")
:End
[...]
:If V=118
:Then
:Output(1,20,"Uuo")
:End
merthsoft wrote:
Quote:
As you could probably guess, I'm not that familiar with some of the commands. Could you give more detail?

TI-Basic Developer is a great resource. From that page:
The sub( command is used to get a substring, or a specific part of a string. It takes three arguments: string is the source string to get the substring from, start is the index of the token to start from, and length is the length of the substring you want. For example:

Code:
:sub("TI-BASIC",4,5
    "BASIC"
:sub("TI-BASIC",5,2
    "AS"
So, would I set up the string like this?
Code:
:Output(1,20,sub("H  He Li ... UusUuo",3V-2,3


Also, I get why saving hundreds of bytes in a program is important, but can someone explain why it's important to save just a few bytes?

Edit:
Does the Doors icon makes Doors 8.0 required for this program?
Version 0.22 released

And here is the entire last half of the code
Code:
:Disp "Symbol:"
:Output(2,8,sub("H  He Li Be B  C  N  O  F  Ne Na Mg Al Si P  S  Cl Ar K  Ca Sc Ti V  Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr Rb Sr Y  Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb Te I  Xe Cs Ba La Ce Pr Nd Pm Sm Eu Gd Tb Dy Ho Er Tm Yb Lu Hf Ta W  Re Os Ir Pt Au Hg Tl Pb Bi Po At Rn Fr Ra Ac Th Pa U  Np Pu Am Cm Bk Cf Es Fm Md No Lr Rf Db Sg Bh Hs Mt Ds Rg Cn UutFl UupLv UusUuo",3V-2,3
:Output(7,8,"Press Enter"
:Pause
:ClrHome
How else would I be able to optimize the code?

As for right now, I'll be working on v0.3, which will include more info on each element, that I hope to be including atomic mass, atomic radius, group, period, and more, though I haven't decided if I should use the technique above with the string or use lists.
Store

Code:
"H  He Li Be B  C  N  O  F  Ne Na Mg Al Si P  S  Cl Ar K  Ca Sc Ti V  Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr Rb Sr Y  Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb Te I  Xe Cs Ba La Ce Pr Nd Pm Sm Eu Gd Tb Dy Ho Er Tm Yb Lu Hf Ta W  Re Os Ir Pt Au Hg Tl Pb Bi Po At Rn Fr Ra Ac Th Pa U  Np Pu Am Cm Bk Cf Es Fm Md No Lr Rf Db Sg Bh Hs Mt Ds Rg Cn UutFl UupLv UusUuo"
in a string (i.e. Str2) and do

Code:
Output(2,8,sub(Str2,3V-2,3
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement