Popular recipes tagged "meta:loc=247"http://code.activestate.com/recipes/tags/meta:loc=247/2015-01-03T02:04:02-08:00ActiveState Code RecipesSnake the game (Python) 2015-01-03T02:04:02-08:00Burak Tandoganhttp://code.activestate.com/recipes/users/4191373/http://code.activestate.com/recipes/578996-snake-the-game/ <p style="color: grey"> Python recipe 578996 by <a href="/recipes/users/4191373/">Burak Tandogan</a> (<a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/pygame/">pygame</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/snake/">snake</a>, <a href="/recipes/tags/the/">the</a>). Revision 3. </p> <p>Popular Snake game with Python-Pygame module. <strong>Important:</strong> If you try to run this script without special <strong>png-wav</strong> files it will fail, you have to put following files to a directory with this script. "apple.png","snakehead.png","intro.wav","dead.wav". They are basically apple picture, head of snake, intro sound and dead sound.Without them script will not run. Just make inactive the statements intro.wav and dead.wav, and find a little apple picture and snake head :).Or you can play the game just install it. <strong>Here is the installer:</strong> <a href="http://dosya.co/7c6f15c0f4d04514/Flafel-1.26-win32.rar" rel="nofollow">http://dosya.co/7c6f15c0f4d04514/Flafel-1.26-win32.rar</a> It will install the game in program files, you can find it in search "Flafel" and click to Flafel.exe. </p> The Normal Cow (Python) 2012-12-06T14:14:28-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578366-the-normal-cow/ <p style="color: grey"> Python recipe 578366 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/interpreter/">interpreter</a>). </p> <p>Ever heard of an esoteric language named COW or wanted to run a program written with just the letters M and O? This recipe provides a COW interpreter that is able to run such programs and decodes them so that they are much easier to read for those who do not know the common bovine tongue.</p> Reader-Writer lock with priority for writers (Python) 2011-09-28T21:45:04-07:00Mateusz Koboshttp://code.activestate.com/recipes/users/4178730/http://code.activestate.com/recipes/577803-reader-writer-lock-with-priority-for-writers/ <p style="color: grey"> Python recipe 577803 by <a href="/recipes/users/4178730/">Mateusz Kobos</a> (<a href="/recipes/tags/locking/">locking</a>, <a href="/recipes/tags/threads/">threads</a>). Revision 2. </p> <p>The following class implements a reader-writer lock to use in the second readers-writers problem with python threads. In this problem, many readers can simultaneously access a share, and a writer has an exclusive access to this share. Additionally, the following constraints should be met: 1) no reader should be kept waiting if the share is currently opened for reading unless a writer is also waiting for the share, 2) no writer should be kept waiting for the share longer than absolutely necessary.</p> Parser Keylogger based on a Finite State Machine (Python) 2011-11-21T14:53:52-08:00Filippo Squillacehttp://code.activestate.com/recipes/users/4174931/http://code.activestate.com/recipes/577952-parser-keylogger-based-on-a-finite-state-machine/ <p style="color: grey"> Python recipe 577952 by <a href="/recipes/users/4174931/">Filippo Squillace</a> (<a href="/recipes/tags/keylogger/">keylogger</a>, <a href="/recipes/tags/parser/">parser</a>, <a href="/recipes/tags/state_machine/">state_machine</a>). Revision 3. </p> <p>This program parses the logfile given by the execution of the keylogger command <strong>'script -c "xinput test ID_CODE" | cat LOG_FILE'</strong> and it is based on a Finite State Machine (FSM) to manage all the possible combinations of the modifiers that represent the state of the FSM. The parser gets the mapping between the couple of keycode and modifier typed and the corresponding char by xmodmap command. The parser is able to manage also extended combinations such as Control or Super that don't give a real char. To introduce new possible states that represent new combinations between modifiers, it's just necessary to update the list of state (<em>mod_keys</em>) and add new rules in the transition function properly. For example to introduce the Caps Lock state just add it in mod_keys and the data structure transition has to handle the release event of the corresponding key. For the dependency of xmodmap the parser works only in X11 based systems.</p> Linux Terminal Color Setter (Python) 2008-09-11T17:08:30-07:00Collin Stockshttp://code.activestate.com/recipes/users/4149235/http://code.activestate.com/recipes/576503-linux-terminal-color-setter/ <p style="color: grey"> Python recipe 576503 by <a href="/recipes/users/4149235/">Collin Stocks</a> (<a href="/recipes/tags/just_for_fun/">just_for_fun</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/terminal/">terminal</a>, <a href="/recipes/tags/unix/">unix</a>). </p> <p>This module can move the cursor around in the terminal, change the text color, highlighting color, et cetera, bold, underlined, flashing (if supported). It also has a word wrap function, and can center text.</p>