from WConio2 import *
import random
for i in range(4,17):
    # Rahmen oben
    gotoxy(i, 4)
    print('#')
    # Rahmen unten
    gotoxy(i,16)
    print('#')
    # Rahmen links
    gotoxy( 4,i)
    print('#')
    # Rahmen rechts
    gotoxy(16,i)
    print('#')
# Spieler-Variablen für Position und Punkte
x=5
y=5 
punkte=0
# Gegner-Varaiblen für Position 
gx=random.randint(5,15)
gy=random.randint(5,15)
while True:
    gotoxy(18,6)  
    print("Punkte: "+str(punkte))
    
    gotoxy(gx,gy) # zur Gegner-Position
    print("*")    # Gegner zeichnen
    gotoxy(x,y)   # zur Spieler-Position
    print("O")    # Spieler zeichnen
    c = getkey()
    gotoxy(x,y)
    print(" ")
    if c=='d'and x<15: x=x+1
    if c=='a'and x> 5: x=x-1
    if c=='s'and y<15: y=y+1
    if c=='w'and y> 5: y=y-1
    if c=='x': break
    
    if x==gx and y==gy:
        punkte=punkte+1 # einen Punkt mehr
        # neue Position für den Gegner
        gx=random.randint(5,15)
        gy=random.randint(5,15)