Guest User

Untitled

a guest
Jun 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. //Microsoft Makecode Javascript
  2. let xtemp = 0
  3. let I = 0
  4. let c = 0
  5. let ya = 0
  6. let xa = 0
  7. let magn = 0
  8. let ym = 0
  9. let y = 0
  10. let xm = 0
  11. let x = 0
  12. let precision = 0
  13. let scale = 0
  14. let maxiter = 0
  15. let posz = 0
  16. let sizey = 0
  17. let posy = 0
  18. let palette: number[] = []
  19. let sizex = 0
  20. let posx = 0
  21. player.onChat(".run", function () {
  22. posx = player.position().getValue(Axis.X)
  23. posy = player.position().getValue(Axis.Y)
  24. posz = player.position().getValue(Axis.Z)
  25. scale = 10
  26. precision = 20
  27. x = 0 - scale
  28. while (x < scale) {
  29. y = Math.tan(x)
  30. blocks.place(blocks.block(Block.Cobblestone), positions.createWorld(posx + x * precision, posy, posz + y * (-1 * precision)))
  31. x = x + 1 / precision
  32. }
  33. })
  34. player.onChat(".mdb", function () {
  35. sizex = 16
  36. sizey = 16
  37. maxiter = 1000
  38. posx = player.position().getValue(Axis.X)
  39. posy = player.position().getValue(Axis.Y)
  40. posz = player.position().getValue(Axis.Z)
  41. xm = -0.1
  42. ym = 0
  43. magn = 1
  44. xa = -2 / magn + xm
  45. ya = -2 / magn + ym
  46. while (ya < 2 / magn + ym) {
  47. c = x * x + y * y
  48. I = 1
  49. while (c < 4 && I < maxiter) {
  50. c = x * x + y * y
  51. xtemp = x * x - y * y
  52. y = 2 * x * y + ya
  53. x = xtemp + xa
  54. I = I + 1
  55. }
  56. if (I != maxiter) {
  57. blocks.place(palette[I % 29], positions.createWorld(posx + 1 + (xa + 2 / magn - xm) * sizex * magn, posy, posz + 1 + (ya + 2 / magn - ym) * sizey * magn))
  58. } else {
  59. blocks.place(blocks.block(Block.BlackConcrete), positions.createWorld(posx + 1 + (xa + 2 / magn - xm) * sizex * magn, posy, posz + 1 + (ya + 2 / magn - ym) * sizey * magn))
  60. }
  61. c = 0
  62. I = 0
  63. xa = xa + 1 / sizex / magn
  64. if (xa >= 2 / magn + xm) {
  65. xa = -2 / magn + xm
  66. ya = ya + 1 / sizey / magn
  67. }
  68. x = xa
  69. y = ya
  70. }
  71. })
  72. palette = [blocks.block(Block.RedConcrete), blocks.block(Block.RedTerracotta), blocks.block(Block.OrangeTerracotta), blocks.block(Block.OrangeConcrete), blocks.block(Block.YellowTerracotta), blocks.block(Block.YellowConcrete), blocks.block(Block.LimeTerracotta), blocks.block(Block.LimeConcrete), blocks.block(Block.GreenTerracotta), blocks.block(Block.GreenConcrete), blocks.block(Block.CyanTerracotta), blocks.block(Block.LightBlueTerracotta), blocks.block(Block.LightBlueConcrete), blocks.block(Block.CyanConcrete), blocks.block(Block.BlueConcrete), blocks.block(Block.BlueTerracotta), blocks.block(Block.PurpleTerracotta), blocks.block(Block.PurpleConcrete), blocks.block(Block.MagentaTerracotta), blocks.block(Block.PinkTerracotta), blocks.block(Block.PinkConcrete), blocks.block(Block.PinkConcrete), blocks.block(Block.WhiteConcrete), blocks.block(Block.WhiteTerracotta), blocks.block(Block.LightGrayConcrete), blocks.block(Block.LightGrayTerracotta), blocks.block(Block.GrayConcrete), blocks.block(Block.GrayTerracotta), blocks.block(Block.BlackTerracotta)]
Add Comment
Please, Sign In to add comment