





'''simple docstring'''




import qiskit




def 						__lowerCamelCase			(	UpperCAmelCase_ = 2							)   ->qiskit.result.counts.Counts:
	snake_case__	       =   qubits

	# Using Aer's simulator
	snake_case__	       =   qiskit.Aer.get_backend('aer_simulator'							)

	# Creating a Quantum Circuit acting on the q register
	snake_case__	       =   qiskit.QuantumCircuit(UpperCAmelCase_					,				UpperCAmelCase_							)

	# Adding a H gate on qubit 0 (now q0 in superposition)
	circuit.h(0							)

	for i in range(1					,				UpperCAmelCase_							):
		# Adding CX (CNOT) gate
		circuit.cx(i - 1					,				UpperCAmelCase_							)

	# Mapping the quantum measurement to the classical bits
	circuit.measure(list(range(UpperCAmelCase_							)							)					,				list(range(UpperCAmelCase_							)							)							)

	# Now measuring any one qubit would affect other qubits to collapse
	# their super position and have same state as the measured one.

	# Executing the circuit on the simulator
	snake_case__	       =   qiskit.execute(UpperCAmelCase_					,				UpperCAmelCase_					,				shots=10_00							)

	return job.result().get_counts(UpperCAmelCase_							)


if __name__ == "__main__":
			print(f"""Total count for various states are: {quantum_entanglement(3)}""")










'''simple docstring'''




from __future__ import annotations

import math




def 						__lowerCamelCase			(	UpperCAmelCase_					,				UpperCAmelCase_					,				UpperCAmelCase_					,				UpperCAmelCase_					,				UpperCAmelCase_							)   ->int:

	if depth < 0:
		raise ValueError('Depth cannot be less than 0'							)

	if not scores:
		raise ValueError('Scores cannot be empty'							)

	if depth == height:
		return scores[node_index]

	return (
	    max(
	        minimax(depth + 1					,				node_index * 2					,				UpperCAmelCase_					,				UpperCAmelCase_					,				UpperCAmelCase_							)					,				minimax(depth + 1					,				node_index * 2 + 1					,				UpperCAmelCase_					,				UpperCAmelCase_					,				UpperCAmelCase_							)					,				)
	    if is_max
	    else min(
	        minimax(depth + 1					,				node_index * 2					,				UpperCAmelCase_					,				UpperCAmelCase_					,				UpperCAmelCase_							)					,				minimax(depth + 1					,				node_index * 2 + 1					,				UpperCAmelCase_					,				UpperCAmelCase_					,				UpperCAmelCase_							)					,				)
	)




def 						__lowerCamelCase			(	)   ->None:
	snake_case__	       =   [90, 23, 6, 33, 21, 65, 1_23, 3_44_23]
	snake_case__	       =   math.log(len(UpperCAmelCase_							)					,				2							)
	print(f'''Optimal value : {minimax(0					,				0					,				UpperCAmelCase_					,				UpperCAmelCase_					,				UpperCAmelCase_							)}'''							)


if __name__ == "__main__":
			import doctest

			doctest.testmod()
			main()



