Benutzer-Werkzeuge

Webseiten-Werkzeuge


ws1920:zehnter_gruppentermin_06.02.2020

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
ws1920:zehnter_gruppentermin_06.02.2020 [2020/02/06 17:38]
richard.wonneberger
ws1920:zehnter_gruppentermin_06.02.2020 [2020/03/18 15:13] (aktuell)
hannariegel
Zeile 1: Zeile 1:
-Zehnter Gruppentermin+__**Was wir geschafft haben:**__
  
-Anwesende: Hanna, Richard, und Gast 
- 
-Was wir geschafft haben: 
  - man kann das Programm anhalten und dann wieder fortführen  - man kann das Programm anhalten und dann wieder fortführen
 +
  - man kann Zellzustände per Mausklick/​Mausbewegung verändern  - man kann Zellzustände per Mausklick/​Mausbewegung verändern
 +
  - der zeitkritischste Schritt ist nun um 4 Größenordnungen schneller, durch boolsche abfragen  - der zeitkritischste Schritt ist nun um 4 Größenordnungen schneller, durch boolsche abfragen
  
-Umgeschmissene Hürden entlang des heutigen Marathons:+__**Umgeschmissene Hürden entlang des heutigen Marathons:**__ 
  - Einlesen in Events (in Matplotlib) z.B. mit Leertaste stoppen  - Einlesen in Events (in Matplotlib) z.B. mit Leertaste stoppen
 +
  - Einsamkeit ohne Mazal und Leroy und die einhergehende Teaminstabilität  - Einsamkeit ohne Mazal und Leroy und die einhergehende Teaminstabilität
 +
  - allen Fortschritt der heutigen Session zu handlen, das übermotivierte Team zu koordinieren und jeden an allem Fortschritt teilhaben lassen  - allen Fortschritt der heutigen Session zu handlen, das übermotivierte Team zu koordinieren und jeden an allem Fortschritt teilhaben lassen
  
-Ziele/Ideen fürs nächste Mal:+__ 
 +**Ziele/Ideen fürs nächste Mal:**__ 
  - Nebenplots mit statistiken zu Alter/​Anzahl der Zellen o.Ä.  - Nebenplots mit statistiken zu Alter/​Anzahl der Zellen o.Ä.
  - Code ein wenig durchkämmen (mancherorts wurde heute schlampig gecodet)  - Code ein wenig durchkämmen (mancherorts wurde heute schlampig gecodet)
Zeile 20: Zeile 24:
  
  
-Aktuelle ​GOL Datei:+ 
 + 
 +Aktuelle ​GameofLife ​Datei:
 <​code>​ <​code>​
 # -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
Zeile 178: Zeile 184:
 #​Wiederholungen(t) #​Wiederholungen(t)
  
-<\code>+</code> 
 + 
 +Ausführungsdatei:​ 
 + 
 +<​code>​ 
 +# -*- coding: utf-8 -*- 
 +"""​ 
 +Created on Thu Jan 30 15:07:26 2020 
 + 
 +@author: HP 
 +"""​ 
 + 
 +import GameOfLifeaktuell as gol 
 +import numpy as np 
 +from matplotlib import pyplot as plt 
 +from matplotlib import animation 
 + 
 +colormaps = ['​Accent',​ '​Accent_r',​ '​Blues',​ '​Blues_r',​ '​BrBG',​ '​BrBG_r',​ '​BuGn',​ '​BuGn_r',​ '​BuPu',​ '​BuPu_r',​ '​CMRmap',​ '​CMRmap_r',​ '​Dark2',​ '​Dark2_r',​ '​GnBu',​ '​GnBu_r',​ '​Greens',​ '​Greens_r',​ '​Greys',​ '​Greys_r',​ '​OrRd',​ '​OrRd_r',​ '​Oranges',​ '​Oranges_r',​ '​PRGn',​ '​PRGn_r',​ '​Paired',​ '​Paired_r',​ '​Pastel1',​ '​Pastel1_r',​ '​Pastel2',​ '​Pastel2_r',​ '​PiYG',​ '​PiYG_r',​ '​PuBu',​ '​PuBuGn',​ '​PuBuGn_r',​ '​PuBu_r',​ '​PuOr',​ '​PuOr_r',​ '​PuRd',​ '​PuRd_r',​ '​Purples',​ '​Purples_r',​ '​RdBu',​ '​RdBu_r',​ '​RdGy',​ '​RdGy_r',​ '​RdPu',​ '​RdPu_r',​ '​RdYlBu',​ '​RdYlBu_r',​ '​RdYlGn',​ '​RdYlGn_r',​ '​Reds',​ '​Reds_r',​ '​Set1',​ '​Set1_r',​ '​Set2',​ '​Set2_r',​ '​Set3',​ '​Set3_r',​ '​Spectral',​ '​Spectral_r',​ '​Wistia',​ '​Wistia_r',​ '​YlGn',​ '​YlGnBu',​ '​YlGnBu_r',​ '​YlGn_r',​ '​YlOrBr',​ '​YlOrBr_r',​ '​YlOrRd',​ '​YlOrRd_r',​ '​afmhot',​ '​afmhot_r',​ '​autumn',​ '​autumn_r',​ '​binary',​ '​binary_r',​ '​bone',​ '​bone_r',​ '​brg',​ '​brg_r',​ '​bwr',​ '​bwr_r',​ '​cividis',​ '​cividis_r',​ '​cool',​ '​cool_r',​ '​coolwarm',​ '​coolwarm_r',​ '​copper',​ '​copper_r',​ '​cubehelix',​ '​cubehelix_r',​ '​flag',​ '​flag_r',​ '​gist_earth',​ '​gist_earth_r',​ '​gist_gray',​ '​gist_gray_r',​ '​gist_heat',​ '​gist_heat_r',​ '​gist_ncar',​ '​gist_ncar_r',​ '​gist_rainbow',​ '​gist_rainbow_r',​ '​gist_stern',​ '​gist_stern_r',​ '​gist_yarg',​ '​gist_yarg_r',​ '​gnuplot',​ '​gnuplot2',​ '​gnuplot2_r',​ '​gnuplot_r',​ '​gray',​ '​gray_r',​ '​hot',​ '​hot_r',​ '​hsv',​ '​hsv_r',​ '​inferno',​ '​inferno_r',​ '​jet',​ '​jet_r',​ '​magma',​ '​magma_r',​ '​nipy_spectral',​ '​nipy_spectral_r',​ '​ocean',​ '​ocean_r',​ '​pink',​ '​pink_r',​ '​plasma',​ '​plasma_r',​ '​prism',​ '​prism_r',​ '​rainbow',​ '​rainbow_r',​ '​seismic',​ '​seismic_r',​ '​spring',​ '​spring_r',​ '​summer',​ '​summer_r',​ '​tab10',​ '​tab10_r',​ '​tab20',​ '​tab20_r',​ '​tab20b',​ '​tab20b_r',​ '​tab20c',​ '​tab20c_r',​ '​terrain',​ '​terrain_r',​ '​twilight',​ '​twilight_r',​ '​twilight_shifted',​ '​twilight_shifted_r',​ '​viridis',​ '​viridis_r',​ '​winter',​ '​winter_r'​] 
 + 
 +def animate(e):​ 
 +    im.set_array(np.ones(gol.cmap.shape) - np.power(0.5,​ gol.cmap)) 
 +    #​im.set_array( np.power(0.5,​ gol.cmap)) 
 +    #​im.set_array(gol.cmap * 0.1) 
 +    #​print(gol.cmap) 
 +    gol.Schritt() 
 +    return im, 
 + 
 +gol.Initialisiere() 
 + 
 +#fig = plt.figure(figsize=(1920,​1080),​ dpi=1, frameon=False) 
 +fig = plt.figure() 
 + 
 + 
 +anim_running = True 
 +#fig position ändern 
 +def onPress(event):​ 
 +    global anim_running ​    
 +    if event.key=='​ ': 
 +        if anim_running:​ 
 +            anim.event_source.stop() 
 +            anim_running = False 
 +        else: 
 +            anim.event_source.start() 
 +            anim_running = True 
 + 
 +zustand_neu = None 
 +cmap_neu = None 
 +def onClick(event):​ 
 +    global zustand_neu,​ cmap_neu 
 +    if event.button == 1: 
 +        anim.event_source.stop() 
 +        zustand_neu = np.copy(gol.zustand) 
 +        cmap_neu = np.copy(gol.cmap) 
 +        if event.xdata != None and event.ydata != None: 
 +            pos_x = int(np.round(event.xdata)) 
 +            pos_y = int(np.round(event.ydata)) 
 +            if pos_x >= 0 and pos_y >= 0 and pos_x < gol.zustand.shape[1] and pos_y < gol.zustand.shape[0]:​ 
 +                zustand_neu[pos_y,​ pos_x] = 1 - gol.zustand[pos_y,​ pos_x] 
 +        cmap_neu = gol.cmap * zustand_neu + zustand_neu 
 +        im.set_array(np.ones(cmap_neu.shape) - np.power(0.5,​ cmap_neu)) 
 +        fig.canvas.draw() 
 +         
 +def onMove(event):​ 
 +    global zustand_neu,​ cmap_neu 
 +    if event.button == 1 and event.xdata != None and event.ydata != None: 
 +        pos_x = int(np.round(event.xdata)) 
 +        pos_y = int(np.round(event.ydata)) 
 +        if pos_x >= 0 and pos_y >= 0 and pos_x < gol.zustand.shape[1] and pos_y < gol.zustand.shape[0]:​ 
 +            zustand_neu[pos_y,​ pos_x] = 1 - gol.zustand[pos_y,​ pos_x] 
 +        cmap_neu = gol.cmap * zustand_neu + zustand_neu 
 +        im.set_array(np.ones(cmap_neu.shape) - np.power(0.5,​ cmap_neu)) 
 +        fig.canvas.draw() 
 + 
 +def onClickEnd(event):​ 
 +    global zustand_neu,​ cmap_neu 
 +    if event.button == 1: 
 +        gol.zustand = zustand_neu 
 +        gol.cmap = cmap_neu 
 +        im.set_array(np.ones(cmap_neu.shape) - np.power(0.5,​ cmap_neu)) 
 +        fig.canvas.draw() 
 +        if anim_running:​ 
 +            anim.event_source.start() 
 +         
 +plt.axis('​off'​) 
 + 
 +#​figure(num=None,​ figsize=(8, 6), dpi=80, facecolor='​w',​ edgecolor='​k'​) 
 +#​plt.figure(figsize=(1,​1))  
 +#im = plt.imshow(gol.zustand,​ animated=True,​ cmap=plt.get_cmap('​YlGn'​)) 
 +#im = plt.imshow(gol.zustand,​ animated=True,​ cmap=plt.get_cmap('​inferno'​)) 
 +im = plt.imshow(gol.zustand,​ animated=True,​ cmap=plt.get_cmap(colormaps[int(np.random.random()*len(colormaps))])) 
 + 
 + 
 +fig.canvas.mpl_connect('​key_press_event',​ onPress) 
 +fig.canvas.mpl_connect('​button_press_event',​ onClick) 
 +fig.canvas.mpl_connect('​button_release_event',​ onClickEnd) 
 +fig.canvas.mpl_connect('​motion_notify_event',​ onMove) 
 + 
 +anim = animation.FuncAnimation(fig,​ animate, interval=200) 
 + 
 +#blit ist boese 
 +
 +# fuer mint gruen cmap=YlGn 
 +plt.show() 
 +</code>
  
ws1920/zehnter_gruppentermin_06.02.2020.1581007118.txt.gz · Zuletzt geändert: 2020/02/06 17:38 von richard.wonneberger