forked from SheepTester/hello-world
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfizzbuzz.mcfunction
More file actions
16 lines (15 loc) · 940 Bytes
/
fizzbuzz.mcfunction
File metadata and controls
16 lines (15 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# load.mcfunction
scoreboard objectives add vars dummy
scoreboard players set three vars 3
scoreboard players set five vars 5
scoreboard players set i vars 1
# tick.mcfunction
scoreboard players operation divisibleBy3 vars = i vars
scoreboard players operation divisibleBy3 vars %= three vars
scoreboard players operation divisibleBy5 vars = i vars
scoreboard players operation divisibleBy5 vars %= five vars
execute if score divisibleBy3 vars matches 0 if score divisibleBy5 vars matches 0 run tellraw @a {"text":"FizzBuzz"}
execute if score divisibleBy3 vars matches 0 unless score divisibleBy5 vars matches 0 run tellraw @a {"text":"Fizz"}
execute unless score divisibleBy3 vars matches 0 if score divisibleBy5 vars matches 0 run tellraw @a {"text":"Buzz"}
execute unless score divisibleBy3 vars matches 0 unless score divisibleBy5 vars matches 0 run tellraw @a {"score":{"name":"i","objective":"vars"}}
scoreboard players add i vars 1