예제 #1
0
def solve6():
    TurnOn()
    MovePickUpSeq(3)
    TurnRight()
    MovePickUpSeq(2)
    MultiMove(2)
    MultiPutDown(5)
    TurnRight()
    MultiMove(2)
    PickUp()
    Move()
    PickUp()
    MultiMove(2)
    MultiPutDown(2)
    TurnRight()
    MultiMove(4)
    TurnRight()
    Move()
    PickUp()
    MultiMove(2)
    PutDown()
    TurnRight()
    MultiMove(2)
    TurnRight()
    Move()
    TurnOff()
예제 #2
0
def solve0():
    TurnOn()
    TurnRight()
    Move()
    Move()
    TurnRight()
    Move()
    TurnOff()
예제 #3
0
파일: robot.py 프로젝트: kseals281/cszero
def BringBack(Steps):
    TurnAround()
    for i in xrange(Steps):
        Move()
    if IsClearAhead() == False:
        TurnLeft()
    Move()
    Move()
 def test_get_move_type(self):
     tests = [
         [[True, 1, 1], '--relative'],
         [[False, 1, 1], '']
     ]
     for x in tests:
         self.move = Move(x[0][0], x[0][1], x[0][2])
         a = self.move.get_move_type()
         assert a == x[1]
예제 #5
0
def solve1():
    TurnOn()
    TurnRight()
    Move()
    PickUp()
    Move()
    PutDown()
    TurnRight()
    Move()
    TurnOff()
예제 #6
0
def solve7():
    TurnOn()
    TurnRight()
    Move()
    PickUp()
    Move()
    PickUp()
    MultiMove(2)
    PickUp()
    Move()
    PickUp()
    TurnLeft()
    MultiMove(3)
    PickUp()
    TurnLeft()
    Move()
    PutDown()
    Move()
    PutDown()
    Move()
    PickUp()
    Move()
    PutDown()
    MultiMove(2)
    PutDown()
    TurnAround()
    MultiMove(4)
    TurnRight()
    MultiMove(5)
    TurnRight()
    Move()
    MultiPutDown(2)
    MultiMove(2)
    TurnOff()
예제 #7
0
파일: robot.py 프로젝트: kseals281/cszero
def Solve5():
    TurnOn()
    TurnAround()
    Move()
    while IsAtEnd() != True:
        TurnLeft()
        Move()
        item()
        while HasPickUps() == True and IsAtDeposit() == True:
            drop()
        if IsAtEnd() == True:
            break
        TurnRight()
        Move()
    TurnOff()
예제 #8
0
파일: robot.py 프로젝트: kseals281/cszero
def GoGet(Steps):
    Forward()
    for i in xrange(Steps):
        if IsClearAhead() == False:
            TurnRight()
        Move()
    item()
예제 #9
0
def pickupChain():
	while isAtPickUp():
		PickUp()
		if isClearAhead():
			Move()
		else:
			TurnLeft()
예제 #10
0
파일: robot.py 프로젝트: kseals281/cszero
def Solve2():
    TurnOn()
    TurnLeft()
    while IsAtEnd() != True:
        Move()
        if IsClearAhead() == False:
            TurnRight()
    TurnOff()
예제 #11
0
파일: robot.py 프로젝트: kseals281/cszero
def Forward():
    while IsClearAhead() == True:
        Move()
        if IsAtEnd() == True:
            break
        if IsAtPickUp() == True:
            PickUp()
            break
예제 #12
0
def solve1():
  TurnOn()
  rightMove()
  PickUp()
  Move()
  PutDown()
  TurnRight()
  finish()
예제 #13
0
def zigzag():
	moveRight()
	Move()
	TurnLeft()
	if isAtPickUp():
		PickUp()
	elif isAtDeposit():
		dropAll()
예제 #14
0
파일: robot.py 프로젝트: kseals281/cszero
def Solve1():
    TurnOn()
    TurnRight()
    while IsAtEnd() != True:
        Move()
        Wall()
        item()
        drop()
    TurnOff()
class TestMove:
    def setup_method(self):
        self.move = Move(True, 1, 1)

    def test_init(self):
        x = self.move

    def test_get_move_type(self):
        tests = [
            [[True, 1, 1], '--relative'],
            [[False, 1, 1], '']
        ]
        for x in tests:
            self.move = Move(x[0][0], x[0][1], x[0][2])
            a = self.move.get_move_type()
            assert a == x[1]

    def test_get_current(self):
        a = self.move.get_current()
        assert a == '0x' + a[2:]
        assert len(a) == 10

    def test_move_command_gen(self):
        tests = [
            [[10, 20], 'xdotool windowmove'],
            [[30, 50], 'xdotool windowmove']
        ]
        for x in tests:
            a = self.move.move_command_gen(x[0][0], x[0][1])
            b = a.split(' ')
            assert b[0] == 'xdotool'
            assert b[1] == 'windowmove'
            assert int(b[-1]) == x[0][1]
            assert int(b[-2]) == x[0][0]
    
    def test_move_win(self):
        a = self.move.move_win()
        b = a.split(' ')
        assert b[0] == 'xdotool'
        assert b[1] == 'windowmove'
        assert int(b[-1]) == 1
        assert int(b[-2]) == 1
예제 #16
0
파일: robot.py 프로젝트: kseals281/cszero
def Solve3():
    TurnOn()
    Move()
    for i in xrange(5):
        GoGet(i)
        BringBack(i)
        drop()
        TurnAround()
    TurnRight()
    Forward()
    TurnOff()
예제 #17
0
def solve4():
  TurnOn()
  TurnRight()
  tripleMove()
  moveRight()
  doubleMove()
  pickupChain()
  Move()
  dropAll()
  TurnRight()
  tripleMove()
  TurnOff()
예제 #18
0
파일: robot.py 프로젝트: kseals281/cszero
def Solve7():
    TurnOn()
    TurnRight()
    while IsClearAhead() == True:
        Forward()
    TurnLeft()
    while IsClearRight() == False:
        if IsClearAhead() == False:
            TurnLeft()
        Move()
        if IsAtDeposit() == False:
            item()
        drop()
    TurnRight()
    for i in xrange(4):
        Move()
    TurnRight()
    while IsAtEnd() != True:
        Move()
        while HasPickUps() == True:
            drop()
    TurnOff()
예제 #19
0
def solve6():
  TurnOn()
  while isClearAhead() or isClearRight():
  	if isClearAhead():
  		Move()
  	else:
  		rightMove()
  	if isAtPickUp():
  		PickUp()
  	elif isAtDeposit():
  		dropAll()
  	elif isAtEnd():
  		TurnOff()
예제 #20
0
파일: robot.py 프로젝트: kseals281/cszero
def Solve4():
    TurnOn()
    TurnRight()
    while IsClearRight() == False:
        Move()
    TurnRight()
    while IsAtDeposit() == False:
        Forward()
    TurnRight()
    while IsAtEnd() == False:
        while HasPickUps() == True:
            drop()
        Forward()
    TurnOff()
예제 #21
0
def solve7():
  TurnOn()
  rightMove()
  pickupChain()
  Move()
  pickupChain()
  tripleMove()
  PickUp()
  moveLeft()
  for x in range(2):
    PutDown()
    Move()
  pickupChain()
  PutDown()
  doubleMove()
  PutDown()
  moveLeft()
  moveLeft()
  for x in range(2):
    tripleMove()
    rightMove()
  dropAll()
  Move()
  finish()
예제 #22
0
def solve4():
    TurnOn()
    TurnRight()
    MultiMove(4)
    TurnRight()
    MultiMove(2)
    PickUp()
    Move()
    PickUp()
    MultiMove(2)
    PutDown()
    PutDown()
    TurnRight()
    MultiMove(3)
    TurnOff()
예제 #23
0
def solve3():
    TurnOn()
    MultiMove(3)
    PickUp()
    TurnRight()
    for i in range(4):
        Move()
        PickUp()
    TurnRight()
    MultiMove(2)
    TurnRight()
    MultiMove(4)
    MultiPutDown(5)
    TurnAround()
    MultiMove(2)
    TurnOff()
from main import Move

for a in range(100):
    for x in range(0, 40):
        a = Move(True, x, 0)
        a.move_win()

    for y in range(0, 20):
        a = Move(True, 0, y)
        a.move_win()

    for x in range(-40, 0):
        a = Move(True, x, 0)
        a.move_win()

    for y in range(-20, 0):
        a = Move(True, 0, y)
        a.move_win()
 def setup_method(self):
     self.move = Move(True, 1, 1)
예제 #26
0
파일: robot.py 프로젝트: kseals281/cszero
def Wall():
    if IsClearAhead() == False:
        TurnRight()
        Move()
        TurnRight()
from main import Move
from random import randint
from time import sleep

for x in range(1000):
    a = Move(False, randint(0, 800), randint(0, 800))
    a.move_win()
    sleep(0.2)
예제 #28
0
def MultiMove(n):
    for i in range(n):
        Move()
예제 #29
0
def MoveDownRightDiagonal():
    TurnLeft()
    Move()
    TurnRight()
    Move()
예제 #30
0
from main import Move
import matplotlib.pyplot as plt
import numpy as np

Fs = 2000
f = 5
sample = 80
x = np.arange(sample)
y = np.sin(2 * np.pi * f * x * 10 / Fs) * 6

for a in y:
    b = Move(True, a, 0)
    b.move_win()