Autor Beitrag
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.03.15 17:55 
Moin!

Wir haben doch festgestellt, dass man immer N addieren kann, nicht nur dann, wenn x < 0 ist. Also können auf jeden Fall die beiden if-Zeilen raus. Und dann schau mal, ob man da noch was zusammenfassen kann. :lupe:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 16.03.15 18:24 
vielleicht so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
function TForm1.LebtNachbar(x, y: Integer): Boolean;
begin
  Result := Feld[(x+N) mod N, (y+N) mod N];
end;
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.03.15 18:32 
Moin!

Perfekt! :zustimm:

Dann würde ich hier gerne noch das "not" entfernen (zugegeben, mehr aus didaktischen Gründen, als dass es großen Nutzen hätte). ;)
ausblenden Delphi-Quelltext
1:
if not ((dx = 0and (dy = 0)) then					

Was tut "not"? Es negiert die Bedingung. Wenn wir also das not entfernen wollen, müssen wir alle Terme in der Klammer negieren (also das Gegenteil abfragen).

Probier mal. :)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 16.03.15 18:36 
vielleicht funktioniert das ja so
ausblenden Delphi-Quelltext
1:
   if  ((dx<>0and (dy<>0)) then					
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.03.15 18:38 
Moin!

Probiers doch einfach mal im Programm aus. :zwinker: (ist schon gar nicht so schlecht :zustimm:)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 16.03.15 18:47 
das programm läuft, aber nicht ganz richtig
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.03.15 19:01 
Moin!

Genau, so ist es. Aber was heißt denn, nicht ganz richtig? (naja, ich weiß es natürlich, deshalb schlage ich vor, wir untersuchen besser nicht, was da im Game of Life schief läuft, das könnte nämlich haarig werden, sondern betrachten das separat)

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
a | b | not (a and b) | (not a) and (not b)
-------------------------------------------
0 | 0 |       ?       |          ?
0 | 1 |       ?       |          ?
1 | 0 |       ?       |          ?
1 | 1 |       ?       |          ?

Bitte mal ausfüllen. :les:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 16.03.15 19:47 
ich hab keine ahnung, was ich rechnen muss :/
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.03.15 20:24 
Moin!

OK, das nennt man Wahrheitstabelle. :idea: Hier mal ein paar einfache Beispiele:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
a | b | a and b
---------------
0 | 0 |    0
0 | 1 |    0
1 | 0 |    0
1 | 1 |    1

a | b | a or b
---------------
0 | 0 |    0
0 | 1 |    1
1 | 0 |    1
1 | 1 |    1

a | not a
---------
0 |   1
1 |   0

Dabei steht 0 für False und 1 für True. Jetzt klarer? ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 16.03.15 20:33 
dann wäre die erste spalte, wenn ich es richtig verstanden habe

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
a | b | not (a and b) | (not a) and (not b)
-------------------------------------------
0 | 0 |       1       |          ?
0 | 1 |       1       |          ?
1 | 0 |       1       |          ?
1 | 1 |       0       |          ?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.03.15 20:45 
Moin!

user profile iconNini hat folgendes geschrieben Zum zitierten Posting springen:
dann wäre die erste spalte, wenn ich es richtig verstanden habe
Jap, hast du. :zustimm:

Und wenn unsere umgewandelte Formel in der letzten Spalte korrekt ist, sollte da genau das Gleiche rauskommen (wir haben ja nur das not in die Klammer gezogen). :les:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 16.03.15 20:51 
aaaaaaachso :P sowas wie assoziativgesetz also
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.03.15 21:05 
Moin!

user profile iconNini hat folgendes geschrieben Zum zitierten Posting springen:
aaaaaaachso :P sowas wie assoziativgesetz also
:shock: Wow, ja, genau sowas. (Aber eben nicht ganz 8))

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 16.03.15 21:06 
ie krieg ich das jetzt so umgewandelt, dass das programm wieder richtig läuft?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.03.15 21:10 
Moin!

user profile iconNini hat folgendes geschrieben Zum zitierten Posting springen:
ie krieg ich das jetzt so umgewandelt, dass das programm wieder richtig läuft?
Indem du das Gehirn einschaltest, die Tabelle ausfüllst, feststellst, dass die Formel nicht korrekt ist, diese korrigierst, die Tabelle auch und dann die Erkenntnis auf die Delphi-Zeile anwendest. :zwinker:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 16.03.15 21:26 
ich bin überfordert :(
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.03.15 21:31 
Moin!

Ach, das wird schon, nicht aufgeben. :zustimm:

Dann machen wir die erste Zeile mal zusammen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
a | b | not (a and b) | (not a) and (not b)
-------------------------------------------
0 | 0 |       1       | (not 0and (not 0) = 1 and 1 = 1
0 | 1 |       1       |          ?
1 | 0 |       1       |          ?
1 | 1 |       0       |          ?

Jetzt klarer? Einfach die Werte einsetzen und ausrechnen. :idea:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 16.03.15 21:34 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
a | b | not (a and b) | (not a) and (not b)
-------------------------------------------
0 | 0 |       1       | (not 0and (not 0) = 1 and 1 = 1
0 | 1 |       1       | (not 0and (not 1) = 1 and 0 = 0        
1 | 0 |       1       | (not 1and (not 0) = 0 and 1 = 0 
1 | 1 |       0       | (not 1and (not 1) = 0 and 0 = 0
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.03.15 21:39 
Moin!

Passt. :) Na, war doch gar nicht schwer, oder? ;)

Leider passt aber unsere Formeltransformation offensichtlich nicht, denn da kommt was anderes als in der Spalte davor... :? Vorschlag für eine Korrektur?

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 16.03.15 21:47 
nein, so logische verknüpfungen find ich total kompliziert :(