Esempio n. 1
0
    def test_valid_chat(self):
        with self.assertRaisesRegexp(
                AssertionError,
                "Oops, chat\(1\) won't work. The message must be a string, and not too long."
        ):
            chat(1)

        with self.assertRaisesRegexp(
                AssertionError,
                "Oops, chat\(\) won't work. The message must be a string, and not too long."
        ):
            chat("")

        with self.assertRaisesRegexp(
                AssertionError, "Oops, chat\(" + ("X" * 20000) +
                "\) won't work. The message must be a string, and not too long."
        ):
            chat("X" * 20000)
Esempio n. 2
0
    def test_basic(self):
        def connect():
            # connect to minecraft server running on localhost, 25565 (default port)
            return mcpi.minecraft.Minecraft.create()

        # mcpi_minecraft.setBlockV2(1, 120, 1, block.STONE.name, variant=block.STONE.VARIANT_ANDESITE.value)
        # mcpi_minecraft.setBlockV2(1, 127, 1, block.STONE.name, block.STONE.VARIANT_ANDESITE)
        # mcpi_minecraft.setBlockV2(1, 130, 1, block.PISTON.name, block.PISTON.FACING_DOWN)

        # mcpi_minecraft.setBlockV2(1, 101, 1, block.DIRT.name)
        # mcpi_minecraft.setBlockV2(1, 102, 1, block.CACTUS.name, block.CACTUS.AGE_15)
        init(connect, "papadapadapa")
        chat("hi")
        # begin()
        # pen_down(block.GOLD_BLOCK)

        # forward()
        # forward()
        # forward()
        # forward()

        # up(90)
        # forward()
        # forward()
        # forward()
        # forward()

        # down(90)
        # right(90)
        # forward()
        # forward()
        # forward()
        # forward()

        # begin()
        # delay(0)
        # up(90)
        # for i in xrange(300):
        #     forward(1)
        # down(180)
        # for i in xrange(300):
        #     forward(1)

        # for i in xrange(10):
        #     for i in xrange(1000):
        #         forward(10)
        #     back(1)
        #     for i in xrange(1000):
        #         forward(10)

        # pen_down(living.COW)

        # for i in xrange(50):
        #         forward()

        # sleep(5)
        # select_living_things(nearby())
        # start_task(living.COW.PANIC)
        # start_task(living.OCELOT.MATE)
        # reset_task(living.OCELOT.FOLLOW_OWNER)
        # start_task(living.OCELOT.OCELOT_ATTACK)
        # start_task(living.OCELOT.LEAP_AT_TARGET)

        # reset_task(living.WOLF.SIT)

        # forward()

        # forward()
        # forward()

        # right(90)
        # forward()
        # forward()

        # up(90)
        # forward()
        # forward()

        # right(90)

        # forward()
        # forward()

        # left(90)

        # forward()
        # forward()

        # left(90)

        # forward()
        # forward()

        # right(90)

        # forward(2)

        # down(90)

        # math bug START

        begin()
        delay(0)
        down(90)
        for _ in xrange(200):
            print forward(1)
Esempio n. 3
0
 def test_chat(self):
     chat("hi")
     chat("there")
     self.assertEqual(["hi", "there"], self.game.chat_log)
Esempio n. 4
0
    def test_basic(self):
        def connect():
            # connect to minecraft server running on localhost, 25565 (default port)
            return mcpi.minecraft.Minecraft.create()

        # mcpi_minecraft.setBlockV2(1, 120, 1, block.STONE.name, variant=block.STONE.VARIANT_ANDESITE.value)
        # mcpi_minecraft.setBlockV2(1, 127, 1, block.STONE.name, block.STONE.VARIANT_ANDESITE)
        # mcpi_minecraft.setBlockV2(1, 130, 1, block.PISTON.name, block.PISTON.FACING_DOWN)

        # mcpi_minecraft.setBlockV2(1, 101, 1, block.DIRT.name)
        # mcpi_minecraft.setBlockV2(1, 102, 1, block.CACTUS.name, block.CACTUS.AGE_15)
        init(connect, "papadapadapa")
        chat("hi")
        # begin()
        # pen_down(block.GOLD_BLOCK)

        # forward()
        # forward()
        # forward()
        # forward()

        # up(90)
        # forward()
        # forward()
        # forward()
        # forward()

        # down(90)
        # right(90)
        # forward()
        # forward()
        # forward()
        # forward()

        # begin()
        # delay(0)
        # up(90)
        # for i in xrange(300):
        #     forward(1)
        # down(180)
        # for i in xrange(300):
        #     forward(1)

        # for i in xrange(10):
        #     for i in xrange(1000):
        #         forward(10)
        #     back(1)
        #     for i in xrange(1000):
        #         forward(10)


        # pen_down(living.COW)

        # for i in xrange(50):
        #         forward()

        # sleep(5)
        # select_living_things(nearby())
        # start_task(living.COW.PANIC)
        # start_task(living.OCELOT.MATE)
        # reset_task(living.OCELOT.FOLLOW_OWNER)
        # start_task(living.OCELOT.OCELOT_ATTACK)
        # start_task(living.OCELOT.LEAP_AT_TARGET)

        # reset_task(living.WOLF.SIT)


        # forward()

        # forward()
        # forward()

        # right(90)
        # forward()
        # forward()

        # up(90)
        # forward()
        # forward()

        # right(90)

        # forward()
        # forward()

        # left(90)

        # forward()
        # forward()

        # left(90)

        # forward()
        # forward()

        # right(90)


        # forward(2)

        # down(90)

        # math bug START

        begin()
        delay(0)
        down(90)
        for _ in xrange(200):
            print forward(1)