From a19c33cd8ae7e1d43a69b56a046ac0449328e037 Mon Sep 17 00:00:00 2001
From: Peter Gerwinski <peter.gerwinski@hs-bochum.de>
Date: Tue, 9 May 2023 14:37:48 +0200
Subject: [PATCH] Notizen und Beispiele 9.5.2023

---
 20230509/antiknirps-2.red   | 10 ++++++++
 20230509/antiknirps.red     | 11 ++++++++
 20230509/dwarf-ak-01.red    | 16 ++++++++++++
 20230509/dwarf-ak-02.red    | 17 +++++++++++++
 20230509/dwarf-ak-03.red    | 16 ++++++++++++
 20230509/dwarf-ak-04.red    | 17 +++++++++++++
 20230509/dwarf-ak-05.red    | 16 ++++++++++++
 20230509/dwarf-ak-06.red    | 15 +++++++++++
 20230509/dwarf-ak-07.red    | 17 +++++++++++++
 20230509/rtech-20230509.txt | 50 +++++++++++++++++++++++++++++++++++++
 10 files changed, 185 insertions(+)
 create mode 100644 20230509/antiknirps-2.red
 create mode 100644 20230509/antiknirps.red
 create mode 100644 20230509/dwarf-ak-01.red
 create mode 100644 20230509/dwarf-ak-02.red
 create mode 100644 20230509/dwarf-ak-03.red
 create mode 100644 20230509/dwarf-ak-04.red
 create mode 100644 20230509/dwarf-ak-05.red
 create mode 100644 20230509/dwarf-ak-06.red
 create mode 100644 20230509/dwarf-ak-07.red
 create mode 100644 20230509/rtech-20230509.txt

diff --git a/20230509/antiknirps-2.red b/20230509/antiknirps-2.red
new file mode 100644
index 0000000..39c64c8
--- /dev/null
+++ b/20230509/antiknirps-2.red
@@ -0,0 +1,10 @@
+;redcode
+;name Antiknirps
+;author Peter Gerwinski
+;strategy Modifiziere den Code von Knirps, um ihn zu stoppen
+;assert 1
+
+falle DAT   #0
+      DAT   #0
+start JMP   start, <falle
+      END   start
diff --git a/20230509/antiknirps.red b/20230509/antiknirps.red
new file mode 100644
index 0000000..86843ea
--- /dev/null
+++ b/20230509/antiknirps.red
@@ -0,0 +1,11 @@
+;redcode
+;name Antiknirps
+;author Peter Gerwinski
+;strategy Modifiziere den Code von Knirps, um ihn zu stoppen
+;assert 1
+
+falle DAT   #0
+      DAT   #0
+start DJN   start, falle
+      JMP   start
+      END   start
diff --git a/20230509/dwarf-ak-01.red b/20230509/dwarf-ak-01.red
new file mode 100644
index 0000000..c119bf0
--- /dev/null
+++ b/20230509/dwarf-ak-01.red
@@ -0,0 +1,16 @@
+;redcode
+;name Dwarf
+;author A. K. Dewdney
+;strategy Throw DAT bombs around memory, hitting every 4th memory cell.
+;strategy This program was presented in the first Corewar article.
+;assert 1
+
+bomb  DAT   #0
+      DAT   #0
+dwarf SUB   #4,    bomb
+      MOV   bomb, @bomb
+      JMP   dwarf
+      END   dwarf          ; Programs start at the first line unless
+                           ; an "END start" pseudo-op appears to indicate
+                           ; the first logical instruction.  Also, nothing
+                           ; after the END instruction will be assembled.
diff --git a/20230509/dwarf-ak-02.red b/20230509/dwarf-ak-02.red
new file mode 100644
index 0000000..184a1b3
--- /dev/null
+++ b/20230509/dwarf-ak-02.red
@@ -0,0 +1,17 @@
+;redcode
+;name Dwarf
+;author A. K. Dewdney
+;strategy Throw DAT bombs around memory, hitting every 4th memory cell.
+;strategy This program was presented in the first Corewar article.
+;assert 1
+
+bomb  DAT   #0
+      DAT   #0
+dwarf SUB   #2,    bomb
+      MOV   bomb, <bomb
+      DJN   dwarf, bomb
+      JMP   dwarf
+      END   dwarf          ; Programs start at the first line unless
+                           ; an "END start" pseudo-op appears to indicate
+                           ; the first logical instruction.  Also, nothing
+                           ; after the END instruction will be assembled.
diff --git a/20230509/dwarf-ak-03.red b/20230509/dwarf-ak-03.red
new file mode 100644
index 0000000..e5f359c
--- /dev/null
+++ b/20230509/dwarf-ak-03.red
@@ -0,0 +1,16 @@
+;redcode
+;name Dwarf
+;author A. K. Dewdney
+;strategy Throw DAT bombs around memory, hitting every 4th memory cell.
+;strategy This program was presented in the first Corewar article.
+;assert 1
+
+bomb  DAT   #0
+      DAT   #0
+dwarf SUB   #2,     bomb
+      MOV   bomb,  <bomb
+      JMP   dwarf, <bomb
+      END   dwarf          ; Programs start at the first line unless
+                           ; an "END start" pseudo-op appears to indicate
+                           ; the first logical instruction.  Also, nothing
+                           ; after the END instruction will be assembled.
diff --git a/20230509/dwarf-ak-04.red b/20230509/dwarf-ak-04.red
new file mode 100644
index 0000000..9271d77
--- /dev/null
+++ b/20230509/dwarf-ak-04.red
@@ -0,0 +1,17 @@
+;redcode
+;name Dwarf
+;author A. K. Dewdney
+;strategy Throw DAT bombs around memory, hitting every 4th memory cell.
+;strategy This program was presented in the first Corewar article.
+;assert 1
+
+bomb   DAT   #0
+       DAT   #0
+dwarf  SUB   #2,      bomb
+       MOV   knirps, <bomb
+       JMP   dwarf,  <bomb
+knirps MOV   0,       1
+       END   dwarf          ; Programs start at the first line unless
+                            ; an "END start" pseudo-op appears to indicate
+                            ; the first logical instruction.  Also, nothing
+                            ; after the END instruction will be assembled.
diff --git a/20230509/dwarf-ak-05.red b/20230509/dwarf-ak-05.red
new file mode 100644
index 0000000..f1dc986
--- /dev/null
+++ b/20230509/dwarf-ak-05.red
@@ -0,0 +1,16 @@
+;redcode
+;name Dwarf
+;author A. K. Dewdney
+;strategy Throw DAT bombs around memory, hitting every 4th memory cell.
+;strategy This program was presented in the first Corewar article.
+;assert 1
+
+bomb  DAT   #0
+      DAT   #0
+dwarf SUB   #3,     bomb
+      MOV   bomb,  <bomb
+      JMP   dwarf
+      END   dwarf          ; Programs start at the first line unless
+                           ; an "END start" pseudo-op appears to indicate
+                           ; the first logical instruction.  Also, nothing
+                           ; after the END instruction will be assembled.
diff --git a/20230509/dwarf-ak-06.red b/20230509/dwarf-ak-06.red
new file mode 100644
index 0000000..c1869ea
--- /dev/null
+++ b/20230509/dwarf-ak-06.red
@@ -0,0 +1,15 @@
+;redcode
+;name Dwarf
+;author A. K. Dewdney
+;strategy Throw DAT bombs around memory, hitting every 4th memory cell.
+;strategy This program was presented in the first Corewar article.
+;assert 1
+
+bomb  DAT   #0
+      DAT   #0
+dwarf MOV   bomb,  <bomb
+      JMP   dwarf, <bomb
+      END   dwarf          ; Programs start at the first line unless
+                           ; an "END start" pseudo-op appears to indicate
+                           ; the first logical instruction.  Also, nothing
+                           ; after the END instruction will be assembled.
diff --git a/20230509/dwarf-ak-07.red b/20230509/dwarf-ak-07.red
new file mode 100644
index 0000000..e889dec
--- /dev/null
+++ b/20230509/dwarf-ak-07.red
@@ -0,0 +1,17 @@
+;redcode
+;name Dwarf
+;author A. K. Dewdney
+;strategy Throw DAT bombs around memory, hitting every 4th memory cell.
+;strategy This program was presented in the first Corewar article.
+;assert 1
+
+ptr   DAT   #0
+      DAT   #0
+dwarf SUB   #2,     ptr
+      MOV   bomb,  <ptr
+      JMP   dwarf, <ptr
+bomb  DAT   #0
+      END   dwarf          ; Programs start at the first line unless
+                           ; an "END start" pseudo-op appears to indicate
+                           ; the first logical instruction.  Also, nothing
+                           ; after the END instruction will be assembled.
diff --git a/20230509/rtech-20230509.txt b/20230509/rtech-20230509.txt
new file mode 100644
index 0000000..069f596
--- /dev/null
+++ b/20230509/rtech-20230509.txt
@@ -0,0 +1,50 @@
+xzoom -mag 2 -source 640x480+0+0 &
+
+./pmars -s 4001 -p 64 -e -v 704 knirps.red dwarf-ak-06.red
+
+Warum spielt der optimierte Dwarf gegen Knirps unentschieden?
+mov -2, <-2
+ - Dwarf liest die Speicherzelle ("in ein Primary-Secondary-D-Flipflop").
+ - Dwarf dekrementiert die Speicherzelle. Danach zeigt sie auf sich selbst.
+ - Dwarf speichert die soeben gelesene Kopie wieder in der Speicherzelle.
+Lösung des Problems: etwas anderes dorthin-mov-en.
+(Beim Testen hatten wir noch einmal das alte Programm getestet.)
+
+Physik: https://www.peter.gerwinski.de/physik/
+
+Knirps-Lanze
+mov 1 20
+--> durch spl-Befehl verlangsamen, dann grundsätzlich kampfstark
+
+Selbsterkennung ohne Schwanz
+ - Suchen mit großer Schrittweite
+ - etwas gefunden: Schritt zurück, dann kontinuierlich suchen
+ - letzte Speicherzelle (Adresse bekannt!) des eigenen Programms gefunden --> überspringen
+Nachteil: rechenzeitintensiv
+ - Man verliert gegen Gegner, die "interessante" Muster in den Speicher malen.
+
+Stealth-Taktik: Man wird nicht gefunden von Gegnern, die nach != 0 suchen.
+  mov #42, 0
+  mov #137, 0
+  mov #13, 0
+  ...
+Nachteil: rechenzeitintensiv
+
+Knirps als Waffe gegen Mäuse?
+ - mit Knirpsen schießen
+   --> Maus wird zu Knirps, räumt andere Mäuse ab.
+ - Eigene Knirpsfalle sammelt die Mäuse ein.
+--> Hat in der Praxis bis jetzt nicht funktioniert.
+
+Gegner für sich selbst arbeiten lassen: chml83b.red
+
+Supermaus?
+Idee: Mice geht freiwillig direkt in eine Laufzeitfalle.
+Von Anfang an 64 Tasks.
+Beim Vermehren gehen 32 in die Kopie, 32 bleiben im Original.
+Danach splitten wir uns weiter auf.
+--> Treffer durch Laufzeitfalle sind vergleichsweise harmlos.
+Problem: Koordinierung der verschiedenen Threads.
+ - Kopieren sollte funktionieren. (Evtl. wird die Kopie zu lang.)
+ - Aufteilen beim SPL: selbstmodifizierender Code
+   (z.B. eigenen SPL-Befehl mit JMP überschreiben)
-- 
GitLab