# Marienbad (video game)

Marienbad was a 1962 Polish puzzle mainframe game created by Elwro engineer Witold Podgórski in Wrocław, Poland for its Odra 1003. It was an adaption of the logic game nim. Inspired by the discussion in the magazine Przekrój of a variant of nim in the 1961 film Last Year at Marienbad (L'Année dernière à Marienbad), named "Marienbad" by the magazine, Podgórski programmed the game for the in-development 1003 mainframe, released in 1963. The game had players opposing the computer in alternating rounds of removing matches from a set, with the last player to take a match the loser. As the computer always played the optimal moves, it was essentially unbeatable.
Marienbad did not spread far beyond its initial location. Elwro did not produce or advertise the game, though Podgórski recreated it at the Wojskowa Akademia Techniczna (Military University of Technology in Warsaw). The game fell into obscurity, with no pictures or documentation surviving to recreate it in its original form; as there is only one known Odra 1003 remaining and no way of recreating the game exists, it is considered lost. Despite its simplicity, it is considered possibly the first Polish computer or video game.

## Gameplay

In nim, players take turns removing at least one object from a set of objects, traditionally matchsticks, with the goal of either being or not being the player who removes the last object. The gameplay options can be modeled mathematically. In Marienbad's default game mode, four rows of matches were generated, with either one, three, five or seven matches within each row. The side that was left with the last match lost. The computer printout showed the player the current layout of matches. A single player could play the game at a time, whose turn alternated with the computer's. Regardless of which side started the game, the computer was almost certain to be the winner, as it always made the perfect moves.
On its maximum settings, the game consisted of 8,000 rows containing up to 1 trillion matches, requiring an hour for the computer to choose its next move. The game did not support a video output, as the Odra 1003 did not have a screen. Instead, the game was played via a teletypewriter and card perforator, on which the machine printed the results.

## Development

   "The "writing" of the program consisted of setting the 39-bits of content and the 13-bits of the address of each program memory cell on the keys. At that time, there was no operating system or programming languages, and the computer could only write and read from the teletype, and load and punch out the paper tape."
Witold Podgórski, explaining how he wrote Marienbad for the Odra 1003.
Elwro was a Polish company established in 1959 and based in Wrocław, Poland, that designed and manufactured mainframe and microcomputers. Its first release was the Odra 1001 mainframe in 1960, followed by the Odra 1002 in 1962 and the Odra 1003 in 1963. Witold Podgórski was a recent graduate of the Wrocław University of Technology, having majored in electronic engineering and specialized in mathematical machines. Having first heard about the existence of "electronic brains" in 1955 in high school, he embarked on five years of study toward the automation of "digital machines". He completed his masters thesis at Elwro, where he was employed on 10 October 1961, working with the Odra 1001. He developed a way to manipulate the computer's memory to allow content to be saved, thus paving the way for the Odra 1003. The new machine used modern transistor switches that allowed for 500 operations per second, and the drum memory of the Odra 1003 program had a capacity of 40 kilobytes.
While working for Elwro in 1961, Podgórski discovered the logic game nim while reading an issue in the weekly magazine Przekrój. The magazine described a two-player game where players remove any number of items from one of four rows, with the player holding the last item losing. Przekrój named this variant of nim as "Marienbad" after the 1960 French film Last Year at Marienbad (L'Année dernière à Marienbad), in which characters frequently play these mathematical duels. Podgórski became inspired by the use of the game nim in the film after reading about its principles.
While sitting in a multi-hour lecture for his obligatory military study class, Podgórski decided to decipher the Marienbad algorithm and save it to a binary system which could be understood by computers. Podgórski would later assert that the algorithm was extremely simple to implement into a computer and could be expressed in two words, adding that if nobody was interested in it he would take it to the grave. He programmed the game for the first prototype of the Odra 1003, then in development and scheduled to be installed in the Board of the Topographic General Staff of the Polish Army in Wrocław.
The game, intended for logical duels, was developed solely by Podgórski by creating the algorithm, writing a list of instructions which were printed on sheets the size of postcards, and manually setting the initial state of each memory cell. He designed the game to be unbeatable: if the human player made a single mistake, the computer would win. While employees in the Elwro factory knew that the result of the game was predetermined, many volunteered to play it. They could not beat the standard 16-match version of Marienbad, let alone higher settings of the game.

## Legacy

Like many games in the early history of video games, Marienbad did not spread far beyond the initial location. Mainframe computers were rare throughout the world and primarily located in government or military institutions or large corporations, so were generally unavailable for amusement purposes. Elwro produced only 42 Odra 1003 mainframes between 1963 and 1965. Elwro declined to publish or advertise the game, and the title was mostly forgotten. After developing the game, Podgórski became a student at the Wojskowa Akademia Techniczna (Military University of Technology in Warsaw), and with the assistance of fellow student Bogdan Bleja set up a version of the game there on an Odra 1003 that was mediated by a university operator. The computer, and therefore the game, could be used or played by any student, but only through an operator who received the intended input from the player and passed the information to the computer. As in Podgórski's original game instance, the game was essentially unbeatable; the operators as a result actively discouraged the players from participating. The university authorities supported this, as they wanted to forcibly remove the "nasty habit of harassing computers for logic games", which they believed should be used only for serious military purposes. Players took to holding secret meetings in front of the massive computer in the late evenings when the operators were gone. Podgórski recalled that despite knowing that the game was designed to always beat the player, many people spent many hours trying to decipher the algorithm or win.
In later years, variants of nim and Marienbad were the second most popular type of computer game present on Polish computers after noughts and crosses, since it was a relatively simple game to program. Wojciech Pijanowski [pl], who would later become the two-decade long host of Wheel of Fortune from the 1970s, proposed to Polish television a game show where players compete against a computer in nim on a Momik 8b minicomputer. Meanwhile, Podgórski continued to work for Elwro, co-creating Odra computers, though he did not stop working on games. After colleagues brought a variant of the Mancala board game from Egypt, he became inspired to adapt it to the computer. This time he did not want to create an unbeatable game, but included adjustable difficulty levels to create a fun experience regardless of the player's expertise.
Writing for Polish Bytes (Bajty Polskie), Bartłomiej Kluska asserts that as the only copy of the Odra 1003 is kept at the Museum of Technology in Warsaw in an inactive state, the original game of Marienbad no longer exists outside of the memory of players. No recreations of the game have been made for more modern computers, and there are no known photos or documentation for how the game was played or created. In the research paper Gry komputerowe jako dziedzictwo kulturowe (Computer games as a cultural heritage) by Maria Garda, she notes that the game should be written about only in the past tense as the original elements have not been preserved, adding that while the Marienbad algorithm can be recreated in a new programming environment, reconstruction of the physical transistors of the original computer would be nearly impossible. The paper further compared the challenges of playing this title in the modern era to playing Super Mario Bros. on the originally intended equipment in 50 years' time.
Marienbad is considered one of the first Polish video games, developed almost 20 years before later candidates OiX (1984), Gąsienica (1985), and Puszka Pandory (1986), and well before the first well-known Polish game, Tajemnica Statuetki (1993). Łódź game historian Bartek Kluska made this assertion in his foundational book on the Polish video gaming industry, Polish Bytes; his research uncovered the game as 24 years older than the game that previously held the title. Kluska notes, however, that it was preceded by "Kółko i krzyżyk", a version of tic-tac-toe written by Department of Mathematical Apparatus programmer Bogdan Miś in 1960 for the XYZ computer, using a chess-sized grid. Michał Nowicki of Gram.pl asserted that Kluska's research, in contrast with the previous and more imprecise Polish video gaming text Dawno temu w grach (Once upon a time in games), allows Marienbad's claim as the first Polish computer or video game to be made with almost 100% certainty. An article by retailer Empik further asserts that Marienbad's simplicity and lack of video output means that the term "computer game" is a somewhat exaggerated term to describe it, much less "video game".
Garda's paper claims, however, that regardless of its simplicity the game has importance as one of the earliest computer or video games from the region, although Marcin Kosman of Gamezilla notes that this first attempt at creating a Polish computer game went largely unnoticed. Jacek Głowacki of Gry Online stated that despite its obscurity, it should be considered the ancestor of the modern Polish video gaming industry, and that its existence and creation are worth remembering. The 2018 Ars Independent Festival held an exhibition entitled "From Marienbad to Novigrad" which explored the history of the Polish video gaming industry from Marienbad to The Witcher 3 (2015).