vak: (Знайка)
[personal profile] vak
Эрик Рэймонд портонул древнюю игру Хамурапи на Си: gitlab.com/esr/hamurabi

Считается, что это самая первая компьютерная стратегическая игра, начавшаяся в 1962 году под названием The Sumerian Game. Я решил выяснить с помощью Курсора оптимальную стратегию игрока. Курсор написал пару скриптов на Питоне, поиграл маленько методом Монте Карло, после чего подробно рассказал, как следует играть: Strategy.md

Также Курсор сваял скрипт one_game.expect, который проводит один сеанс игры по этой стратегии. Процесс вероятностный, поэтому алгоритм выигрывает не всегда. Но всяко чаще, чем наивный игрок. Вот пример сеанса.
$ ./one_game.expect
spawn hamurabi
Hamurabi
Creative Computing Morristown, New Jersey



Try your hand at governing ancient Sumeria
For a ten-year term of office.



Hamurabi: I beg to report to you,
In year 1, 0 people starved, 5 came to the city,
Population is now 100
The city now owns 1000 acres.
You harvested 3 bushels per acre.
The rats ate 200 bushels.
You now have 2800 bushels in store.

Land is trading at 18 bushels per acre.
How many acres do you wish to buy? 0
How many acres do you wish to sell? 0

How many bushels do you wish to feed your people? 2000

How many acres do you wish to plant with seed? 999


Hamurabi: I beg to report to you,
In year 2, 0 people starved, 3 came to the city,
Population is now 103
The city now owns 1000 acres.
You harvested 1 bushels per acre.
The rats ate 0 bushels.
You now have 1300 bushels in store.

Land is trading at 24 bushels per acre.
How many acres do you wish to buy? 0
How many acres do you wish to sell? 0

How many bushels do you wish to feed your people? 1140

How many acres do you wish to plant with seed? 321


Hamurabi: I beg to report to you,
In year 3, 46 people starved, 5 came to the city,
Population is now 62
The city now owns 1000 acres.
You harvested 5 bushels per acre.
The rats ate 0 bushels.
You now have 1605 bushels in store.

Land is trading at 20 bushels per acre.
How many acres do you wish to buy? 0
How many acres do you wish to sell? 0

How many bushels do you wish to feed your people? 1240

How many acres do you wish to plant with seed? 619


Hamurabi: I beg to report to you,
In year 4, 0 people starved, 15 came to the city,
Population is now 77
The city now owns 1000 acres.
You harvested 5 bushels per acre.
The rats ate 0 bushels.
You now have 3151 bushels in store.

Land is trading at 18 bushels per acre.
How many acres do you wish to buy? 0
How many acres do you wish to sell? 0

How many bushels do you wish to feed your people? 1540

How many acres do you wish to plant with seed? 769


Hamurabi: I beg to report to you,
In year 5, 0 people starved, 9 came to the city,
Population is now 86
The city now owns 1000 acres.
You harvested 1 bushels per acre.
The rats ate 0 bushels.
You now have 1996 bushels in store.

Land is trading at 20 bushels per acre.
How many acres do you wish to buy? 0
How many acres do you wish to sell? 0

How many bushels do you wish to feed your people? 1567

How many acres do you wish to plant with seed? 859


Hamurabi: I beg to report to you,
In year 6, 8 people starved, 11 came to the city,
Population is now 89
The city now owns 1000 acres.
You harvested 2 bushels per acre.
The rats ate 0 bushels.
You now have 1718 bushels in store.

Land is trading at 22 bushels per acre.
How many acres do you wish to buy? 0
How many acres do you wish to sell? 0

How many bushels do you wish to feed your people? 1274

How many acres do you wish to plant with seed? 889


Hamurabi: I beg to report to you,
In year 7, 26 people starved, 5 came to the city,
Population is now 68
The city now owns 1000 acres.
You harvested 2 bushels per acre.
The rats ate 0 bushels.
You now have 1778 bushels in store.

Land is trading at 23 bushels per acre.
How many acres do you wish to buy? 0
How many acres do you wish to sell? 0

How many bushels do you wish to feed your people? 1360

How many acres do you wish to plant with seed? 679


Hamurabi: I beg to report to you,
In year 8, 0 people starved, 7 came to the city,
A horrible plague struck! Half the people died.
Population is now 37
The city now owns 1000 acres.
You harvested 3 bushels per acre.
The rats ate 39 bushels.
You now have 2077 bushels in store.

Land is trading at 23 bushels per acre.
How many acres do you wish to buy? 0
How many acres do you wish to sell? 0

How many bushels do you wish to feed your people? 740

How many acres do you wish to plant with seed? 369


Hamurabi: I beg to report to you,
In year 9, 0 people starved, 13 came to the city,
A horrible plague struck! Half the people died.
Population is now 25
The city now owns 1000 acres.
You harvested 3 bushels per acre.
The rats ate 0 bushels.
You now have 2260 bushels in store.

Land is trading at 21 bushels per acre.
How many acres do you wish to buy? 0
How many acres do you wish to sell? 0

How many bushels do you wish to feed your people? 500

How many acres do you wish to plant with seed? 249


Hamurabi: I beg to report to you,
In year 10, 0 people starved, 36 came to the city,
Population is now 61
The city now owns 1000 acres.
You harvested 2 bushels per acre.
The rats ate 0 bushels.
You now have 2134 bushels in store.

Land is trading at 20 bushels per acre.
How many acres do you wish to buy? 0
How many acres do you wish to sell? 0

How many bushels do you wish to feed your people? 1220

How many acres do you wish to plant with seed? 609

Hamurabi: I beg to report to you,
In year 11, 0 people starved, 4 came to the city,
A horrible plague struck! Half the people died.
Population is now 32
The city now owns 1000 acres.
You harvested 5 bushels per acre.
The rats ate 305 bushels.
You now have 3350 bushels in store.

In your 10-year term of office,8.3176 percent of the
Population starved per year on the average, i.e. a total of
80 people died!!
You started with 10 acres per person and ended with
31.25 acres per person.

Your performance could have been somewhat better, but
Really wasn't too bad at all. 0 people
Would dearly like to see you assassinated but we all have our
Trivial problems.

So long for now.

Date: 2026-04-22 06:35 (UTC)
b0p0h0k: (OSDispak)
From: [personal profile] b0p0h0k
Так это ж Королевство "Эйфория" (В.Г.Баула, ВМК МГУ, Система Информатор БЭСМ-6)!
Врезалось в память: "Крысы наводнили ваши амбары".

Date: 2026-04-22 06:37 (UTC)
sab123: (Default)
From: [personal profile] sab123
Похоже что торговлю землей можно использовать в качестве займа - если население упало или запас зерна упал и засеять всю землю все ранво не получается, то можно продавать землю сейчас, и купить ее назад потом, когда ситуация поправится.

Date: 2026-04-22 07:03 (UTC)
norian: (Default)
From: [personal profile] norian
что-то такоэ было на ес эвм, цельнопижженной совковой ibm360, но более поздняя версия конечно

бушели там точно были в качестве меры зерна и выбор сколько сеять каждый год

а, скорее всего это цельнопижженная кингдом, которая частичнопижженая из хаммурапи

https://www.mobygames.com/game/50480/kingdom/screenshots/pet/496290/
Edited Date: 2026-04-22 07:19 (UTC)

Date: 2026-04-22 07:18 (UTC)
norian: (Default)
From: [personal profile] norian
коты подозревают что это цельнопижженная кингдом, которая частичнопижженая из хаммурапи

https://www.mobygames.com/game/50480/kingdom/screenshots/pet/496290/

Date: 2026-04-22 14:09 (UTC)
ugputu: (Default)
From: [personal profile] ugputu
Логичным кажется не спекуляция землей, а использование ее как аккумулятор - покупать получив неожиданно большой урожай (4-5) чтобы уменьшать потери от крыс и иметь запас земли на продажу при экстремально низких урожаях, чтобы предотвратить массовое вымирание от голода.

Date: 2026-04-22 19:05 (UTC)
b0p0h0k: (Default)
From: [personal profile] b0p0h0k
Нет, это не она, судя по текстам сообщений.
Та была на Фортране, появилась году в 1981-ом.

Date: 2026-04-24 10:51 (UTC)
From: [personal profile] count_enable
Странный лог какой-то, бот с читами играл?

Год 1: 2800 единиц зерна в наличии, но у него получается съесть 2000 и посеять ещё 999!
Год 5: имея 1996 зерна, бот тратит 1567+859.
В 6 году то же самое.

Я скачал репку, и мне игра не даёт потратить больше зерна чем у меня есть.