Current Path: > > usr > lib64 > > python2.7 > Demo > curses
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
README | File | 852 bytes | April 19 2020 21:13:39. | |
life.py | File | 7349 bytes | April 10 2024 04:57:37. | |
life.pyc | File | 6787 bytes | April 10 2024 04:58:46. | |
life.pyo | File | 6787 bytes | April 10 2024 04:58:46. | |
ncurses.py | File | 6648 bytes | April 10 2024 04:57:37. | |
ncurses.pyc | File | 5845 bytes | April 10 2024 04:58:46. | |
ncurses.pyo | File | 5845 bytes | April 10 2024 04:58:46. | |
rain.py | File | 2403 bytes | April 10 2024 04:57:37. | |
rain.pyc | File | 2295 bytes | April 10 2024 04:58:46. | |
rain.pyo | File | 2295 bytes | April 10 2024 04:58:46. | |
repeat.py | File | 1515 bytes | April 10 2024 04:57:37. | |
repeat.pyc | File | 1453 bytes | April 10 2024 04:58:46. | |
repeat.pyo | File | 1453 bytes | April 10 2024 04:58:46. | |
tclock.py | File | 3331 bytes | April 10 2024 04:57:37. | |
tclock.pyc | File | 3648 bytes | April 10 2024 04:58:46. | |
tclock.pyo | File | 3648 bytes | April 10 2024 04:58:46. | |
xmas.py | File | 25446 bytes | April 19 2020 21:13:39. | |
xmas.pyc | File | 19864 bytes | April 10 2024 04:58:46. | |
xmas.pyo | File | 19864 bytes | April 10 2024 04:58:46. |
� Afc @ s� d d l Z d d l Z d d l Z d d l Z d d d � � YZ d � Z d � Z d � Z d � Z e d k r� e j e � n d S( i����Nt LifeBoardc B sP e Z d Z e d � d � Z d � Z d � Z d � Z e d � Z d � Z RS( s� Encapsulates a Life board Attributes: X,Y : horizontal and vertical size of the board state : dictionary mapping (x,y) to 0 or 1 Methods: display(update_board) -- If update_board is true, compute the next generation. Then display the state of the board and refresh the screen. erase() -- clear the entire board makeRandom() -- fill the board randomly set(y,x) -- set the given cell to Live; doesn't refresh the screen toggle(y,x) -- change the given cell from live to dead, or vice versa, and refresh the screen display t *c C s i | _ | | _ | j j � \ } } | d | d d | _ | _ | | _ | j j � d | j d d } | j j d d | � | j j | j d d | � xU t d | j � D]A } | j j d | d d � | j j d | | j d d � q� W| j j � d S( s� Create a new LifeBoard instance. scr -- curses screen object to use for display char -- character used to render live cells (default: '*') i i t +t -i t |N( t statet scrt getmaxyxt Xt Yt chart cleart addstrt ranget refresh( t selfR R R R t border_linet y( ( s( /usr/lib64/python2.7/Demo/curses/life.pyt __init__) s %c C sc | d k s6 | j | k s6 | d k s6 | j | k rL t d | | f � n d | j | | f <d S( s Set a cell to the live statei s Coordinates out of range %i,%ii N( R R t ValueErrorR ( R R t x( ( s( /usr/lib64/python2.7/Demo/curses/life.pyt set? s 6c C s� | d k s6 | j | k s6 | d k s6 | j | k rL t d | | f � n | j j | | f � r� | j | | f =| j j | d | d d � n4 d | j | | f <| j j | d | d | j � | j j � d S( s+ Toggle a cell's state between live and deadi s Coordinates out of range %i,%ii t N( R R R R t has_keyR t addchR R ( R R R ( ( s( /usr/lib64/python2.7/Demo/curses/life.pyt toggleE s 6!!c C s i | _ | j d t � d S( s3 Clear the entire board and update the board displayt update_boardN( R t displayt False( R ( ( s( /usr/lib64/python2.7/Demo/curses/life.pyt eraseQ s c C sw | j | j } } | s� x� t d | � D]z } xq t d | � D]` } | j j | | f � r� | j j | d | d | j � q? | j j | d | d d � q? Wq) W| j j � d Si } d | _ x�t d | � D]�} t t d | d � t | | d � � } xPt d | � D]?} d } | j j | | f � } xg t t d | d � t | | d � � D]<