Skip to content

Commit 46e79a7

Browse files
committed
good enough now
1 parent 0dcb4b3 commit 46e79a7

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

array.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# -*- coding: utf-8 -*-
33
#
44
# rsimai@suse.com
5+
# Hackweek 13, learning Python
56

67
import time
78
import os
@@ -12,7 +13,7 @@
1213

1314

1415
# dimensions
15-
rows = 20
16+
rows = 25
1617
cols = 50
1718

1819
# defender starts at cols/2
@@ -32,7 +33,7 @@
3233
skey = ' '
3334

3435
# automatic fill up
35-
fillup = 1.9
36+
fillup = 1.7
3637
fillrows = 5
3738
blocks = 2
3839

@@ -95,6 +96,7 @@ def printout():
9596
print out
9697
print_defender()
9798
print "Shots:", shotcount, "Ships left:", shipcount, "of", shipcountorig
99+
print "Left: \"" + lkey + "\"", " Right: \"" + rkey + "\"", " Fire: \"" + skey + "\""
98100

99101
# print defender base line
100102
def print_defender():
@@ -207,10 +209,12 @@ def check_hits():
207209
def check_end():
208210
for i in range(0,cols):
209211
if z[(rows-1)*cols+i] == ship:
212+
print
210213
print "Game over! You missed", shipcount, "ship(s)!"
211214
print
212215
exit(0)
213216
if shipcount == 0:
217+
print
214218
print "Well done!"
215219
print
216220
exit(0)

keys.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# -*- coding: utf-8 -*-
33
#
44
# rsimai@suse.com
5+
# Hackweek 13, learning Python
6+
#
7+
# just to find out how to cheaply get key events without blocking the terminal ...
58

69
import atexit
710
from select import select

0 commit comments

Comments
 (0)