lehrkraefte:blc:informatik:glf20:oxotetris

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lehrkraefte:blc:informatik:glf20:oxotetris [2020/12/15 11:20]
Ivo Blöchliger
lehrkraefte:blc:informatik:glf20:oxotetris [2020/12/17 14:02] (current)
Ivo Blöchliger [Highscores auf dem Web]
Line 17: Line 17:
 # Gamestate als Dictionary, d.h. wie eine Liste aber mit Namen als Indizes # Gamestate als Dictionary, d.h. wie eine Liste aber mit Namen als Indizes
 tetris = { tetris = {
-    "feld": [[False for y in range(8)] for x in range(8)],   # Pixel belegt oder nicht.+    "feld": [[False for y in range(8)] for x in range(8)],   # Pixel belegt oder nicht (wenn belegt, dann Farbe)
     "steine": list(map(lambda x:list(map(lambda y: [y%4,y//4],x)), [(0,1,2,3),(0,1,2,5), (0,1,4,5), (0,1,5,6), (4,5,1,2), (0,1,2,6), (4,0,1,2)])),     "steine": list(map(lambda x:list(map(lambda y: [y%4,y//4],x)), [(0,1,2,3),(0,1,2,5), (0,1,4,5), (0,1,5,6), (4,5,1,2), (0,1,2,6), (4,0,1,2)])),
     "farben": [(255,0,0), (0,255,0), (0,0,255), (255,255,0), (255,0,255), (0,255,255),(255,255,255)],     "farben": [(255,0,0), (0,255,0), (0,0,255), (255,255,0), (255,0,255), (0,255,255),(255,255,255)],
Line 104: Line 104:
                     f = BLACK                     f = BLACK
                     if yyy>0:                     if yyy>0:
-                        f = fastGetDot(x,yyy-1) 
                         tetris['feld'][x][yyy] = tetris['feld'][x][yyy-1]                         tetris['feld'][x][yyy] = tetris['feld'][x][yyy-1]
                     else:                     else:
                         tetris['feld'][x][yyy] = False                         tetris['feld'][x][yyy] = False
                     if tetris['feld'][x][yyy]:                     if tetris['feld'][x][yyy]:
-                        fastDot(x,yyy,f)+                        fastDot(x,yyy,tetris['feld'][x][yyy])
                     else:                        else:   
                         black(x,yyy);                         black(x,yyy);
Line 143: Line 142:
         for pt in tetris['stein']:         for pt in tetris['stein']:
             if (pt[1]+tetris['y']>=0):             if (pt[1]+tetris['y']>=0):
-                tetris['feld'][pt[0]+tetris['x']][pt[1]+tetris['y']] = True+                tetris['feld'][pt[0]+tetris['x']][pt[1]+tetris['y']] = tetris['farbe']
         checkLines()         checkLines()
         return not neuerStein()         return not neuerStein()
Line 203: Line 202:
 while True:     while True:    
     bigTextScroll((" %d " % tetris['score']), (100,0,0), BLACK)     bigTextScroll((" %d " % tetris['score']), (100,0,0), BLACK)
- 
 </code> </code>
  
 +
 +===== Highscores auf dem Web =====
 +Was folgt sind Notizen, um von der OxoCard die Highscores auf dem Web zu publizieren.
 +<code python>
 +from tcpcom import *
 +# See dcoumentation directly in the code of the OxoCard modules files
 +Wlan.connect("stopbuepf", "stopbuepf")
 +client = HTTPClient()  # Pass True for debugging...
 +client._isSSL=True
 +if client.connect("tech-lab.ch", 443):  # Host is used in HTTP-Query
 +    response = client.sendPostRequest("/scores/index.php", "name="+HTTPClient.toUrl("Hase")+"&score=123")
 +    print(response)
 +    client.closeConnection()
 +
 +</code>
  • lehrkraefte/blc/informatik/glf20/oxotetris.1608027630.txt.gz
  • Last modified: 2020/12/15 11:20
  • by Ivo Blöchliger