Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: CoreWar (1984) Permanent Tournament of the most complex video game of history  (Read 1063 times)

fitmoos

  • Bay Watcher
    • View Profile

Core War, a 1984 programming game that challenges players to create battle programs, or "warriors," written in the abstract assembly language called Redcode.


Gameplay:
At the heart of Core War, warriors compete for control of a virtual computer. Each program is loaded into memory at random locations, and the goal is to cause the processes of opposing programs to terminate by executing invalid instructions. Redcode instructions are at the core of this battle, with different versions of the language evolving over time.

Key Gameplay Features:
1. Constant instruction length and time.
2. Circular memory and relative addressing.
3. Low-level multiprocessing.
4. No external access to input or output functions.
5. Various versions of Redcode.
6. Strategies: Replicator, Scanner, Bomber, Vampire, Imp, Quickscanner, Core clear.

Redcode Programming:
Developing an effective warrior in Core War requires a deep understanding of strategies, and many programmers base their programs on existing warriors. Optimizers like OptiMax and core-step optimizer tools can help refine warriors. Additionally, genetic algorithms can be used to generate new strategies.

History:
Based in Darwin ( of Bell Labs in 1961, like Tron a 1982 film based on a similar concept ) Core War was inspired by self-replicating programs like Creeper and Reaper. The term "Core" in the name refers to magnetic-core memory. The first description of Redcode was published in 1984, and the International Core Wars Society (ICWS) played a crucial role in standardizing the language. Despite its defunct status, the ICWS's 1994 draft continues to serve as the de facto standard for Redcode.

Redcode Example:
To better understand Redcode, here's an example of ICWS-94 style Redcode:

Code: [Select]
```
0000:  ADD.AB  #   4, $   3
0001:  MOV.F   $   2, @   2
0002:  JMP.B   $  -2, $   0
0003:  DAT.F   #   0, #   0
```

Addressing Modes:
Redcode supports various addressing modes, including immediate (#), direct ($), A-field indirect (*), B-field indirect (@), A-field indirect with predecrement ({), B-field indirect with predecrement (<), A-field indirect with postincrement (}), and B-field indirect with postincrement (>).

Creating a complete Redcode Corewar game requires a significant amount of code and explanation. Here's a simplified example to help you get started. Please note that this is a very basic representation, and real Corewar games are much more complex. Redcode is a low-level programming language used to create assembly programs for a virtual machine called the Memory Array Redcode Simulator (MARS).

Code: [Select]
```redcode
; Sample Redcode Corewar Game
; Two simple warriors that demonstrate basic concepts

; Warrior 1: A simple imp
ORG 0                  ; Start at address 0
MOV 0, 1               ; Move instruction at address 0 to address 1
JMP -1                 ; Jump to the previous instruction (infinite loop)

; Warrior 2: A simple scanner
ORG 100                ; Start at address 100
CMP 1, 1               ; Compare the contents of address 1 with itself
JMP -1                 ; Jump to the previous instruction (infinite loop)
```

This example includes two simple warriors: one that contains a simple imp, and another that acts as a scanner by repeatedly comparing its own instruction with itself. This is a minimalistic representation of a Corewar game.

To run this code, you'll need a Redcode simulator, such as pMARS, which allows you to create warriors, set the initial conditions, and simulate battles between them. Please consult the documentation for the specific Redcode simulator you are using to understand the rules and run this code.



References:
https://en.wikipedia.org/wiki/Core_War
https://vyznev.net/corewar/guide.html

Some video of championships:
https://www.youtube.com/watch?v=-ytlji6T8R0
https://www.youtube.com/watch?v=A8DPfQL3uO0&pp=ygUIY29yZXdhciA%3D
https://www.youtube.com/watch?v=HxFYva9lNzU&pp=ygUIY29yZXdhciA%3D
« Last Edit: October 30, 2023, 09:37:44 pm by fitmoos »
Logged

a1s

  • Bay Watcher
  • Torchlight Venturer
    • View Profile

Oh hey, I read about these in an old issue of Scientific American! Should we have a bay12 tournament?
Logged
I tried to play chess but two of my opponents were playing competitive checkers as a third person walked in with Game of Thrones in hand confused cause they thought this was the book club.

fitmoos

  • Bay Watcher
    • View Profile
Corewar Tournament bay12forums.com
« Reply #2 on: October 30, 2023, 09:15:17 pm »

Ok EXCELENT IDEA
BUT I WANT TO PERFORM NOW!  here are the instructions and rules for participating in a Corewar bay12forums.com tournament:

Welcome to the Permanent Corewar Tournament bay12forums.com

Objective:
The Permanent Corewar Tournament is an ongoing competition where participants submit open-source Redcode warriors that battle against the reigning champion. The goal is to create warriors that can defeat the current champion or maintain your position as the champion.

Rules and Guidelines:

1. Registration: To participate, register on the bay12forums.com and introduce yourself in the dedicated Corewar topic. Create a thread with your warrior's source code, and give it a unique name. Submissions should be in Redcode format. PUT A NAME TO YOUR WARRIOR.

2. Submission: Your warrior should be open source, meaning you share the source code publicly in the forum feed. This promotes a fair and open competition.

3. Defeating the Champion: The reigning champion's code will be posted at the beginning of each round. Your warrior must attempt to defeat the current champion in the simulator.

4. Battles: You are encouraged to provide video or animation representations of your warrior's victory, but this is optional. It adds excitement and showcases your warrior's strategy.

5. Honesty and Integrity: Any attempts to falsify battle outcomes or misrepresent your warrior's capabilities will not be tolerated. Participants found to be dishonest will be permanently expelled from the tournament.

6. Sportsmanship: Maintain a respectful and sportsmanlike attitude when discussing the competition. Constructive criticism is encouraged, but hostility is not tolerated.

7. Judging: The outcome of battles will be determined by the Redcode simulator. The winning warrior is the one that survives longer or meets the specific victory condition.

8. Tournament Format: The competition is ongoing, and the last warrior to defeat the current champion becomes the new champion. The tournament continues indefinitely.

Getting Started:

- Review and Update to the last forum's winner Warrior, and try to win!.

- Download a Redcode simulator such as pMARS or CoreWin to test and simulate your warrior. Study Redcode and the basics of Corewar if you are new to the game. There are many resources available online

Join our Permanent Corewar Tournament and demonstrate your Redcode skills! May the best warrior win, and good luck to all participants.

___________________________________________________

And the FIRST WARRIOR TO BE DEFEATED IS warrior is named "Warrior 1" and contains a loop that moves a value through memory.

redcode
; Warrior 1: Looping DWARF
; This warrior contains a loop that moves a value through memory.

Code: [Select]
ORG 0                  ; Start at address 0
MOV 0, 1               ; Move the value at address 0 to address 1
ADD 1, 2               ; Increment the value at address 1 by 1
JMP -1                 ; Jump to the previous instruction (infinite loop)

In this warrior, it starts at address 0, moves the value at address 0 to address 1, increments the value at address 1 by 1, and then jumps back to the start in an infinite loop. The warrior's goal could be to spread its value across the memory space.

To use this warrior in a Corewar game, you'll need to place it in the memory array, set up the initial conditions, and run the game using a Redcode simulator such as pMARS. The performance of this warrior in a game will depend on the rules and strategy of the specific Corewar competition or scenario in which it is used. !
« Last Edit: October 30, 2023, 10:44:46 pm by fitmoos »
Logged