ROOTPLOIT
Server: LiteSpeed
System: Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: niphet (1079)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //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(sEncapsulates 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			?