Would you like to see a KSP for the CE?
Yes
 69%  [ 47 ]
No
 4%  [ 3 ]
Only if it was really good
 26%  [ 18 ]
Total Votes : 68

No, there is going to be a huge setback because I actually need to learn ASM first. And that takes at least one month to learn. I also am busy with school right now. This is going to take a while... Sad
This is my shackle for not doing everything that i want to in C... I need to actually learn it first!! ;P
so, uhh, when you mean 2d ksp, you mean like this?.
Luxen wrote:
so, uhh, when you mean 2d ksp, you mean like this?.

Probably something similar to that, I'll draw some ideas from it and rearrange the building process and the launch so it's more calc friendly. Smile I'm not sure if I'll include rovers since the calculator probably couldn't handle it.
I went through the learn to code in assembly in 28 days over the summer, and learned how to code in assembly ( although I haven't really written a fully functional program yet). Can I help with the programming?

A good idea would be to plan out the entire program before officially beginning the coding process. it will not only give you time to learn ASM (or C), but it will also create a solid foundation for the project and prevent confusion with respect to what exactly needs to be coded.
So I've decided no assembly for now, instead I'm making a Basic version of this. I've got the ship builder finished and now I just need formulas, LOTS of formulas. I have looked at several websites for the physics and astrodynamics equations. However, as you can probably guess it's rocket science, it's complicated. So my question is, does anyone know astrodynamics? or any physics equations that would be useful for this program? or maybe a website that could explain the formulas in laymans terms?
It shouldn't be to hard, all you really need is trigonometry and algebra. After all, it's only rocket science Razz
Edit: if you write this in C or asm i will be willing to do a physics engine for it.
If I were to simplify a lot, you only need two equations:

F = ma, or perhaps rearranged to a = F/m. Given a known thrust (easily simplified to be constant or at least a simple fraction of maximum thrust) your acceleration is the thrust divided by craft mass.

Assuming some kind of known time step (easily implemented as a fixed frame step), mass of the craft changes at a rate roughly proportional to thrust (as a proxy for fuel flow).

Meanwhile, gravitational acceleration g = Gm/r2, where G is an arbitrary constant, m is the mass of the parent body (simplifying such that your craft has no gravity of its own since it's a very small mass) and r is the distance from the center of the parent body.

Then it's just a matter of doing vector addition, where a little trigonometry comes in handy (since it's easy to treat all bodies as spherical and you want some arbitrary common coordinate system). Acceleration due to thrust is a vector of magnitude a opposite the direction of thrust, and acceleration due to gravity is a vector of magnitude g towards the center of the parent body.
Tari wrote:
(simplifying such that your craft has no gravity of its own since it's a very small mass)

Actually, in KSP, the celestial bodies are "on rails", which means they literally cannot be moved (since this could cause them to fall into unstable orbits and maybe someday crash into each other). Therefore, it would be staying true to the original game if you ignored the gravity induced by the mass of your ship. Besides, the mass of a celestial body would be several orders of magnitude greater so any change in trajectory would probably be rounded out by the numbering system used.
Thanks Tari and mr womp womp! This was a huge help. I'll go work on implementing the formulas now. Very Happy
c4ooo, That's a really nice offer. Of course it'll be a while before I can get started on an ASM version of this, but I'll keep your offer in mind. Smile
TheLastMillennial wrote:
Thanks Tari and mr womp womp! This was a huge help. I'll go work on implementing the formulas now. Very Happy
c4ooo, That's a really nice offer. Of course it'll be a while before I can get started on an ASM version of this, but I'll keep your offer in mind. Smile

I would recommend doing this in C if I were you; but that's just me Smile Best of luck!
So I've gotten the game to a fairly playable version now. However I'm running into some a strange bug. For some reason the program (ZLAUNCH) is spawning my rocket at y=8 instead of the y=5 (I set it at the beginning of the program.) Confused
here's the link to the 3 programs needed to use this. (prgmCSP is the main program) I also put as much commenting as I could so it will be easier for you guys to figure out my code.

Link removed

If any of you could point out my (hopefully just a simple, stupid) mistake, that would be amazing! Very Happy Also any optimizations would be greatly appreciated. Smile

Forgot a ReadMe!
Use [enter] and the top 5 buttons to navigate most of the program. I think that's it for now.

EDIT: Hey I found and fixed the bug! (forgot I used a For( loop with the var Y in it) Laughing
MateoC (on SAX) wrote:
5:27:20PM [#] [MateoC] If you post code people would be happy to suggest optimizations
5:27:23PM [#] *MateoC hided

So I'm going to ask for suggestion Very Happy
Also, I'm still not sure how to do the physics of this. (I'm taking physics and calculus next year)

Or download the programs link removed

Outdated code
prgmCSP

Code:
 "Setup
ClrHome
Disp "CSP","Loading..."


"DECLARATIONS­­­­­­­­­­­

"Misc-------------------


"Lists------------------
:"WORLD Chell
:"1 is mass

SetUpEditor ⌊CHELL
1→dim(⌊CHELL
1000→⌊CHELL(1)
SetUpEditor ⌊CSP11
5→dim(⌊CSP11
SetUpEditor ⌊CSP12
5→dim(⌊CSP12
SetUpEditor ⌊CSP13
5→dim(⌊CSP13
SetUpEditor ⌊CSP14
5→dim(⌊CSP14
SetUpEditor ⌊CSP15
5→dim(⌊CSP15
SetUpEditor ⌊CSP21
5→dim(⌊CSP11
SetUpEditor ⌊CSP22
5→dim(⌊CSP12
SetUpEditor ⌊CSP23
5→dim(⌊CSP13
SetUpEditor ⌊CSP24
5→dim(⌊CSP14
SetUpEditor ⌊CSP25
5→dim(⌊CSP15
SetUpEditor ⌊CSP31
5→dim(⌊CSP11
SetUpEditor ⌊CSP32
5→dim(⌊CSP12
SetUpEditor ⌊CSP33
5→dim(⌊CSP13
SetUpEditor ⌊CSP34
5→dim(⌊CSP14
SetUpEditor ⌊CSP35
5→dim(⌊CSP15

"Matrices---------------
:{5,5}→dim([B])
:"SETS UP MATRIX B (vab)

"Strings----------------
:"P/S| Fuel| Engn| Aero| -> →Str0

:"USED AS PARTS
::"→Str1

"Variables--------------
:"A for altitude
:"C is colum SEE R
1→C
:"D for direction
:"F IS FUEL
0→F
:"I IS PART ID
0→I
:"K is the getkey
0→K
:"M IS MASS
0→M
:"P is planet mass [zlaunch]
0→P
:"R is row SEE C
1→R
:"T IS THRUST
0→T
:"U untill empty(fuel consumed per second)
0→U
:"XY ARE PART CORDINATES
1→X
1→Y
"N and S are previous part coordinates
1→N
1→S

"­­­­­­­­­­­­­­­­­­­­­­­
ClrHome
Output(2,12,"CSP
Output(9,23,"B.12
Output(10,23,"v.01
Pause
ClrHome
Disp " _____","|     |","|/ / /|","|| | ||","|| | ||","|\ \ \|","|_____|","  VAB
Pause
ClrHome
"CLEARS MATRIX B
For(R,1,5
For(C,1,5
1→[B](R,C)
End
End

"PRINTS OUT GRID and ship
Lbl 1
Float
ClrHome
"prints out coordinates
For(X,1,5,1
Output(2,X+9,X
End
For(Y,1,5,1
Output(Y+2,9,Y
End

"Prints out ship
"NEEDS OPTIMIZATION--
For(X,10,14,1
For(Y,3,7,1
If [B](Y-2,X-9)=1
Output(Y,X,"·
If [B](Y-2,X-9)=2
Output(Y,X,"▫
If [B](Y-2,X-9)=3
Output(Y,X,"Ŝ
If [B](Y-2,X-9)=4
Output(Y,X,"^
If [B](Y-2,X-9)=5
Output(Y,X,"/
If [B](Y-2,X-9)=6
Output(Y,X,"\
End
End
"---------------------


Output(9,1,"Mass
Output(9,6,M
Output(10,1,"Prt| <-  |Sv/Ld|Launch|Ext"
0→K
Lbl W2
getKey→K
If K≠0
"P FOR PARTS
If K=11
Goto P
"Undo
If K=12
Goto U
"Save/Load
If K=13
Goto R
"LAUNCH
If K=14
Goto L
"EXITS
If K=15
Goto E
If K>15
Goto W2
Goto W2

Lbl P
ClrHome
Output(10,1,Str0
getKey→K
If K≠15 or K≠0
prgmZPARTS
ClrHome
"checks to continue or not
If X=1
Goto 1

"Part movement setup
1→X
1→Y
"since X and Y were taken
1→S
1→N
"Coordinates
For(X,1,5,1
Output(2,X+9,X
End
For(Y,1,5,1
Output(Y+2,9,Y
End
"Prints out ship
"NEEDS OPTIMIZATION--
For(X,10,14,1
For(Y,3,7,1
If [B](Y-2,X-9)=1
Output(Y,X,"·
If [B](Y-2,X-9)=2
Output(Y,X,"▫
If [B](Y-2,X-9)=3
Output(Y,X,"Ŝ
If [B](Y-2,X-9)=4
Output(Y,X,"^
If [B](Y-2,X-9)=5
Output(Y,X,"/
If [B](Y-2,X-9)=6
Output(Y,X,"\
End
End
"--------------------

"makes it store correct part
Lbl W1
If I=2
"▫→Str1
If I=3
"Ŝ→Str1
If I=4
"^→Str1
If I=5
"/→Str1
If I=6
"\→Str1

"Part movement
0→K
Repeat abs(Ans-63)=42
While [B](S,N)≠1
1+S→S
If Y=5
N+1→N
End
Output(Y+2,X+9,"·
S→Y
N→X
Output(S+2,N+9,Str1
getKey→K
If Ans=24 and N-1≥1
N-1→N
If Ans=25 and S-1≥1
S-1→S
If Ans=26 and 5≥N+1
N+1→N
If Ans=34 and 5≥S+1
S+1→S
End
"stores ID in correct place on list
I→[B](S,N)
Goto 1

"Undo
Lbl U
1→[B](S,N)
Goto 1

"Save/load
Lbl R
ClrHome
Menu("Save/Load","Save",S,"Load",R1,"Back",1

Lbl R1
Menu("Load","Save Slot 1",R2,"Save Slot 2",R3,"Save Slot 3",R4,"Back",1

Lbl R2
Listmatr(⌊CSP11,⌊CSP12,⌊CSP13,⌊CSP14,⌊CSP15,[B]
For(X,10,14,1
For(Y,3,7,1
If [B](Y-2,X-9)=3
Then
150→F
200+M→M
Else
End
If [B](Y-2,X-9)=4
Then
300+M→M
5000+T→T
5+U→U
Else
End
If [B](Y-2,X-9)=5
End
If [B](Y-2,X-9)=6
End
End
End
Disp "Loaded!"
Pause
Goto 1

Lbl R3
Listmatr(⌊CSP21,⌊CSP22,⌊CSP23,⌊CSP24,⌊CSP25,[B]
For(X,10,14,1
For(Y,3,7,1
If [B](Y-2,X-9)=3
Then
150→F
200+M→M
Else
End
If [B](Y-2,X-9)=4
Then
300+M→M
5000+T→T
5+U→U
Else
End
If [B](Y-2,X-9)=5
End
If [B](Y-2,X-9)=6
End
End
End
Disp "Loaded!"
Pause
Goto 1

Lbl R4
Listmatr(⌊CSP31,⌊CSP32,⌊CSP33,⌊CSP34,⌊CSP35,[B]
For(X,10,14,1
For(Y,3,7,1
If [B](Y-2,X-9)=3
Then
150→F
200+M→M
Else
End
If [B](Y-2,X-9)=4
Then
300+M→M
5000+T→T
5+U→U
Else
End
If [B](Y-2,X-9)=5
End
If [B](Y-2,X-9)=6
End
End
End
Disp "Loaded!"
Pause
Goto 1


Lbl S
Menu("Save to","Save Slot 1",S1,"Save Slot 2",S2,"Save Slot 3",S3,"Back",1

Lbl S1
Matrlist([B],⌊CSP11,⌊CSP12,⌊CSP13,⌊CSP14,⌊CSP15
Disp "Saved!"
Pause
Goto 1

Lbl S2
Matrlist([B],⌊CSP21,⌊CSP22,⌊CSP23,⌊CSP24,⌊CSP25
Disp "Saved!"
Pause
Goto 1

Lbl S3
Matrlist([B],⌊CSP31,⌊CSP32,⌊CSP33,⌊CSP34,⌊CSP35
Disp "Saved!"
Pause
Goto 1

"LAUNCH
Lbl L
prgmZLAUNCH

If A=1
Goto 1

Lbl E
Disp "QUITTING...

DelVar L₁
DelVar L₂
DelVar L₃
DelVar L₄
DelVar L₅
Archive ⌊CHELL
Archive ⌊CSP11
Archive ⌊CSP12
Archive ⌊CSP13
Archive ⌊CSP14
Archive ⌊CSP15
Archive ⌊CSP21
Archive ⌊CSP22
Archive ⌊CSP23
Archive ⌊CSP24
Archive ⌊CSP25
Archive ⌊CSP31
Archive ⌊CSP32
Archive ⌊CSP33
Archive ⌊CSP34
Archive ⌊CSP35
"→Str1
"→Str2
"→Str3
"→Str4
"→Str5
Float
"END!


prgmZPARTS

Code:
Lbl 0
ClrHome
"P/S| Fuel| Engn| Aero| -> →Str0
Output(10,1,Str0
0→K
Repeat K≠0
getKey→K
End
"GOTO POD
If K=11
Goto P
"GOTO FUEL
If K=12
Goto F
"GOTO ENGINE
If K=13
Goto E
"GOTO AERO
If K=14
Goto A
"EXIT
If K=15
Goto 98

"POD MENU
Lbl P
Menu("PODS","▫ Mk.1",P1,"BACK",0

Lbl P1
ClrHome
Disp "STATS:","MASS=2"
Output(10,1,"Continue              Back"
Repeat max(K={11,12,15
getKey→K
End
If K=11 or K=12
2→I
If K=15
Goto 0
Goto 99

Lbl F
Menu("Fuel","Ŝ Mk.1",F1,"BACK",0


"Mk.1
Lbl F1
ClrHome
Disp "Stats:","Lf=150","Mass=200
Output(10,1,"Continue              Back"
Repeat max(K={11,12,15
getKey→K
End
If K=11 or K=12
3→I
If K=15
Goto 0
Goto 99


Lbl E
Menu("Engines","^ Mk.1",E1,"BACK",0

Lbl E1
"^
ClrHome
Disp "Stats:","Thrust=2.5kN","Mass=300","5FpS
Output(10,1,"Continue              Back"
Repeat max(K={11,12,15
getKey→K
End
If K=11 or K=12
4→I
If K=15
Goto 0
Goto 99

Lbl A
Menu("Aerodynamics","/ Mk.1 LEFT",A1,"\ Mk.1 RIGHT",A2,"Back",0

Lbl A1
"/
ClrHome
Disp "Stats:","LEFT","Stability= +1","Mass=.5"
Output(10,1,"Continue              Back"
Repeat max(K={11,12,15
getKey→K
End
If K=11 or K=12
5→I
End
If K=15
Goto 0
Goto 99

Lbl A2
"\
ClrHome
Disp "Stats:","RIGHT","Stability= +1","Mass=.5"
Output(10,1,"Continue              Back"
Repeat max(K={11,12,15
getKey→K
End
If K=11 or K=12
6→I
End
If K=15
Goto 0
Goto 99

"returns so you DONT move a part
Lbl 98
1→X
Return

"returns so you can move the part
Lbl 99
0→X
Return


prgmZLAUNCH

Code:
"Prelaunch setup
ClrHome
Output(5,9,"Loading...

:SetUpEditor L₁
:7→dim(L₁)
:SetUpEditor L₂
:7→dim(L₂)
:SetUpEditor L₃
:7→dim(L₃)
:SetUpEditor L₄
:7→dim(L₄)
:SetUpEditor L₅
:7→dim(L₅)

"load variables
:"A for altitude
1→A
:"B for accelleration (bad var)
:"D for direction or tilt of craft
0→D
:"K is getKey
0→K
:"M is rocket Mass
:"S is speed
0→S
:"T is thrust
0→T
:"U is FpS
0→U
:"V is verifacation +1 per correct part
0→V
:"postion of ship
16→X
5→Y

"Load HUD strings
"Altitude-<              >-→Str0
"get matrix into lists
Output(6,5,"Matrix to list
Matrlist([B],L₁,L₂,L₃,L₄,L₅

"verifys all needed parts are present
Output(6,5,"  Verifying...
If inString(toString([B]),"2"
Then
1+V→V
Else
Disp "Error","No pod!"
Pause
ClrHome
Return
End

If inString(toString([B]),"3"
Then
1+V→V
Else
Disp "Error","No fuel!"
Pause
ClrHome
Return
End

If inString(toString([B]),"4"
Then
1+V→V
Else
Disp "Error","No engine!"
Pause
ClrHome
Return
End


"loads ship parts
Output(6,5,"  Loading parts   
For(X,10,14,1
For(Y,3,7,1
If [B](Y-2,X-9)=3
Then
150→F
200+M→M
5+U→U
Else
End
If [B](Y-2,X-9)=4
Then
300+M→M
2500+T→T
5+U→U
Else
End
If [B](Y-2,X-9)=5
Then
"No stability in this version
"1+S→S
End
If [B](Y-2,X-9)=6
Then
"No stability in this version
"1+S→S
End

End
End


"get lists to a string
Output(6,5,"List to string
:"?
:For(X,1,dim(L₁
:Ans+sub(" ▫Ŝ^/\",L₁(X),1
:End
:sub(Ans,2,length(Ans)-1→Str1
:"?
:For(X,1,dim(L₂
:Ans+sub(" ▫Ŝ^/\",L₂(X),1
:End
:sub(Ans,2,length(Ans)-1→Str2
:"?
:For(X,1,dim(L₃
:Ans+sub(" ▫Ŝ^/\",L₃(X),1
:End
:sub(Ans,2,length(Ans)-1→Str3
:"?
:For(X,1,dim(L₄
:Ans+sub(" ▫Ŝ^/\",L₄(X),1
:End
:sub(Ans,2,length(Ans)-1→Str4
:"?
:For(X,1,dim(L₅
:Ans+sub(" ▫Ŝ^/\",L₅(X),1
:End
:sub(Ans,2,length(Ans)-1→Str5

"calcs thrust (planet mass + rocket Mass)
Output(6,4,"   Thrust
If inString(toString(T),"­"
T*-1→T
T-(⌊CHELL(1)+M)→T




ClrHome
"outputs HUD
Output(1,1,Str0
Output(1,12,A
"Speed
Output(2,10,"MpS
Output(2,13,"0
"Fuel
Output(8,1,"Fuel
Output(9,1,F
Output(6,23,"___
Output(6,23,D
Output(6,26,"°
Output(7,22,"/   \
Output(8,22,"|   |
Output(9,22,"\___/
"REASSIGNED CUZ OF FOR( LOOP
5→Y
"outputs final ship-----------
Output(2,1,"[ENTER!]
Output(Y,X,Str1
Output(Y+1,X,Str2
Output(Y+2,X,Str3
Output(Y+3,X,Str4
Output(Y+4,X,Str5

Pause
Output(2,1,"LAUNCH!
Output(2,1,"       
"Just looks neat
Y-1→Y
Output(Y,X,Str1
Output(Y+1,X,Str2
Output(Y+2,X,Str3
Output(Y+3,X,Str4
Output(Y+4,X,Str5

Output(9,8,"   
Fix 2

"Actuall Launch--------------------
Lbl 0
0→K
"Flight end checker
"  If clear is pressed or if Altitude is less than 0
Repeat K=45 or A<0
getKey→K
"Fuel and thrust check

If F<0
Then
0→U
T*­1→T
0→F
"Just looks neat
Y+1→Y
"Domain error######
Output(Y,X,Str1
Output(Y+1,X,Str2
Output(Y+2,X,Str3
Output(Y+3,X,Str4
Output(Y+4,X,Str5
End

"Calculations___________________
"accelleration
T/M→B
"momentum
M*B→S
"simple calc for altitude
A+S→A
"Fuel depletion
F-U→F
Output(1,1,Str0
"displayes altitude
Output(1,12,A
"Displayes speed/ aceleration
Output(2,13,S
"Disp fuel
Output(9,1,F

End



Pause
Menu("Options","Resume",0,"Revert to VAB",98,"Quit",99

Lbl 98
"so it'll go to VAB
1→A
Return

Lbl 99
"so it'll quit
0→A
Return


Sorry about the double posting, I thought my post would look cleaner if I just made a new one.
Anyways, any suggestions would be nice, I feel like I'm at a good spot to make major changes to the code without messing everything up. Smile
Here comes PT_ the bytekiller! Razz

First of all, please use SourceCoder to write these programs, SC allow comments with "// <comment>", instead of putting strings everywhere, which can be useful, although it's slow. When you replace this comments why "// <comment>", I'm sure you could increase the speed to like 130% Smile.

Next, I see some For-loops, which have step size 1. You can omit the 1, which should save 2 bytes.


Code:
For(X,10,14,1
For(Y,3,7,1
If [B](Y-2,X-9)=1
Output(Y,X,"·
If [B](Y-2,X-9)=2
Output(Y,X,"▫
If [B](Y-2,X-9)=3
Output(Y,X,"Ŝ
If [B](Y-2,X-9)=4
Output(Y,X,"^
If [B](Y-2,X-9)=5
Output(Y,X,"/
If [B](Y-2,X-9)=6
Output(Y,X,"\
End
End

can be

Code:
For(X,1,5
  For(Y,1,5
    Output(Y,X,sub(".▫Ŝ^/\",[B](Y,X),1
  End
End

It is... faster and smaller Wink


Code:
If Ans=24 and N-1≥1
N-1→N
If Ans=25 and S-1≥1
S-1→S
If Ans=26 and 5≥N+1
N+1→N
If Ans=34 and 5≥S+1
S+1→S

can be

Code:
max(1,min(5,N+sum(DeltaList(Ans={24,26->N
max(1,min(5,S+sum(DeltaList(K={25,34->S

This code is more complicated, especially the sum(DeltaList( part. Ans={24,26} returns a list which is {1,0} if getKey=24, {0,1} if getKey=26, and {0,0} if none of the keys was pressed. DeltaList calculates the Xth argument of this list minus the (X-1)th argument of this list, so if getKey=24, DeltaList returns {0-1}, and if getKey=26, it returns {1-0}. Take the sum of this list, you get either -1, 0 or 1, which is what we need. Since both N and S are bounded by [1,5], I used a max( and min( as well.

Next, you have a bunch of lowercase letters, which is fine, but they are 2 bytes each. You can change this to uppercase letters, which are 1 byte tokens, but that's up to you.

Also, I see somewhere a

Code:
Else
End

which doesn't make sense at all. You can just remove the "Else" Razz


Code:
If [B](Y-2,X-9)=3
Then
150→F
200+M→M
Else
End
If [B](Y-2,X-9)=4
Then
300+M→M
5000+T→T
5+U→U
Else
End
If [B](Y-2,X-9)=5
End
If [B](Y-2,X-9)=6
End
End
End

can be

Code:
For(X,1,5
   For(Y,1,5
      If 3=[B](Y,X
      Then
         150->F
         M+200->M
      End
      If 3=[B](Y,X
      Then
         M+300->M
         T+5000->T
         U+5->5
      End
      If max({5,6}=[B](Y,X
      End
   End
End


Disp "<string>":Pause can be Pause "<string>"

If K=11 or K=12 can be If max(K={11,12

My last tip is that you can omit parenthesis at the end of a line, so If [B](Y,X)=3 can be If 3=[B](Y,X

I'm sure there are a bunch of more optimizations, but with these you should be able to speed it up. Good luck with it! Very Happy
One little thing, you can use the equation variables for things that recur a lot, it won't slow you down, but it will chop off some bytes. For example:

Code:
"?
For(X,1,dim(L₁
Ans+sub(" ▫Ŝ^/\",L₁(X),1
End
sub(Ans,2,length(Ans)-1→Str1
"?
For(X,1,dim(L₂
Ans+sub(" ▫Ŝ^/\",L₂(X),1
End
sub(Ans,2,length(Ans)-1→Str2
"?
For(X,1,dim(L₃
Ans+sub(" ▫Ŝ^/\",L₃(X),1
End
sub(Ans,2,length(Ans)-1→Str3
"?
For(X,1,dim(L₄
Ans+sub(" ▫Ŝ^/\",L₄(X),1
End
sub(Ans,2,length(Ans)-1→Str4
"?
For(X,1,dim(L₅
Ans+sub(" ▫Ŝ^/\",L₅(X),1
End
sub(Ans,2,length(Ans)-1→Str5

could be:

Code:
"sub(Ans,2,length(Ans)-1→u
"?
For(X,1,dim(L₁
Ans+sub(" ▫Ŝ^/\",L₁(X),1
End
u→Str1
"?
For(X,1,dim(L₂
Ans+sub(" ▫Ŝ^/\",L₂(X),1
End
u→Str2
"?
For(X,1,dim(L₃
Ans+sub(" ▫Ŝ^/\",L₃(X),1
End
u→Str3
"?
For(X,1,dim(L₄
Ans+sub(" ▫Ŝ^/\",L₄(X),1
End
u→Str4
"?
For(X,1,dim(L₅
Ans+sub(" ▫Ŝ^/\",L₅(X),1
End
u→Str5

EDIT: lets do better...

Code:
augment(L₁,augment(L₂,augment(L₃,augment(L₄,L₅→L₁
For(Y,0,4
"?
For(X,1,7
Ans+sub(" ▫Ŝ^/\",L₁(X+7Y),1
End
sub(Ans,2,length(Ans)-1
If not(Y
Ans→Str1
If Y=1
Ans→Str2
If Y=2
Ans→Str3
If Y=3
Ans→Str4
If Y=4
Ans→Str5
End
7→dim(L₁

Also, the SetUpEditor command can take multiple arguments, so this:

Code:
SetUpEditor ⌊CHELL
1→dim(⌊CHELL
1000→⌊CHELL(1)
SetUpEditor ⌊CSP11
5→dim(⌊CSP11
SetUpEditor ⌊CSP12
5→dim(⌊CSP12
SetUpEditor ⌊CSP13
5→dim(⌊CSP13
SetUpEditor ⌊CSP14
5→dim(⌊CSP14
SetUpEditor ⌊CSP15
5→dim(⌊CSP15
SetUpEditor ⌊CSP21
5→dim(⌊CSP11
SetUpEditor ⌊CSP22
5→dim(⌊CSP12
SetUpEditor ⌊CSP23
5→dim(⌊CSP13
SetUpEditor ⌊CSP24
5→dim(⌊CSP14
SetUpEditor ⌊CSP25
5→dim(⌊CSP15
SetUpEditor ⌊CSP31
5→dim(⌊CSP11
SetUpEditor ⌊CSP32
5→dim(⌊CSP12
SetUpEditor ⌊CSP33
5→dim(⌊CSP13
SetUpEditor ⌊CSP34
5→dim(⌊CSP14
SetUpEditor ⌊CSP35
5→dim(⌊CSP15
could be
Code:
{1000→⌊CHELL
SetUpEditor CSP11,CSP12,CSP13,CSP14,CSP15,CSP21,CSP22,CSP23,CSP24,CSP25,CSP31,CSP32,CSP33,CSP34,CSP35
5→dim(⌊CSP11
5→dim(⌊CSP12
5→dim(⌊CSP13
5→dim(⌊CSP14
5→dim(⌊CSP15
5→dim(⌊CSP11
5→dim(⌊CSP12
5→dim(⌊CSP13
5→dim(⌊CSP14
5→dim(⌊CSP15
5→dim(⌊CSP11
5→dim(⌊CSP12
5→dim(⌊CSP13
5→dim(⌊CSP14
5→dim(⌊CSP15

However, I don't know why you are using SOOOO many different lists
Same goes for the default lists, except that by default, SetUpEditor already does those, so

Code:
:SetUpEditor L₁
:7→dim(L₁)
:SetUpEditor L₂
:7→dim(L₂)
:SetUpEditor L₃
:7→dim(L₃)
:SetUpEditor L₄
:7→dim(L₄)
:SetUpEditor L₅
:7→dim(L₅)
could be
Code:
SetUpEditor
7→dim(L₁
7→dim(L₂
7→dim(L₃
7→dim(L₄
7→dim(L₅
Thanks guys! I'll start working on that! Very Happy

PT_: I will take your advice and try to use SourceCoder. However I'm having some trouble getting a ROM image off my CE so I can use jusTIfied.

mr womp womp: the reason I have so many lists is for my save/ load function. because I'm limited on matrices (they could get overwritten by another program) I decided to use something that wouldn't interfere with another program. If there is a better way to do this I'm open to ideas, but for now I don't know a better way. Sad

EDIT: wait, jusTIfied can emulate a CE right?

EDIT 2: Dang, I just got put on POTM! (Thanks guys!) So I'm really going to have to kick myself in gear to figure out this rocket science. Should be fun! Very Happy
Nope, jsTIfied can't emulate the CE yet, we are working on that although progress go slowly Razz
You can download the programs though with SC and  transfer it to CEMUor a real calc
Also, in the declarations, something like

Code:
0->X
0->Y


Can be

Code:
DelVar XDelVar Y
Tari wrote:
If I were to simplify a lot, you only need two equations:

F = ma, or perhaps rearranged to a = F/m. Given a known thrust (easily simplified to be constant or at least a simple fraction of maximum thrust) your acceleration is the thrust divided by craft mass.

Assuming some kind of known time step (easily implemented as a fixed frame step), mass of the craft changes at a rate roughly proportional to thrust (as a proxy for fuel flow).

Meanwhile, gravitational acceleration g = Gm/r2, where G is an arbitrary constant, m is the mass of the parent body (simplifying such that your craft has no gravity of its own since it's a very small mass) and r is the distance from the center of the parent body.

Then it's just a matter of doing vector addition, where a little trigonometry comes in handy (since it's easy to treat all bodies as spherical and you want some arbitrary common coordinate system). Acceleration due to thrust is a vector of magnitude a opposite the direction of thrust, and acceleration due to gravity is a vector of magnitude g towards the center of the parent body.

^This
Every tick, add the vector of each force, then divide the resulting vector by mass of the craft, and that is your acceleration vector. Add acceleration to velocity and then velocity to position.
Thrust should already be given from the engine's specifications and the throttle.

Interestingly, I've run into a very similar problem earlier - actually for Kerbal Space Program, I was writing a trajectory calculation tool for extremely low TWR spacecraft, which couldn't be approximated with point burns. What I ended up doing was to set a time step ("frame"), calculate the total applied acceleration in this frame, approximate the long burn as a set of tiny ones, one every frame, after every burn I calculated the new orbit and advanced by one frame by advancing the vessel's true anomaly by the given amount.
All in all, it was a big mess and I never succeeded, but I believe this is the way to go. I.e. use Keplerian coordinates, not Cartesian, when dealing with orbits. Really, the other way round it's even more pain.

EDIT:
Up until now, everyone seems to assume that the thrust vector goes through the center of mass, which is not at all necessary. This makes things more complicated, requiring to take rotation into account.
  
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 2 of 5
» 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