Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - JWinslow23

Pages: 1 ... 17 18 [19] 20 21 ... 40
271
Community Contests / Re: Code Golf Contest #1
« on: July 15, 2014, 05:22:14 pm »
Thanks for the information. I'll switch.

EDIT: All code now counts newlines as one byte. Scores updated accordingly.

272
Community Contests / Re: Code Golf Contest #1
« on: July 15, 2014, 05:13:15 pm »
It's easier for me to count it as two, as that's how my OS counts it. If anyone knows a way for a Windows 7 user to use the other option, be my guest.

273
Community Contests / Re: Code Golf Contest #1
« on: July 15, 2014, 05:02:37 pm »
I am counting Windows (CRLF=2 bytes). willrandship, your score is 116 bytes. It does work, and I am now adding yours as we speak.

EDIT: Miscount. Redone!

274
Community Contests / Re: Code Golf Contest #1
« on: July 15, 2014, 03:34:22 pm »
First entry!

Thanks to Juju with his 159 byte solution in Python! (counting newline as CRLF, as my OS does)

275
Community Contests / Re: Code Golf Contest #1
« on: July 15, 2014, 02:15:15 pm »
Juju, you then shall be the winner in Python...if nobody else does it smaller. :P But you will still get credit.
And yes, you can send me multiple PMs.

Hayleia, PM it to me so I can test it, and if it works for my test cases, you will be one of the first people to participate.

276
Community Contests / Re: Code Golf Contest #1
« on: July 15, 2014, 11:01:42 am »
No, do not check for positive-integer-ness unless you really want to. It at least has to give the right result for the test cases.
Yes, Xeda, whatever you want. Just make it work at least with the test cases.
Yes, PM me any solutions.
Yes, z80 is judged by its final size. So would Axe.
Yes, printing HAPPY/UNHAPPY would also be acceptable.

EDIT: Oh, and I will reveal all solutions in spoilers in the OP.
My own solution in TI-BASIC is 71 bytes (minus the name). Let's see who can do better...

278
This is the first of what I hope to be many contests I will hold here on Omnimaga: Code Golf.

Code golf is a competition where you have to solve a coding challenge in the fewest bytes possible. For example, a TI-BASIC entry for a prime tester could be:
Code: [Select]
Input N:0:If N and not(fPart(N:2=sum(seq(not(fPart(abs(N)/I)),I,1,abs(N:Ans(note that this is not the speediest it could be, but speed is not factored in your score, only size)
The score would be 34 bytes (for TI-BASIC programs, score=size - 9 - length of name). The lowest score out of the entries will be the winner.

How this tournament will work:
First off, you need to code an actual program that will solve the given problem (or at least give the right result for all the test cases :P ). All languages are allowed, including calc languages and computer languages. When you have an entry, PM it to me, and I will test it if possible (but just in case I don't have an Nspire or I can't download the latest version of Perl or some such problem, try if you can to give back the results of any and all given test cases). I will then save your entry and update the scores accordingly.
After one week, a winner shall be determined in each language category, as well as the smallest overall. In each language category, the winners shall all suggest possible problems for the next competition. I shall pick the next challenge out of these, and present test cases for any possible input or output. Also, you will get to see everyone else's solutions for the previous challenge.

Please, ask any and all questions that you may have about the contest!

NEXT: Here
PREVIOUS: Here

Challenge 1

Problem
Determine if an inputted number is happy. Happy numbers are defined like this: Take any positive integer, replace it with the sum of the squares of its digits, and repeat the process until it equals 1 or it loops indefinitely in a loop that does not include 1. If it ends up with 1, the number is happy, otherwise it's sad.
Deadline
July 21, 2014, 1:00 AM EST
Sample input 1:
1
Sample output 1:
Code: [Select]
HAPPYSample input 2:
1337
Sample output 2:
Code: [Select]
HAPPYSample input 3:
385
Sample output 3:
Either one of
Code: [Select]
SADor
Code: [Select]
UNHAPPY
Ranking

Python
RankUserSizeDateCode
1willrandship947/19/2014 11:16:56 PM
Spoiler For Spoiler:
x=input();b="UNHAPPY"
for a in b:
 z=0
 for y in str(x):z+=eval(y)**2;x=z
print(b[(z==1)*2:7])
2Juju1487/15/2014 4:22:50 PM
Spoiler For Spoiler:
def h(n):
 while n>1 and n!=4:
  n=sum(dict([(c,int(c)**2)for c in"0123456789"])[d] for d in str(n))
 return n==1
print(("SAD","HAPPY")[h(input())])

Golfscript
RankUserSizeDateCode
1Runer112327/15/2014 5:17:50 PM
Spoiler For Spoiler:
~{`0\{48-.*+}/}9*("SAD""HAPPY"if

CJam
RankUserSizeDateCode
1Runer112307/15/2014 5:17:50 PM
Spoiler For Spoiler:
q~{Ab0\{_*+}/}9*("SAD""HAPPY"?

TI-83+ BASIC
RankUserSizeDateCode
1calc84maniac467/16/2014 5:03:49 PM
Spoiler For Spoiler:
Repeat Ans<5
sum(.5×√int(10fPart(Ans/10^(cumSum(binomcdf(98,0→A
End
"HAPPY
If log(A
"SAD
Ans
2Runer112467/16/2014 5:09:28 PM
Spoiler For Spoiler:
Repeat A≤4
iPart(10fPart(Ans10^(~cumSum(binomcdf(14,0
sum(Ans²→A
End
"HAPPY
If log(A
"SAD
Ans
3Hayleia717/16/2014 2:18:36 AM
Spoiler For Spoiler:
Prompt N
Repeat N=1 or N=4
sum(seq((10fPart(iPart(N10^(~I))/10))²,I,0,14→N
End
"HAPPY
If N=4
"SAD
Disp Ans

TI-83+ z80
RankUserSizeDateCode
1Runer112587/20/2014 9:32:08 PM
Spoiler For Spoiler:
;#SECTION "MAIN", CODE

   org   userMem - 2
   db   0BBh, 6Dh
Start:
   B_CALL   _RclAns
StepLoop:
   push   bc
   sbc   hl, hl
   ld   b, h
DigitPairLoop:
   dec   e
DigitLoop:
   ex   de, hl
   xor   a
   rrd
   ex   de, hl
   ld   c, a
SquareLoop:
   add   hl, bc
   dec   a
   jq   nz, SquareLoop
   ld   a, (de)
   or   a
   jq   nz, DigitLoop
   ld   a, e
   cp   (OP1 + 2) & 0FFh
   jq   nz, DigitPairLoop
   push   hl
   B_CALL   _SetXXXXOP2
   rst   30h
   pop   hl
   pop   bc
   djnz   StepLoop
   dec   l
   ld   hl, UnhappyStr
   jq   nz, Unhappy
   inc   hl
   inc   hl
Unhappy:
   B_CALL   _PutS
   ret

;#SECTION "StrData", DATA

UnhappyStr:
   db   "UNHAPPY", 0
2calc84maniac607/16/2014 12:12:44 PM
Spoiler For Spoiler:
#define bcall(xxxx) rst 28h \\ .dw xxxx
#define _RclAns $4AD7
#define _PutS $450A
#define OP1 $8478
   
    .org $9D93
    .db $BB,$6D
    bcall(_RclAns)
    ex de,hl
HappyCalcLoop:
    xor a
    ld c,a
    ld d,a
    ld e,a
HappyByteLoop:
    ;Carry is reset, upper nibble of A is 0
    dec l
HappyNibbleLoop:
    rrd
    ld b,a
HappyMulLoop:
    push af
     add a,e
     daa
     ld e,a
     ld a,c
     adc a,d
     daa
     ld d,a
    pop af
    djnz HappyMulLoop
    ccf
    jr c,HappyNibbleLoop
    ld a,l
    sub (OP1+2)&$FF
    jr nz,HappyByteLoop
    ld (hl),d
    inc l
    ld (hl),e
    inc l
    inc (hl)
    jr nz,HappyCalcLoop
    ld hl,HappyString
    dec e
    jr z,$+4
    dec hl
    dec hl
    bcall(_PutS)
    ret
   
UnhappyString:
    .db "UN"
HappyString:
    .db "HAPPY",0

Batch
RankUserSizeDateCode
1JWinslow231827/19/2014 7:26:37 PM
Spoiler For Spoiler:
@set/p#=
:@
@set $=0&@for /f "delims=" %%a in ('cmd /U /C echo %#%^|find /V ""')do @set/a$+=%%a*%%a
@set #=%$%&@if %$% neq 1 if %$% neq 4 goto @
@if %$%==1 (echo happy) else echo sad

Language Ranking
RankLangUserSizeDate
1CJamRuner112307/15/2014 5:17:50 PM
2GolfscriptRuner112327/15/2014 5:17:50 PM
3TI-83+ BASICcalc84maniac467/16/2014 5:03:49 PM
4TI-83+ z80Runer112587/20/2014 9:32:08 PM
5Pythonwillrandship947/19/2014 11:16:56 PM
6BatchJWinslow231827/19/2014 7:26:37 PM

279
I will try to be on regularly, but there will be no prizes. There are never prizes for code-golf competitions. :P

EDIT: Ummm...I can't post in the contest thread. Help? :/

280
And here I was hoping it'd be a bit more complicated than that. XD

281
I would like to propose a monthly contest on Omnimaga: Code Golf.

Code golf is basically solving a certain coding problem in the fewest amount of bytes possible. For example, a golfed primality tester in TI-BASIC would be:
Code: [Select]
Input N:0:If N and not(fPart(N:2=sum(seq(not(fPart(abs(N)/I)),I,1,abs(N:AnsThe score then would be 43 bytes (technically, 43+length of name, but for calc-language purposes, the name is not included in the score). Lowest score wins.
(note this isn't as speedy as it could be, but speed would not count against you)
If possible, have it work for as many possible test cases as you can while still making it short.

Anybody could submit challenges (so long as you give test cases as well). Hopefully we can allow all calc languages, as well as computer languages (so long as you can test them, and you can show us the results of the test cases).

Who would I talk to in order to get something like this started here?

282
TI Z80 / Re: TI-2048 by Josiah W.
« on: July 10, 2014, 01:56:39 pm »
I should put this on my calc when I have time. I would like to try all 2048 Axe clones, though. I wonder how good the grayscale in yours look like on a real calc.

Also, how are the small fonts done? Are they custom fonts or is this just an image?
Well, the grayscale looks fine on an actual calc.

And the small fonts you are talking about? Those are all Bitmaps, drawn with the Bitmap() command. Every "block" of text that is not an original TI font is drawn with a Bitmap of some sort. (It's the only way I could get everything I wanted to fit to fit!)

283
TI Z80 / Re: TI-2048 by Josiah W.
« on: July 09, 2014, 03:22:53 pm »

284
After many long days of work, I am finally done. O.O

This is a collection of phrases that describe the number of letters that the phrase has. For example, "a two written next to a one" describes 21, and has 21 letters.
Here are some examples from 1 to 100:
Code: [Select]
A
Bi
Tri
Four
Fifth
Sextet
Seventh
TwoCubed
Composite
Triangular
LucasNumber
ZodiacNumber
UnluckyNumber
EInHexadecimal
PentatopeNumber
FourthPowerOfTwo
TenPlusSixPlusOne
FiftyEightModForty
PrimeAfterSeventeen
PositionOfTheLetterT
ATwoWrittenNextToAOne
SecondMultipleOfEleven
SmallestPrimeOverTwenty
SeventeenPlusTwoPlusFive
AreaOfSquareWithWidthFive
HalfOfAStandardDeckOfCards
SquareRootOfSevenTwentyNine
TheOnlyTwoDigitPerfectNumber
DaysInFebruaryIfItIsALeapYear
SmallerCoprimeNumbersArePrimes
BaskinRobbinsHasThisManyFlavors
PowerOfTwoInWhichDigitsArePrimes
ElvisPresleyIsCastInThisManyFilms
NinthIntegerInTheFibonacciSequence
TheSumOfTheCubesOfTheFirstTwoPrimes
NumberOfPianoKeysThatAreASharpOrFlat
TheNumberOfFederalReserveBanksInTheUS
ItsFormInBinaryIsOneZeroZeroOneOneZero
WriteTheFirstOddPrimeNextToItsOwnSquare
AtomicNumberOfTheElementKnownAsZirconium
ForMexicansThisNumberIsConsideredAGaySlur
ItsTheAnswerToLifeTheUniverseAndEverything
SmallestPrimeThatIsntTheSumOfTwoPalindromes
RetiredMLBNumberForHankAaronAndReggieJackson
TheTelephoneDialingCodeForTheCountryOfDenmark
ItIsTheValueInDecimalForTheASCIICodeForAPeriod
ThisNumberAppearsInAlmostAllTheStarTrekEpisodes
InternationalDirectDialCodeForPhoneCallsToPoland
NumberOfStringsOnTheHarpAndNumberOfKeysOnACelesta
TheNumberOfStatesThatAreInTheUnitedStatesOfAmerica
TheTopSecretAircraftTestingFacilityInSouthernNevada
TheNumberOfWeeksThatAreInAYearInTheGregorianCalendar
ItsTheThirdNumberNWhichDividesTheSumOfTheFirstNPrimes
NumberOfColoredStickersOnEachOfTheSquaresOnARubiksCube
LargestNumberInTheFibonacciSeriesThatsATriangularNumber
AsHardToBelieveAsItSoundsItsATownNameInTheStateOfMontana
TheModelNameOfACarMadeByTheGermanAutomobileCompanyMaybach
ItIsTheSmallestSmithNumberForWhichTheSumOfItsDigitsIsPrime
TheNASCARDriverMarcosAmbroseRacesWithThisNumberOnHisRacecar
TheNumberOfSecondsInAMinuteAndAlsoTheNumberOfMinutesInAnHour
TheSmallestPrimeForWhichItsReversalIsAlsoAPerfectSquareNumber
TheOnlyNumberWhoseCubeIsMadeOfThreeDigitsThatEachOccurTwoTimes
TheAlphanumericalValueOfThisNumbersRomanNumeralIsThisSameNumber
ThisIsTheNumberOfSquaresThatAreOnTheChessBoardOrTheCheckersBoard
TheSmallestNumberThatBecomesSquareIfItsReverseIsAddedOrSubtracted
WellItGoesThroughStLouisJoplinMissouriAndOklahomaCityLooksSoPretty
TheSmallestPrimeWhichBecomesPandigitalWhenItIsRaisedToTheTenthPower
AsADecimalNumberThisNumberIsTheLastTwoDigitNumberToAppearInPisDigits
YouHaveADirtyMindIfYouThinkOfThisNumberHowIThinkYouAreThinkingOfItNow
ItsTheLargestNumberNSuchThatTheSumOfTheDigitsOfTwoToThePowerOfNEqualsN
TheNumberOfDifferentCharactersThatCanBeUsedWithAStandardEnglishKeyboard
TheSmallestNumberThatRaisedToTheFifthPowerIsTheSumOfFiveOtherFifthPowers
ItsTheTwentyFirstPrimeItsReverseIsTheTwelfthAndItsAlsoAPalindromeInBinary
OnePlusTwoPlusThreePlusSixPlusNinePlusTenPlusTwentyPlusFortyMinusSeventeen
TheSmallestNumberThatIsPandigitalInQuaternaryAsInItIsOneThousandTwentyThree
OnePlusOnePlusTwoPlusTwoPlusThreePlusThreePlusThreePlusTenPlusSixtyMinusNine
ThisisTheSmallestPositiveIntegerThatRequiresFiveSyllablesInTheEnglishLanguage
IfYouAddUpTheGiftsInTheSongTheTwelveDaysOfChristmasTheyWouldAddUpToThisInteger
TheSmallestNumberThatCannotBeRepresentedAsTheSumOfFewerThanNineteenPowersOfFour
TheAtomicNumberOfTheElementKnownAsMercuryAnElementWhichWasOnceUsedInThermometers
ThisNumberIsTheOnlyPositiveRealNumberBesidesOneThatIsTheSquareOfTheSumOfItsDigits
TheInternationalStandardBookNumberGroupIdentifierForBooksThatWerePublishedInNorway
TheSmallestPrimeNumberWhichIsTheSumOfAPrimeNumberOfPrimeNumbersInAPrimeNumberOfWays
TheSmallestNumberThatIsAlsoTheSumOfThreeDistinctPrimesRaisedToDistinctPrimeExponents
TheSmallestNumberWhichCanAlsoBeExpressedAsTheSumOfTwoDistinctSquaresInTwoDistinctWays
TheLargestNumberNSuchThatTwoToThePowerOfNDoesNotContainAZeroDigitInItsDecimalExpansion
TheNumberOfYearsBetweenTheSigningOfTheDeclarationOfIndependenceAndTheBattleOfGettysburg
TheNumberOfConstellationsUpInTheSkyAsCurrentlyDefinedByTheInternationalAstronomicalUnion
TheSmallestPrimeWhichIsAConcatenationOfPToThePowerOfQAndQToThePowerOfPWherePAndQArePrimes
IfAnAngleInEuclideanGeometryHasAMeasurementOfThisManyDegreesThatMeansTheAngleIsARightAngle
InUSCentsThisIsTheSumOfTheValuesOfOneEachOfAllTheCoinsOfDenominationsThatAreLessThanADollar
TheNumberOfWaysThatEightQueensCanBePlacedOnAnEightByEightChessboardSoNoTwoCanAttackEachOther
OnePlusOnePlusTwoPlusTwoPlusThreePlusThreePlusThreePlusFourPlusFourPlusTenPlusTwentyPlusForty
ThisIsTheSmallestEvenNumberWithMoreThanOneDigitWhichHasNoRepresentationAsTheSumOfTwoTwinPrimes
TheRacingNumberThatWasOnRacecarLightningMcQueenTheMainCharacterInTheDisneyPixarAnimatedFilmCars
AlthoughThisMightBeHardToBelieveThisNumberIsActuallyTheNameOfASmallCityInTheStateOfSouthCarolina
TheLargestPrimeNumberUnderOneHundredAndAlsoTheLargestTwoDigitNumberWhereTheSumOfItsDigitsIsSquare
TheHighestJerseyNumberOneMayWearInTheNationalHockeyLeagueAsNinetyNineWasRetiredToHonorWayneGretzky
InTheUKAndIrelandThisIsTheNameOfAnIceCreamConeWithACadburyChocolateFlakePressedHalfwayInTheIceCream
OnTheCelsiusScaleThisNumberOfDegreesWhichIsTwoHundredTwelveDegreesFahrenheitIsTheBoilingPointOfWater
I spent a LONG time on these. *.*

Are there any improvements you can think of? Do you not get a reference that a certain phrase makes? Please, give me feedback. :)

285
TI Z80 / Re: Yet another late 2048 clone
« on: June 20, 2014, 07:12:44 pm »
Well, thanks, everyone.
Hold on, lemme make a readme and upload it... :D

Pages: 1 ... 17 18 [19] 20 21 ... 40