Skip to content

Added Monte Carlo Implementation in TI-83 BASIC #553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

theinventor13
Copy link
Contributor

Example code is also a visualization demo

Example code is also a visualization demo
@Liikt Liikt added the Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) label Dec 5, 2018
@Butt4cak3 Butt4cak3 self-assigned this Dec 5, 2018
@nic-hartley
Copy link
Contributor

nic-hartley commented Jan 3, 2019

Coding with ethanol

Ahh, that explains why you wrote Monte Carlo in TI-BASIC, of all languages.

@theinventor13
Copy link
Contributor Author

lol thats my moniker
i usually put it all as one word, e.g. codingwithethanol
but yes i also coded it because i was bored and somebody already did bubblesort in ti-basic

Copy link
Contributor

@Butt4cak3 Butt4cak3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is kind of awkward. It's been a couple of months, but I finally ran your program. I tried to type it into my calculator and didn't find the GDB functions, said I'd do it the next day and.. well... forgot about it.

I tried to run this on a TI-82 and I had to tweak it a bit to make it work. I know you wrote this for the TI-83, but we might as well try to make the programs work on more devices.

::rand->Y
::Pt-On(X,Y)
::If ((X*X+Y*Y)<1)
::Then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you did here and I have to admit that it makes it slightly more readable on a PC screen, but I ran into the issue that ::Then breaks on my TI-82. Also, the colons make the line above long enough to be broken up into two, which decreases readability more than it's worth in my opinion. What do you think about getting rid of the colons?

Prompt M
0->C
0->I
StoreGDB 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The StoreGDB function changed between the TI-82 and TI-83. On an 82 this has to be StoreGDB GDB1 instead. Do these GDB vars still exist on the 83? If not, then we'll keep it like this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with how the GDB system works but I can confirm that those variables do still exist on my TI-84 Plus.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After checking an unofficial changelog, there is nothing to suggest that these variables wouldn't be on a TI-83 either.

@Butt4cak3 Butt4cak3 removed their assignment Nov 27, 2019
@Butt4cak3
Copy link
Contributor

To anyone who wants to pick this PR up:
I remember testing the code and it worked just fine. The changes I requested were merely for compatibility with the TI-82. If you want to leave the code sample as strictly TI-83 code, it's ready to merge.

@leios
Copy link
Member

leios commented May 20, 2020

This PR is almost ready to go. If anyone knows anything about TI83 and can change the few lines necessary (even in a separate PR), we can probably merge this.

The implementation also needs to be added to the text

@leios
Copy link
Member

leios commented May 20, 2020

Is this the code we want in the end?

"MONTE PROGRAMMED BY CODING WITH ETHANOL AND TOMMYTORTY10
ClrHome
Prompt M
0->C
0->I
StoreGDB 1

ClrDraw
AxesOff
CoordOff
GridOff
LabelOff
0->Xmin:1->Xmax
0->Ymin:1->Ymax
Circle(0,0,1)

For(I,0,M,1)
rand->X
rand->Y
Pt-On(X,Y)

If ((X*X+Y*Y)<1):Then
C+1->C
End

End

ClrHome
(C/M)*4->E
Text(28,43,E)
Pause 
RecallGDB 1
ClrHome

AxesOn
CoordOn
GridOn
LabelOn

@Amaras
Copy link
Member

Amaras commented Dec 8, 2021

@theinventor13 if you are ready to add your code to the relevant .md file, I am ready to merge this PR, since Butt4cak3 judged it was nice enough. 🙂
Otherwise, I think we can do it ourselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants