Hi all,

I'm developing a TI-Nspire CX II CAS program with AI assistance to calculate sight wind heading based on user input. As a flight sim enthusiast focused on combat scenarios, accurate wind data is crucial for bombing runs. The game provides partial info, but not the final wind direction. I currently solve it manually or via a website. However, switching out of the game or using pen and paper is disruptive and inconvenient, so I'm building a tool to streamline the process in-game.

With all that background being said, here is what the program aims to do. It takes user input for plane heading, plane airspeed, wind heading, and wind airspeed. It then converts the vectors to Cartesian components. It calculates the relative wind vector and computes the sight wind heading. This answer is then displayed. The problem I'm getting is this error message. "Error: A conditional statement did not resolve to TRUE or FALSE". This error message happens around this area...


Code:
Rx := Wx - Ax
Ry := Wy - Ay
R := √(Rx^2 + Ry^2)
RH := atan2(Rx,Ry)*180/π
If RH < 0 Then
RH := RH + 360
EndIf


I've attempted many different ways to fix the problem using AI to no avail. I'm stuck. The code that I have is below. Any help would be very appreciated. Thank you!


Code:
Define SightWind()
Prgm
ClrHome
Disp "=== SIGHT WIND ==="
Request "Plane Heading (deg): ",PH
Request "Plane True Airspeed (kt): ",PA
Request "Wind Heading (deg): ",WH
Request "Wind Speed (kt): ",WS
Local Ax,Ay,Wx,Wy,Rx,Ry,R,RH
Ax := PA*sin(PH*π/180)
Ay := PA*cos(PH*π/180)
Wx := WS*sin(WH*π/180)
Wy := WS*cos(WH*π/180)

Rx := Wx - Ax
Ry := Wy - Ay

R := √(Rx^2 + Ry^2)

If Ry ≠ 0 Then
RH := atan(Rx/Ry)*180/π
If Ry < 0 Then
RH := RH + 180
EndIf
Else
If Rx > 0 Then
RH := 90
Else
RH := 270
EndIf
EndIf
 
If RH < 0 Then
RH := RH + 360
EndIf
 
ClrHome
Disp "Sight Wind Heading:"
Disp round(RH,1)
Disp "Sight Wind Speed:"
Disp round(R,1)
Pause
EndPrgm
sorry but i dont code ti nspire language.
i found this you could try though
http://tibasicdev.wikidot.com/nspire
LLMs are even worse at TI-BASIC programming than they are at assisting with computer languages, due to fewer examples to pattern-match against and a tendency to invent items from computer languages that TI-BASIC doesn't have.

The problem is that if the following block of code doesn't run, variable RH is never defined.


Code:
If Ry ≠ 0 Then
RH := atan(Rx/Ry)*180/π
If Ry < 0 Then
RH := RH + 180
EndIf
Else
If Rx > 0 Then
RH := 90
Else
RH := 270
EndIf
EndIf
If it's expected that this code might not run, then you need to set a default value for RH, such as zero, before this code block. However, I suspect the problem is that AI has lied to you about how If/Then/Else/Endif works in TI-Nspire BASIC.
CALCUMAN1 wrote:
sorry but i dont code ti nspire language.
i found this you could try though
http://tibasicdev.wikidot.com/nspire


Thanks for the link and the suggestion.
KermMartian wrote:
LLMs are even worse at TI-BASIC programming than they are at assisting with computer languages, due to fewer examples to pattern-match against and a tendency to invent items from computer languages that TI-BASIC doesn't have.

The problem is that if the following block of code doesn't run, variable RH is never defined.


Code:
If Ry ≠ 0 Then
RH := atan(Rx/Ry)*180/π
If Ry < 0 Then
RH := RH + 180
EndIf
Else
If Rx > 0 Then
RH := 90
Else
RH := 270
EndIf
EndIf
If it's expected that this code might not run, then you need to set a default value for RH, such as zero, before this code block. However, I suspect the problem is that AI has lied to you about how If/Then/Else/Endif works in TI-Nspire BASIC.


Thanks for the advice, I'll try and see if making it 0 helps this at all.
  
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 1
» 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