Page 2 of 3 <123>
Topic Options
#213007 - 2017-11-27 04:03 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Allen]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Here's my last place code...Probably not much to do to it that hasn't already been done to the others. I didn't think about the repetitive 'teen' and 'ty' until after it was too late to fix it.

 Code:
; begin BOB
;
;!

function a($)
   Dim $0, $1, $2, $3
   $0 = " bottle of beer"
   $1 = " bottles of beer"
   $2 = " on the wall"
   $3 = ". Take one down and pass it around, "
   If $ > 1
      $a = l($) + $1 + $2 + ", " + LCase(l($)) + $1 + $3 + LCase(l(-1+$)) + IIf($=2, $0, $1) +$2+ "."
   Else
      $a = IIf($=1, l(1)+$0+$2+", one"+$0+$3+"no more"+$1+$2+".", "No more"+$1+$2+", no more"+$1+". Go to the store and buy some more, ninety-nine"+$1+$2+".")
endfunction

function l($)
   Dim $t
   $t = '',One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten,Eleven,Twelve,Thirteen,Fourteen,Fifteen,Sixteen,Seventeen,Eighteen,Nineteen,Twenty,Thirty,Forty,Fifty,Sixty,Seventy,Eighty,Ninety
   If 20 > $
      $l = $t[$]
   Else
      $l = IIf($ mod 10, $t[1*$/10+18]+"-"+lcase($t[$ mod 10]), $t[1*$/10+18])
endfunction

;!
;!
; end BOB

Top
#213010 - 2017-11-27 05:12 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Allen]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
514

 Code:
function a($)
  Dim $b
  if $+0=$
    $b="no more",one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thir,four,fif,six,seven,eigh,nine,twen,thir,"for",fif,six,seven,eigh,nine
    if $<20
      $a=$b[$]
      if $>12
        $a=$a+teen
      endif
    else
      $a=$b[18+$/10]+ty
      if $ mod 10
        $a=$a + "-" + $b[$ mod 10]
      endif
    endif
    $a = $a + ' bottle' + IIf($ = 1, @, s) + ' of beer'
  else
    $ = 1 * $
    $b = ' on the wall'
    $a = chr(asc(a($))-32) + Right(a($), ~) + $b + ', ' + a($) + ". "
    If $
      $a = $a + 'Take one down and pass it around, ' + a($-1) + $b + "."
    Else
      $a = $a + 'Go to the store and buy some more, ' + a(99) + $b + "."
endfunction

Top
#213011 - 2017-11-27 05:18 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: ShaneEP]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
I can't spot what you changed?

Edit... OMG!

Top
#213012 - 2017-11-27 05:46 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Allen]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Lol, stole that one. Still can't figure out what Jochen is doing to shave 4 more off though.

Edited by ShaneEP (2017-11-27 05:47 PM)

Top
#213014 - 2017-11-27 07:24 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: ShaneEP]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
mwahaha!!
make that 5

*hint: that iif() spared me one not using it, replacing another section with iif() spared me 4 more
_________________________



Top
#213015 - 2017-11-27 08:38 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Jochen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
510

 Code:
 
function a($)
  Dim $b
  if $+0=$
    $b="no more",one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thir,four,fif,six,seven,eigh,nine,twen,thir,"for",fif,six,seven,eigh,nine
    if $<20
      $a=$b[$] + iif($>12,teen,@)
    else
      $a=$b[18+$/10]+ty
      if $ mod 10
        $a=$a + "-" + $b[$ mod 10]
      endif
    endif
    $a = $a + ' bottle' + IIf($ = 1, @, s) + ' of beer'
  else
    $ = 1 * $
    $b = ' on the wall'
    $a = chr(asc(a($))-32) + Right(a($), ~) + $b + ', ' + a($) + ". "
    If $
      $a = $a + 'Take one down and pass it around, ' + a($-1) + $b + "."
    Else
      $a = $a + 'Go to the store and buy some more, ' + a(99) + $b + "."
endfunction

Top
#213016 - 2017-11-27 08:57 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
thats a new one for me ... 505.
Should quit pestering though
_________________________



Top
#213017 - 2017-11-27 09:06 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
"fif,six,seven,eigh,nine"

...is doubled in that array. Bugs me the most, but I'll just leave it to you guys
_________________________



Top
#213018 - 2017-11-27 09:08 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Jochen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
I can't find that f###ing stroke.

506
 Code:
function a($)
  Dim $b
  if $+0=$
    $b="no more",one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thir,four,fif,six,seven,eigh,nine,twen,thir,"for",fif,six,seven,eigh,nine
    if $<20
	  $a=$b[$] + iif($>12,teen,@)
    else
	  $a=$b[18+$/10]+ty + iif($ mod 10,"-" + $b[$ mod 10],@)
    endif
    $a = $a+' bottle'+IIf($=1,@,s)+' of beer'	
    
  else
    $ = 1 * $
    $b = ' on the wall'
    $a = chr(asc(a($))-32) + Right(a($), ~) + $b + ', ' + a($) + ". "
    If $
      $a = $a + 'Take one down and pass it around, ' + a($-1) + $b + "."
    Else
      $a = $a + 'Go to the store and buy some more, ' + a(99) + $b + "."
endfunction

Top
#213019 - 2017-11-27 09:10 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
there's one iif left that can be replaced by quick math :p
Honestly. Took me quite some minutes to come up with
_________________________



Top
#213020 - 2017-11-27 09:15 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Jochen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
I get it... i know where you are, but for the life of me...
Top
#213021 - 2017-11-27 11:33 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Jochen, I think with the crowd that is playing, no one is going to throw up a fit for your suggestions... but I could see this being a point of contention otherwise. \:\)
Top
#213022 - 2017-11-28 07:41 AM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
That's just my inner child wanting to be part of the game \:D
Will refrain from this in future courses (hard but will try)
_________________________



Top
#213023 - 2017-11-28 08:48 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
ah to hell with that... 490!

*gnihihihi
_________________________



Top
#213024 - 2017-11-28 09:11 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Jochen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
\:\) I've been looking at the words but to no avail so far.
Top
#213027 - 2017-12-01 08:16 AM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Won't finish the next tourney until sunday.
Haven't even started coding yet \:\(
IF workload and familiy allows I'll be ready on 10th.
_________________________



Top
#213029 - 2017-12-03 06:16 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Very well done guys. All of your codes entering the public were far more advanced than my test code. *tips Fedora

Results:

 Code:
Private Round

Allen    559    5    1
Glenn    568    4    1
Shane    660    3    1

Public Round

Allen    506    5    1
Shane    514    4    1
Glenn    571    3    1    *Glenn has posted a code gaining 3 strokes in comparison to his private round score, dunno what to make with that :/



And the Winner is Allen with a perfect score of 12, followed by Shane and Glenn both with 9 points!

Overall Tournament standings:

 Code:
Shane - 32
Allen - 18
Glenn -  9


Will post my 490 tomorrow morning when I have access to it ... just for the lolz
_________________________



Top
#213030 - 2017-12-03 11:09 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Jochen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Good fun this one was. Thank you kind sir for a good challenge.
Top
#213031 - 2017-12-04 07:15 AM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
I too had fun with this one, thank you.
For what it's worth, here goes the 490 for you to chew on:

 Code:
function a($)
  Dim $b
  if $+0=$
    $b="no more",one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thir,four,fif,six,seven,eigh,nine,twen,thir,"for"
    if $<20
      $a=$b[$] + iif($>12,teen,@)
    else
      $a= $b[18+$/10-($>49)*8] + ty + iif($ mod 10,"-" + $b[$ mod 10],@)
    endif     
    $a = $a + ' bottle' + left(s,$^1) + ' of beer'  
  else  
    $ = 1 * $
    $b = ' on the wall'
    $a = chr(asc(a($))-32) + Right(a($), ~) + $b + ', ' + a($) + ". "
    If $
      $a = $a + 'Take one down and pass it around, ' + a($-1) + $b + "."
    Else
      $a = $a + 'Go to the store and buy some more, ' + a(99) + $b + "."
endfunction
_________________________



Top
#213032 - 2017-12-04 06:56 PM Re: Kixgolf - 99 Bottles Of Beer - Public Round [Re: Jochen]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Argh. I knew there had to be a way to do this...Just never put the 'bits' together.
 Code:
left(s,$^1)


Edited by ShaneEP (2017-12-04 06:56 PM)

Top
Page 2 of 3 <123>


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 493 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.121 seconds in which 0.093 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org