AlkantarClanX12
Current Path : /lib64/python3.8/turtledemo/__pycache__/ |
Current File : //lib64/python3.8/turtledemo/__pycache__/nim.cpython-38.opt-2.pyc |
U e5dq � @ s� d dl Z d dlZd dlZdZdZdZdZed Zeed d ed d Zd Z dZ dZd d� Zdd� Z dd� ZG dd� de�ZG dd� de j�ZG dd� de�ZG dd� de�ZG dd� de�Zdd� Zedkr�e� e �� dS ) � Ni� i� � � � � � � )�? r r )� �� r )r r r c C s t �tt�S �N)�random�randint� MINSTICKS� MAXSTICKS� r r �&/usr/lib64/python3.8/turtledemo/nim.py� randomrow s r c C sb | d | d A | d A }|dkr(t | �S td�D ],}| | |A }|| | kr0||f}| S q0d S )Nr � r � )� randommove�range)�stateZxored�z�s�mover r r �computerzug! s r c C sH t | �}t�dd�}| | |dkkrq(qt�|dk| | d �}||fS )Nr r r )�maxr r )r �mr Zrandr r r r + s r c @ s4 e Zd Zdd� Zdd� Zdd� Zdd� Zd d � ZdS )�NimModelc C s || _ d S r )�game)�selfr r r r �__init__6 s zNimModel.__init__c C sP | j jtjtjfkrd S t� t� t� g| _d| _d | _| j j � � tj| j _d S �Nr )r r �Nim�CREATED�OVERr �sticks�player�winner�view�setup�RUNNING�r r r r r* 9 s zNimModel.setupc C s� | j | }|| j |<