MSV FM

[email protected]: ~ $
Path : /usr/lib64/python2.7/Demo/curses/
File Upload :
Current < : //usr/lib64/python2.7/Demo/curses/life.pyc

�
Afc@s�ddlZddlZddlZddlZdd	d��YZd�Zd�Zd�Zd�Ze	dkr�ej
e�ndS(
i����Nt	LifeBoardcBsPeZdZed�d�Zd�Zd�Zd�Zed�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*cCs
i|_||_|jj�\}}|d|dd|_|_||_|jj�d|jdd}|jjdd|�|jj|jdd|�xUtd|j�D]A}|jjd|dd�|jjd||jdd�q�W|jj	�dS(s�Create a new LifeBoard instance.

        scr -- curses screen object to use for display
        char -- character used to render live cells (default: '*')
        iit+t-it|N(
tstatetscrtgetmaxyxtXtYtchartcleartaddstrtrangetrefresh(tselfRR
R	Rtborder_linety((s(/usr/lib64/python2.7/Demo/curses/life.pyt__init__)s			
%cCsc|dks6|j|ks6|dks6|j|krLtd||f�nd|j||f<dS(sSet a cell to the live stateisCoordinates out of range %i,%iiN(RR	t
ValueErrorR(RRtx((s(/usr/lib64/python2.7/Demo/curses/life.pytset?s6cCs�|dks6|j|ks6|dks6|j|krLtd||f�n|jj||f�r�|j||f=|jj|d|dd�n4d|j||f<|jj|d|d|j�|jj�dS(s+Toggle a cell's state between live and deadisCoordinates out of range %i,%iit N(	RR	RRthas_keyRtaddchR
R(RRR((s(/usr/lib64/python2.7/Demo/curses/life.pyttoggleEs6!!cCsi|_|jdt�dS(s3Clear the entire board and update the board displaytupdate_boardN(RtdisplaytFalse(R((s(/usr/lib64/python2.7/Demo/curses/life.pyteraseQs	cCsw|j|j}}|s�x�td|�D]z}xqtd|�D]`}|jj||f�r�|jj|d|d|j�q?|jj|d|dd�q?Wq)W|jj�dSi}d|_	x�td|�D]�}tt
d|d�t||d��}xPtd|�D]?}d}|jj||f�}	xgtt
d|d�t||d��D]<}
x3|D]+}|jj||
f�rq|d7}qqqqWqdW||	8}|dkrd|||f<|jj|d|d|j�|	sUd|_	qUq|dkr%|	r%d|||f<q|	r|jj|d|dd�d|_	qqWq�W||_|jj�dS(s<Display the whole board, optionally computing one generationiiRNii(RR	R
RRRRR
Rtboringtmaxtmin(RRtMtNtitjtdtLtstlivetktl((s(/usr/lib64/python2.7/Demo/curses/life.pyRVsB$&
	)0

!	cCsli|_x\td|j�D]H}x?td|j�D]+}tj�dkr5|j||�q5q5WqWdS(s$Fill the board with a random patternig�?N(RR
RR	trandomR(RR#R$((s(/usr/lib64/python2.7/Demo/curses/life.pyt
makeRandom|s
	(t__name__t
__module__t__doc__tordRRRRtTrueRR,(((s(/usr/lib64/python2.7/Demo/curses/life.pyRs			&cCs<|j|d�|j�|j|dd�|j�dS(s&Clear the space where the menu residesiiN(tmovetclrtoeol(tstdscrtmenu_y((s(/usr/lib64/python2.7/Demo/curses/life.pyt
erase_menu�s
cCs;t||�|j|dd�|j|ddd�dS(s/Display the menu of possible keystroke commandsisAUse the cursor keys to move, and space or Enter to toggle a cell.isBE)rase the board, R)andom fill, S)tep once or C)ontinuously, Q)uitN(R6R(R4R5((s(/usr/lib64/python2.7/Demo/curses/life.pytdisplay_menu�s

c	Cs�|j�|j�\}}|dd}t||�|j|d|dd�}t|dtd��}|jdt�|jd|j	d}}xR|j
d|d|�|j�}d|ko�dknr9t|�}|d	kr|j
||�q�|d
kr�t||�|j|dd�|j�|jd�xd|j�}|d
krfPn|jddd�|j�|j�|jddd�|j�qJW|jd�t||�q�|dkr�|j�q�|dkr�Pq�|dkr|j�|jdt�q�|dkr�|j�q�q�|tjkra|dkra|d8}q�|tjkr�||j	dkr�|d7}q�|tjkr�|dkr�|d8}q�|tjkr�||jdkr�|d7}q�q�WdS(NiiiR
RRiis 
tCcis6 Hit any key to stop continuously updating the screen.i����t/RtEetQqtRrtSs(RRR7tsubwinRR0RRRR	R2tgetchtchrRR6RRtnodelayRR,tcursestKEY_UPtKEY_DOWNtKEY_LEFTt	KEY_RIGHT(	R4tstdscr_ytstdscr_xR5R>tboardtxpostypostc((s(/usr/lib64/python2.7/Demo/curses/life.pytkeyloop�sd











"

"
cCst|�dS(N(RM(R4((s(/usr/lib64/python2.7/Demo/curses/life.pytmain�st__main__((R+tstringt	tracebackRBRR6R7RMRNR-twrapper(((s(/usr/lib64/python2.7/Demo/curses/life.pyt<module>s$n			?	
Bethany
Bethany
0%

THE FINEST HOTEL NEAR LAKE KIVU

The Perfect Base For You

Required fields are followed by *





EC1A68011

About Us

Delicious Interior With The Pinch Of Everything

Bethany Investment group is Presbyterian church in Rwanda(EPR) company that manage Hotel and Guest house in Karongi (Bethany Hotel), ISANO branch in GIKONDO(Kigali), Kiyovu branch(Kigali), AMIZERO branch(Nyagatare-East) and Gisenyi Branch(Rubavu).

Accomodation

Get a Comfortable Room
Feel The Comfort

Get a comfortable room and feel our hotel’s comfort. Bethany Hotel features a variety of fully furnished rooms with extra space, Executive rooms, Deluxe rooms with a beautiful lake view and garden space, Deluxe rooms, comfort rooms, family rooms and standard rooms at your service.

Standard Single

Services

We Provide Top Class Facility
Especially For You

Beach BBQ Party

Kick back on the beach& and enjoy our berbecue from our masterchef

Breakfast

Kick back at our hotels& enjoy our breakfast from our masterchef

Conference Hall

Kick back at our hotels& enjoy our conference halls from all bethany branches

Enjoy with your partner

Honeymoon Package

80%

Get In Touch

Don’t Miss Any Update

    +

    Search your Room

    Required fields are followed by *