Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
csaez committed Apr 18, 2015
1 parent 65903b5 commit fb68f95
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 259 deletions.
22 changes: 0 additions & 22 deletions .gitattributes

This file was deleted.

215 changes: 1 addition & 214 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,215 +1,2 @@
#################
## Eclipse
#################

*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# PDT-specific
.buildpath


#################
## Visual Studio
#################

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results

[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.Publish.xml
*.pubxml

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
App_Data/*.mdf
App_Data/*.ldf

#############
## Windows detritus
#############

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac crap
.DS_Store


#############
## Python
#############

*.py[co]

# Packages
*.egg
*.egg-info
dist/
build/
eggs/
parts/
var/
sdist/
develop-eggs/
.installed.cfg

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox

#Translations
*.mo

#Mr Developer
.mr.developer.cfg
.ropeproject
48 changes: 25 additions & 23 deletions flascii_bird_linux.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/python

# This file is part of flascii_bird.
# Copyright (C) 2014 Cesar Saez

Expand All @@ -14,10 +16,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.


import time, sched, sys, tty ,termios
##import msvcrt # windows-only :_(
import time
import sys
import tty
import termios
from math import fmod, sqrt
from threading import Timer
from random import randint
import select

Expand Down Expand Up @@ -106,15 +109,14 @@ def draw(self, BG):
else:
x = s[abs(self.pos.x):] + x[self.pos.x + len(s):] + (" " * 79)
BG[i + self.pos.y] = x
return "\n".join([x[:79] for x in BG][:25])

return "\n".join([ch[:79] for ch in BG][:25])



def IsData():
def is_data():
return select.select([sys.stdin], [], [], 0) == ([sys.stdin], [], [])

def flascii_bird():

def main():
global KEY_PRESSED
SCORE = 0
STEP = 0.1
Expand All @@ -134,23 +136,23 @@ def flascii_bird():
t = 0

while True:
fd=sys.stdin.fileno()
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(sys.stdin)
#tty.setraw(fd,termios.TCSANOW)
tty.setcbreak(sys.stdin.fileno())

t += 1
time.sleep(STEP)
if IsData():
ch=sys.stdin.read(1)
if ch==" ":
KEY_PRESSED=True
if is_data():
ch = sys.stdin.read(1)
if ch == " ":
KEY_PRESSED = True
else:
print "false"


termios.tcsetattr(fd,termios.TCSADRAIN,old_settings) ## if this setence in the game over,graph not right
print("false")

# if this setence in the game over, graph not right
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)

# tubes
if fmod(t, 51) == 0 or t == 1:
pipe_height = randint(1, 7)
up = Sprite("| |\n" * pipe_height + "--------\n--------")
Expand Down Expand Up @@ -189,18 +191,18 @@ def flascii_bird():
docs.pos = Vector(5, 23)
for x in (s, docs):
frame = x.draw(frame)
print BIRD.draw(frame)
print(BIRD.draw(frame))

# collisions
colliders = list(TUBES)
colliders.append(GROUND)
if BIRD.collide(colliders) or BIRD.pos.y < 0:
# game over
print (" " * TERMINAL_SIZE.x + "\n") * TERMINAL_SIZE.y
print "GAME OVER"
print "SCORE:", SCORE
print((" " * TERMINAL_SIZE.x + "\n") * TERMINAL_SIZE.y)
print("GAME OVER")
print("SCORE:", SCORE)
return

if __name__ == "__main__":
KEY_PRESSED = False
flascii_bird()
main()

0 comments on commit fb68f95

Please sign in to comment.