This commit is contained in:
Ingy döt Net 2013-04-10 16:19:29 -07:00
parent e5e8880e41
commit 518da4a923
1019 changed files with 15877 additions and 0 deletions

View file

@ -0,0 +1,8 @@
FOR number% = 1 TO 100
CASE TRUE OF
WHEN number% MOD 15 = 0: PRINT "FizzBuzz"
WHEN number% MOD 3 = 0: PRINT "Fizz"
WHEN number% MOD 5 = 0: PRINT "Buzz"
OTHERWISE: PRINT ; number%
ENDCASE
NEXT number%

View file

@ -0,0 +1,24 @@
@echo off
for /L %%i in (1,1,100) do call :tester %%i
goto :eof
:tester
set /a test = %1 %% 15
if %test% NEQ 0 goto :NotFizzBuzz
echo FizzBuzz
goto :eof
:NotFizzBuzz
set /a test = %1 %% 5
if %test% NEQ 0 goto :NotBuzz
echo Buzz
goto :eof
:NotBuzz
set /a test = %1 %% 3
if %test% NEQ 0 goto :NotFizz
echo Fizz
goto :eof
:NotFizz
echo %1

View file

@ -0,0 +1,28 @@
@echo off
set n=1
:loop
call :tester %n%
set /a n += 1
if %n% LSS 101 goto loop
goto :eof
:tester
set /a test = %1 %% 15
if %test% NEQ 0 goto :NotFizzBuzz
echo FizzBuzz
goto :eof
:NotFizzBuzz
set /a test = %1 %% 5
if %test% NEQ 0 goto :NotBuzz
echo Buzz
goto :eof
:NotBuzz
set /a test = %1 %% 3
if %test% NEQ 0 goto :NotFizz
echo Fizz
goto :eof
:NotFizz
echo %1

View file

@ -0,0 +1,12 @@
def fizzbuzz(size):
for i in range(1, size):
if i%15 == 0:
print 'FizzBuzz'
elif i%5 == 0:
print 'Buzz'
elif i%3 == 0:
print 'Fizz'
else:
print i
fizzbuzz(101)

View file

@ -0,0 +1 @@
0:?i&whl'(1+!i:<101:?i&out$(mod$(!i.3):0&(mod$(!i.5):0&FizzBuzz|Fizz)|mod$(!i.5):0&Buzz|!i))

View file

@ -0,0 +1,12 @@
0:?i
& whl
' ( 1+!i:<101:?i
& out
$ ( mod$(!i.3):0
& ( mod$(!i.5):0&FizzBuzz
| Fizz
)
| mod$(!i.5):0&Buzz
| !i
)
)

View file

@ -0,0 +1,156 @@
FizzBuzz
Memory:
Zero
Zero
Counter 1
Counter 2
Zero
ASCIIDigit 3
ASCIIDigit 2
ASCIIDigit 1
Zero
Digit 3
Digit 2
Digit 1
CopyPlace
Mod 3
Mod 5
PrintNumber
TmpFlag
Counters for the loop
++++++++++[>++++++++++[>+>+<<-]<-]
Number representation in ASCII
>>>>
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++ [>+>+>+<<<-]
<<<<
>>
[
Do hundret times:
Decrement counter
->->
Increment Number
> >>+>
> >>+>
<<<<
<<<<
Check for Overflow
++++++++++
>>> >>>>
>++++++++++<
[-<<< <<<<->>>> >>> >-<]
++++++++++
<<< <<<<
Restore the digit
[->>>> >>>-<<< <<<<]
>>>> [-]+ >>>>[<<<< - >>>>[-]]<<<< <<<<
If there is an overflow
>>>>[
<<<<
>>>----------> >>>----------<+<< <<+<<
Check for Overflow
++++++++++
>> >>>>
>>++++++++++<<
[-<< <<<<->>>> >> >>-<<]
++++++++++
<< <<<<
Restore the digit
[->>>> >>-<< <<<<]
>>>> [-]+ >>>>[<<<< - >>>>[-]]<<<< <<<<
If there (again) is an overflow
>>>>[
<<<<
>>---------->> >>----------<+< <<<+<
>>>>
[-]
]<<<<
>>>>
[-]
]<<<<
>>>> >>>>
Set if to print the number
>>>[-]+<<<
Handle the Mod 3 counter
[-]+++
>>>>[-]+<<<<
>+[-<->]+++<
[->->>>[-]<<<<]
>>>>[
<[-]>
[-]
Print "Fizz"
++++++++ ++++++++ ++++++++ ++++++++
++++++++ ++++++++ ++++++++ ++++++++
++++++.
++++++++ ++++++++ ++++++++ ++++++++
+++.
++++++++ ++++++++ +..
[-]
<<<--->>>
]<<<<
Handle the Mod 5 counter
[-]+++++
>>>>[-]+<<<<
>>+[-<<->>]+++++<<
[->>->>[-]<<<<]
>>>>[
<[-]>
[-]
Print "Buzz"
++++++++ ++++++++ ++++++++ ++++++++
++++++++ ++++++++ ++++++++ ++++++++
++.
++++++++ ++++++++ ++++++++ ++++++++
++++++++ ++++++++ +++.
+++++..
[-]
<<----->>
]<<<<
Check if to print the number (Leading zeros)
>>>[
<<< <<<< <<<<
>.>.>.<<<
>>> >>>> >>>>
[-]
]<<<
<<<< <<<<
Print New Line
<<<<[-]++++ ++++ ++++ +.---.[-]>>
]
<<

View file

@ -0,0 +1,11 @@
1.to 100 { n |
true? n % 15 == 0
{ p "FizzBuzz" }
{ true? n % 3 == 0
{ p "Fizz" }
{ true? n % 5 == 0
{ p "Buzz" }
{ p n }
}
}
}