# Task:
This kata asks you to make a custom esolang interpreter for the language [MiniBitMove](https://esolangs.org/wiki/MiniBitMove). MiniBitMove has only two commands and operates on a array of bits. It works like this:

- `1`: Flip the bit at the current cell
- `0`: Move selector by 1

It takes two inputs, the program and the bits in needs to operate on. The program returns the modified bits. The program stops when selector reaches the end of the array. Otherwise the program repeats itself. **Note: This means that if a program does not have any zeros it is an infinite loop**

Example of a program that flips all bits in an array:
```
Code: 10
Bits: 11001001001010
Result: 00110110110101
```

After you're done, feel free to make translations and discuss this kata.

Difficulty: EASY
Tags: String algorithms

Bit manipulation

Data structures

Fundamentals
Skill types: Bit manipulation

Data structures

Starter code:
def interpreter(tape, array):
	

Solutions:
from itertools import cycle

def interpreter(tape, array):
	(idx, result) = (0, list(map(int, array)))
	for cmd in cycle(map(int, tape)):
		if idx == len(array):
			break
		if cmd:
			result[idx] = 1 - result[idx]
		else:
			idx += 1
	return ''.join(map(str, result))


def interpreter(tape, code):
	(tape, code) = ([int(t) for t in tape], [int(a) for a in code])
	(ptr, out) = (0, '')
	while ptr < len(code):
		try:
			for t in tape:
				if t == 1:
					code[ptr] ^= 1
				elif t == 0:
					ptr += 1
		except:
			break
	return ''.join(map(str, code))


from itertools import cycle

def interpreter(tape, array):
	com = cycle(tape)
	arr = list(array)
	i = 0
	while i < len(arr):
		if next(com) == '1':
			arr[i] = '01'[arr[i] == '0']
			continue
		i += 1
	return ''.join(arr)


from itertools import cycle

def interpreter(tape, array):
	(tape, array) = (cycle(tape), list(array))
	for i in range(len(array)):
		while next(tape) == '1':
			array[i] = '10'[int(array[i])]
	return ''.join(array)


from itertools import cycle

def interpreter(tape, s):
	a = list(s)
	i = 0
	for op in cycle(tape):
		if op == '1':
			a[i] = str(1 - int(a[i]))
		else:
			i += 1
			if i == len(s):
				return ''.join(a)


def interpreter(t, array):
	ls = list(array)
	l = len(t)
	(i, j) = (0, 0)
	while j < len(array):
		if t[i % l] == '1':
			ls[j] = '0' if ls[j] == '1' else '1'
		else:
			j += 1
		i += 1
	return ''.join(ls)


def interpreter(code, array):
	array = list(map(int, array))
	ptr = step = 0
	while ptr < len(array):
		command = code[step]
		if command == '1':
			array[ptr] ^= 1
		elif command == '0':
			ptr += 1
		step = (step + 1) % len(code)
	return ''.join(map(str, array))


from itertools import cycle

def interpreter(tape, array):
	output = ''
	for c in cycle(tape):
		if not array:
			return output
		if c == '0':
			output = output + array[0]
			array = array[1:]
		else:
			array = ('1' if array[0] == '0' else '0') + array[1:]


def interpreter(tape, array):
	curloc = 0
	ret = list(array)
	while True:
		for x in tape:
			if curloc == len(array):
				return ''.join(ret)
			elif int(x):
				ret[curloc] = str(1 ^ int(ret[curloc], 2))
			else:
				curloc += 1


def interpreter(tape, array):
	stepArray = 0
	stepTape = 0
	arr = list(array)
	while stepArray < len(array):
		if tape[stepTape % len(tape)] == '1':
			arr[stepArray] = '1' if arr[stepArray] == '0' else '0'
		else:
			stepArray += 1
		stepTape += 1
	return ''.join(arr)