2023-07-10

vak: (Знайка)
Люди могут по разному представлять себе разработку софта, но в целом считается, что это размеренный процесс по намеченному плану. Вот несколько разных подходов, в картинках (отсюда).













А вот как реальная разработка выглядит по жизни. 😀

vak: (Default)
Буду постепенно выкладывать примеры игр из упомянутой книжки.

Hammurabi это повторение на языке Питон исторически первой текстовой игры The Sumerian Game 1962 года. У древних игр обычно есть много реализаций, но я собираюсь искать и показывать опенсорсные версии.

Скачиваем, запускаем:
$ wget https://github.com/wzhishen/hammurabi/blob/master/hammurabi.py
$ python2 -i hammurabi.py
>>> hammurabi()
Congratulations, you are the newest ruler of ancient Samaria, elected
for a ten year term of office. Your duties are to dispense food, direct
farming, and buy and sell land as needed to support your people. Watch
out for rat infestations and the plague! Grain is the general currency,
measured in bushels. The following will help you in your decisions:

* Each person needs at least 20 bushels of grain per year to survive.

* Each person can farm at most 10 acres of land.

* It takes 2 bushels of grain to farm an acre of land.

* The market price for land fluctuates yearly.

Rule wisely and you will be showered with appreciation at the end of
your term. Rule poorly and you will be kicked out of office!
O great Hammurabi!
You are in year 1 of your ten year rule.
In the previous year 0 people starved to death.
In the previous year 5 people entered the kingdom.
The population is now 100.
We harvested 3000 bushels at 3 bushels per acre.
Rats destroyed 200 bushels, leaving 2800 bushels in storage.
The city owns 1000 acres of land.
Land is currently worth 19 bushels per acre.
There were 0 deaths from the plague.

How many acres of land will you buy? (0 to DECLINE)
1
How many bushels of grain will you feed to the people?
2000
How many acres of land will you plant with seed?
1000
O great Hammurabi, we have but 781 bushels to spend farming the land!
1000 acres are too many for us! We lack enough bushels to start our farming!
Please factor our funds. Again, how much land will you plant with seed?
[HINT: The maximum possible acres of current total funds to spend farming is 390 acres.]
390
***Thank God! No plague this year***
***O brilliant Hammurabi! This year we have NO people starved***
***O great Hammurabi, this year 3 immigrants come to our kingdom***
***O great Hammurabi, this year we harvest 1950 bushels of grain***
***O great Hammurabi, unluckily a horrible RAT INFESTATION happened! 546 bushels of grain were destroyed***
***O great Hammurabi, the price of land will be 19 bushels per acre next year***

O great Hammurabi!
You are in year 2 of your ten year rule.
In the previous year 0 people starved to death.
In the previous year 3 people entered the kingdom.
The population is now 103.
We harvested 1950 bushels at 5 bushels per acre.
Rats destroyed 546 bushels, leaving 1405 bushels in storage.
The city owns 1001 acres of land.
Land is currently worth 19 bushels per acre.
There were 0 deaths from the plague.

How many acres of land will you buy? (0 to DECLINE)
_
vak: (Default)
Продолжаю тему текстовых игрушек.

Игра The Oregon Trail считается родоначальником жанра. Это 1971 год. В то время компьютеры редко где имелись, и доступ к ним был удалённый, по телефонным линиям, посредством телепринтера. На телепринтерах имелись только большие буквы.



Игра внезапно стала популярной. Со временем появилось несколько коммерческих её реализаций, в том числе с графикой и звуком. Самые известные версии - для Apple II и Nintendo.



Но мы попробуем изначальную версию, тщательно переписанную фанатами на язык Go. Представьте, что вы - глава партии первых переселенцев на американский Запад, и ваша задача - перевести вашу экспедицию через Скалистые горы, избегнув всех опасностей. Скачиваем, компилируем, запускаем: