Skip to content

Instantly share code, notes, and snippets.

View bulkan's full-sized avatar
🇯🇵

Savun Bulkan Evcimen bulkan

🇯🇵
View GitHub Profile
else if ( move == '4')
{
score = score + 1;
if(x_axie > 1)
{
putchxy(x_axie,y_axie, tail);
x_axie = x_axie -1;
putchxy(x_axie,y_axie, snail);
if(x_axie == 1)
While in the do while loop the program checks which character the user hits. The first if statement is the guard statement to check the Escape key. If its hit the game state is then set to "y" which ends the do-while loop. The following else if statements check which way to turn the snail. On each do-while loop iteration, it prints the score to the top left corner (lines 120, 121). After the do-while loop the program clears the screen and at x:5, y:5 it then prints the final score and at 12,6 prints a message then the program/game terminates.
The first else-if statement at line 38 checks to see if the snake is right at the top. If it is then it will appear at the bottom. The else..if (line 64) it checks to see if the snake is at the bottom if it is then makes it appear at the top (lines 88 , line 92). else-if at line 88 checks the snake to see if its at the end of the left side of the screen. If it is then it appears on the right. The last else-if statement line: 112 checks to see if the snake is at the end
import win32com, win32com.client
def unnededTests(qc):
reqFactory = qc.ReqFactory
reqFilter = reqFactory.Filter
# look at the makepy file generated
reqFilter.SetFilter("RQ_REQ_ID", ">=0")
# Set exclusive XFilter: Filter for items that
@bulkan
bulkan / runQTPTest.py
Created September 18, 2009 06:37
Python script to run a QTP test
import win32com, win32com.client
qtp = win32com.client.Dispatch("QuickTest.Application")
# starts up QTP
qtp.Launch()
# make the QTP window visible
qtp.Visible = True
import registry
def findUninstallStr(q):
''' q: some unique string that appears in the UninstallString value '''
uninstallKey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
for subkey in registry.GetSubKeys(uninstallKey):
for (valuename, value, valuetype) in registry.GetKeyValues("%s\%s" %(uninstallKey, subkey)):
if 'UninstallString' == unicode(valuename) and q in unicode(value):
uninstallString = value
return r"%s" %unicode(uninstallString)
import time
import redis
import tweetstream
from datetime import datetime
try:
import simplejson as json
except:
import time
import os
import cherrypy
import jinja2
from filter_daemon import *
try:
import json
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Queshuns</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
function refreshTweets() {
$.getJSON('/latest', {since: window.latestTweet, nt:(new Date()).getTime()},
function(data) {
{% if tweets %}
<div class='latest' style='display:none;'>
{% for tweet in tweets %}
<div>
<h1><a href="http://twitter.com/{{ tweet.username }}/status/{{ tweet.id }}" class="more">{{ tweet.username }}</a> </h1>
<div class="entry">
<p>
<img align='left' height=45 width=48 src="{{ tweet.profile_image_url }}"></img>
<span> {{ tweet.text }}</span>
</p>
import httplib2
import json
h = httplib2.Http()
h.add_credentials('user1', 'user1')
json_str = json.dumps({'name':"joe blows"})
response, content = h.request("http://example.com/rest", method="POST", body=json_str, headers={'content-type':'application/json'})