Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
I thought I saw something like this somewhere but I can't find it. If this thread should be moved, please do so.

Anyway, heres the idea: Someone starts off with a challenge. Whoever makes the first working program or smallest program or whatever (depends on the challenge) gets to come up with the next challenge. Make sure to post your source code (and is's size, if relevant)

To start off:
Code:
Who can make the smallest program that finds the vertex and roots of any quadratic equation?

If there is a tie for size first one wins.

Code:
.5A⁻(⁻B+{0,1,⁻1}√(B-4AC
23 bytes
22 bytes:

Code:
.5A⁻(⁻B+ΔList(timeCnv(60)√(B-4AC

Basically the same as Jacobly's answer. timeCnv( converts seconds to {days,hours,minutes,seconds}. 60 seconds is 1 minute 0 seconds, so {0,0,1,0}, and the ΔList( of that is the {0,1,⁻1} of Jacobly's post. This would be the same length with a close-paren after the ΔList(, but I only need one close-paren since the sqrt(B-4AC distributes.

I suppose if we want the y-coordinate of the vertex, with everything displayed in the ugliest format possible, it could be something like

Code:
Pause .5A⁻(⁻B+ΔList(timeCnv(60)√(B-4AC
mean(Ans
AAns+BAns+C


If I can choose the next challenge, I'll steal the idea from https://www.omnimaga.org/community-contests/codegolf-the-reboot-7/. Rules are different though:

Morse Code Translator

* Create a TI-BASIC program (for any 83+/84+ series calculator) that converts a sequence of ".", "-", and " " from Morse Code into a sequence of capital letters and spaces.
* Each encoded letter or space will be followed by a space; supporting a trailing space is optional.
* Consider the Morse code for " " to be " ". This means that, when the plaintext contains a space between two letters, the Morse Code contains three consecutive spaces.
* Take input through either Ans or Input. Display the output.
* Your program must work for all valid input, not just the test cases.
* Shortest code when everyone gives up wins.
* You may assume that the calculator has been freshly reset: Radian mode, all real vars are 0; etc.

Test cases (with trailing space):

Code:
"- . ... -   -.-. .- ... . "
"TEST CASE"

"--.. -.-- -..- .-- ...- ..- - ... .-. --.- .--. --- -. -- .-.. -.- .--- .. .... --. ..-. . -.. -.-. -... .- "
"ZYXWVUTSRQPONMLKJIHGFEDCBA"

"        "
"    "


Bonus challenge: Instead of dots and dashes, use binary digits from the official timing: "10111000101010111000101110101110" for "ABC".
lirtosiast wrote:
22 bytes:

Code:
Pause .5A⁻(⁻B+ΔList(timeCnv(60)√(B-4AC
mean(Ans
AAns+BAns+C

(╯□)╯︵ ┻━┻
So done.
Those are some impressive programs!
On a side note, I think that we should implement a policy of if the thread dies for a week or so then anybody can reboot it with their own challenge. That way things wont get too bogged down. Good luck on that morse code reader everyone!
182 bytes. Largely unoptimized, but I think I have a clever scheme.


Code:
Input Str1
"?→Str2
"ETIANMSURWDKGOHVFθLθPJBXCYZQ→Str0
1→A
Repeat A>length(Str1
0
While sub(Str1,A+Ans,1)≠"
Ans+1→C
End
If Ans
Then
sub(Str0,2^Ans-1+sum(seq((2^B)("-"=sub(Str1,A+Ans-1-B,1)),B,0,Ans-1)),1
Else
1→C
"
End
Str2+Ans→Str2
A+1+C→A
End
Disp sub(Str2,2,length(Str2)-1
I had the same idea apparently. 118 bytes.

Code:
Ans→Str1
For(A,1,length(Ans
(Ans≠Str1)2I+(Ans≠".→I
sub(Str1,A,1
If Ans="
Then
A+not(I-1→A
Str1+sub(" ETIANMSURWDKGOHVFθLθPJBXCYZQ",I,1→Str1
End
End
sub(Ans,A,1-A+length(Ans
Basically, code golf. Are parts of ASM allowed?
Yep, code golf-- unless the next challenge is difficult enough that people have a hard time just solving it in BASIC.

Machine code would be interesting, but it shouldn't compete with TI-BASIC. The size of (b)calls quickly adds up, so for most programs it's larger anyway.

Code:
:Input Str1
:For(A,1,length(Str1
:max(1,inString(Str1," ",A)-A→B
:Str1+sub("R...D...SH...IU...TMO...GZBV...EAWJ...NKYPQCLXF...(space)",
inString("/.-./-../....//..-///---/--...-///.---//-.--.-..-.///(space)",sub("///"+sub(Str1,A,Ans),Ans,4)),1→Str1
:A+B→A
:End
:sub(Str1,A,length(Str1)-Ans

211 bytes across 7 lines. Not sure if the string is minimal.
Cool! Are there any other people who want to attempt? If not, Jacobly can post the next challenge.
I give up, that's for sure. Congratulations, jacobly.
The next challenge is to draw the dragon fractal. Input is iteration index in I (0 is a single straight line), scale factor in S, start position in X and Y, and initial direction in D. All of the inputs except I can use arbitrary units (for D this means that any 4 values can correspond to the 4 different directions), but the first turn should always be to the right. You may assume that all other variables are in the state they would be after a reset. Shortest code wins.

Iteration 9:

Iteration 10:


Iteration 12 (This isn't a requirement as it costs a lot of bytes to do it nicely):
Arbitrary units? So I can reliably ask the user to type the 3*kth digit of the base-17 representation of lg(√12), whereupon I may convert that back to k = 0,1,2,3 for the initial direction? Such a request could be ideal for the conditions of my program! This is a no man's land in terms of sizing code.

As well, I think we should hold the first turning direction to be as idiosyncratic as the fractal's rotation, respecting that each of the different viable methods for building the fractal may be either left- or right-"leaning" in its optimal state, forcing some otherwise happy routines to be burdened with peripheral information to seed the outset differently, while the rest just happened to turn out lucky.

Furthermore, this S/X/Y matter vexes me to no end. Razz The program which I assume this challenge was based on might indeed have scaling/positioning in its features, but drawing a dragon curve doesn't require them, and the challenge should be majorly about drawing a dragon curve. Besides, we've already got Window variables acting to arrange visuals to our liking! Of course, I say this because my program just got far less beautiful with all these extra variables running around...

Edit: Concerns ventilated, I went ahead and included D/S/X/Y (D is 0, 1, 2, or 3) as per the last set of rules, but you can take initial left turns from my cold, dead hands, Zoolander. Very Happy


Code:
:.5Si^D→D
:X+Yi
:For(I,0,2^I-1
:Ans→Z
:I
:While Ansnot(fPart(Ans
:.5Ans
:End
:Di(2-4fPart(.5Ans→D
:Ans+Z
:Line(real(Z),imag(Z),real(Ans),imag(Ans
:End

(90 bytes)
Arbitrary units was ambiguous for D so I clarified that you can use any 4 values. For the other variables, I just mean they can be arbitrarily but consistently scaled by any factor. I can't come up with any method, including Weregoose's (which is the method I had in mind), that costs bytes to have the initial turn be to the right, so that rule still stands. Also, for the record, I can do it in 66 bytes of code, but it won't count since it's my challenge.
Oops... Swap real()'s and imag()'s roles. That and D=3,2 matches your two reference pics. Go me. Rolling Eyes

[EDIT]

Useless in the challenge context but well within the "realm" of things, if you were to change the third line in here to

Code:
:3+.5Ans(i+cos(πint(2rand

then you'd have yourself a proper 180'd dragon fractal. The summand 3 here was elected for the sake of scaling up both the drawing and viewport size in order to knock out a 1/3 term permeating the latter; as a result, it now has all nice integers, namely (Xmin,Ymin) = (-1,-1) and (Xmax,Ymax) = (5,4).
66 bytes... I don't know how I'd cut Weregoose's routine down by so much. Perhaps, since we can assume initial values for variables, program recursion would be useful.
It appears (correct me if I am mistaken) that Weregoose has won this one and can go ahead and post the next one.
EDIT: Those are some cool fractals!
Kydapoot wrote:
It appears (correct me if I am mistaken) that Weregoose has won this one and can go ahead and post the next one.

Well, if Jacobly can provide the smaller code, then he would technically be the winner, however there probably should be an unwritten rule that states that the person who created the challenge can't win.
How about this one. Write a program that, when given two numbers in an addition problem, counts the number of carry's needed to add them.
  
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 2
» All times are GMT - 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