{"id":45337103,"url":"https://github.com/unclebob/pharaoh","last_synced_at":"2026-02-27T15:01:06.346Z","repository":{"id":339624411,"uuid":"1162712598","full_name":"unclebob/Pharaoh","owner":"unclebob","description":"My old Mac game from the '80s.  Rewritten in Clojure by Claude.","archived":false,"fork":false,"pushed_at":"2026-02-21T00:59:35.000Z","size":963,"stargazers_count":25,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-02-24T15:45:05.865Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unclebob.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-20T15:50:38.000Z","updated_at":"2026-02-24T14:06:38.000Z","dependencies_parsed_at":"2026-02-22T10:01:14.428Z","dependency_job_id":null,"html_url":"https://github.com/unclebob/Pharaoh","commit_stats":null,"previous_names":["unclebob/pharaoh"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/unclebob/Pharaoh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unclebob%2FPharaoh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unclebob%2FPharaoh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unclebob%2FPharaoh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unclebob%2FPharaoh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unclebob","download_url":"https://codeload.github.com/unclebob/Pharaoh/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unclebob%2FPharaoh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29861805,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T08:51:08.701Z","status":"ssl_error","status_checked_at":"2026-02-26T08:50:19.607Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-21T09:32:27.569Z","updated_at":"2026-02-26T14:01:11.670Z","avatar_url":"https://github.com/unclebob.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pharaoh\n\nOriginally written in C for the classic Macintosh by Robert C. Martin\n(circa 1988), this is a ground-up rewrite in Clojure, guided by the\noriginal source code and a detailed specification extracted from it.\n\nWhat follows is an updated version of the original Pharaoh Manual 1.0.\n\n---\n\n## User Manual\n\nYou are the offspring of a famous noble. Your father is revered\nthroughout the land for his financial and military prowess. He is very\nwealthy. But he doesn't think much of you. As far as he is concerned\nyou are never going to amount to much. One day, in a fit of\nfrustration, he throws you out of his house with nothing but your\nclothing. He has written you off as a certain failure. Is he right?\n\nWelcome to the game of Pharaoh. Pharaoh is a simulation game which\ngives you a chance to become the Pharaoh of all Egypt (and possibly\nthe whole world). By applying common sense and experience, you attempt\nto make a vast agricultural community thrive and grow. You make and\nbreak deals with other kingdoms, fight wars, manage revolts, and\nmonitor the day to day operation of your farming communities.\n\nYou start with nothing, but the banks remember your heritage and are\nwilling to extend you a small loan. You use the money they lend you to\nbuild the seeds of a huge empire. Over the years you expand your\nempire, gaining land, wealth, and power. And when your empire has\nreached the size and power which you deem necessary, you attempt to\nerect a monument of such vast enormity that you will be remembered for\nthousands of years to come.\n\nThe going is never easy. There are many obstacles in your way.\nFamines, floods, aggressive neighbors, even terrorists. But with\nskillful management, and some clever strategies, you can prevail and\ngrow. And if you do, you will become the greatest ruler of all time.\n\n### Overview\n\n**Scenario.** You begin the game as a disinherited noble. Your father,\na man of great wealth and power, has deemed you to be a ne'er do\nwell, and has thrown you out into the inhospitalities of the world,\nwithout a shekel to your name. But the bank knows your heritage, and\nis willing to extend to you a small, unsecured, loan.\n\n**Object.** With the money you are able to borrow from the bank, you\nmust build a kingdom of great power. You must buy land, slaves, oxen\nand horses. You must hire mercenaries and overseers to guard your\nkingdom, and manage your slaves. You must plant your fields, and reap\nyour harvests, and make a profit. You must grow.\n\nAnd when you have grown to the size you deem enough, you invest your\nmoney, property, and strength into the construction of a vast pyramid.\n\nYour goal is to complete this pyramid within 40 years. It's not easy.\n\n**Obstacles.** You will face many obstacles along the way towards\nbuilding your pyramid. Famines, floods, wars, and rumours of wars,\nplagues, pestilence, and even fire from heaven.\n\nStill, if you are careful, and clever, you can overcome these foes,\nand grow your kingdom to cover the planet if you wish.\n\n### Commodities\n\nAs pharaoh, you make your kingdom grow by wisely managing the\ncommodities that you own. You buy them, sell them, and produce them.\nMany of the commodities can be used as cash crops, depending on the\ntype of business that you, as pharaoh, wish to invest in.\n\n**Wheat.** This is the product of your land. Your slaves and oxen must\nplant wheat, fertilize the fields, cultivate and harvest the crop.\nThen you can use the resulting wheat as further seed, and food for\nyour oxen, horses, and slaves. Wheat is bought and sold by the\nbushel. Wheat is the most common cash crop. The traditional way to\nplay pharaoh is to produce and sell wheat on the open market.\n\n**Slaves.** Slaves represent your primary motive force. Slaves do the\nwork! It is your slaves which plant your seed, and spread your\nfertilizer. They feed and tend your oxen and horses. They cultivate\nand harvest your fields. And they build your pyramid. Without them,\nnothing can be done. Slaves are also a common cash crop. Under the\nright circumstances, slaves reproduce at an alarming rate, and can\ntherefore become a lucrative trading business.\n\n**Oxen.** As beasts of burden, oxen help the slaves immensely. Slaves\ncan do many times as much work if they are assisted by oxen. But oxen\neat a lot, and don't reproduce quickly. You must find the best ratio\nof slaves to oxen.\n\n**Horses.** Horses are the vehicles for your overseers. They make the\noverseers' jobs much easier by allowing them to get around quickly\nand efficiently. But does every overseer need a horse? Horses eat a\nlot, and reproduce slowly.\n\n**Manure.** Manure is produced by your slaves and livestock in\nproportion to the amount of food that they eat. It is bought and sold\nby the ton and is the fertilizer that you spread on your fields. You\nmust decide how much to spread on the acres that you plant each month.\n\n**Land.** Land is listed by the acre. This is where you plant your\nseed, and where your crops grow. Each acre of land can support the\nplanting of only about 20 bushels of seed, and no more. How much\nwheat that seed will produce depends on the fertilizer, weather, and\nthe efficiency of your slaves.\n\n### Planting and Reaping\n\nIn order to grow wheat, you must plant it. Your land starts out\nfallow, which means that it has lain unplanted for a month or more.\nYou must specify the total number of acres that you intend to plant\neach month. Every time a new month passes, you will see the land that\nyou planted move into the *planted* category. The month after, it\nwill move into the *growing* category. Then it will move into the\n*ripe* category. The next month, it will be harvested, and will move\nback into the *fallow* category.\n\nYou must also specify the total number of tons of manure you want the\nslaves to spread each month on the land you intend to plant. Too\nlittle fertilizer will cause very poor crops, but too much will\ncompletely kill the wheat. It is up to you to figure out the proper\namount to spread.\n\nJune and July are the best months for planting wheat. The harvest of\nthis crop will be the biggest. By the same token, January plantings\nwill often be very bad. (Make hay while the sun shines.)\n\n### Feeding Livestock\n\nYou must specify how many bushels of wheat you want to feed each of\nyour slaves, oxen and horses each month. If you feed them too little,\nthey will sicken and die. If you feed them too much, they can get\nlazy. In general, the more work you make your slaves do, the more\nfood they will require.\n\nRemember, the food you feed your living inventories is deducted from\nyour store of wheat. Make sure you keep enough wheat around, both for\nfood and for planting.\n\n### Overseers\n\nOverseers are the managers of your slaves, and the mercenaries which\nprotect your grounds. They represent both your middle management, and\nyour military. They are employees, and as such you must pay them a\nmonthly salary in gold. (And occasionally deal with their unions.)\n\nWithout overseers to drive them on, your slaves will do little if any\nwork. Also, if you don't have enough overseers, enemy armies will\nplunder and pillage you into bankruptcy.\n\nYou must carefully manage the stress level of your overseers. If you\nmake unreasonable requests of them, or have exaggerated expectations\nof what they can drive the slaves to do, you will find that they get\nquite nervous about their jobs. Nervous overseers tend to take their\nfrustrations out on the slaves, usually with a whip.\n\n### Loans\n\nProbably your first action in the game will be to approach the bank\nfor a loan. The bank is an enigmatic institution (what bank isn't?)\nwhich seems to have an infinite supply of money. However it is quite\nstingy about loaning any of that money to you.\n\nAt first you will find that the bank trusts you for a \"fairly\nsubstantial\" loan. As you grow, the bank will allow you to borrow\nmore and more money. But you will find that the bank is very concerned\nabout your debt to asset ratio. In fact, they will foreclose on you\nif you let it get too bad.\n\n### Market Prices\n\nYou will notice that the prices for the various commodities change\nfrom month to month. Although this may seem like a random fluctuation,\nthere is in fact an underlying cause. Although the market prices are\nindeed subject to random, month to month variations, they are also\nsubject to the classical laws of supply and demand. If you produce a\nlot of a certain commodity, you will be increasing the world supply,\nand that will in turn cause the price to drop.\n\nOf course to have a visible effect on the price, you will have to be\ndealing with fairly large quantities.\n\n### Work\n\nAll activity on your estate requires work. There are 4 monthly work\nquotas which you must specify. They are: the number of acres to plant\neach month, the number of tons of manure to spread each month, the\nnumber of stones to add to your pyramid each month, and the amount of\nfood to be distributed to the livestock each month. You must manage\nthese quotas, making sure that the goals you set are both ambitious\nenough to assure your growth, and conservative enough to be realistic.\n\nYour overseers are paid to make sure that the quotas you have\nspecified get met. If they fail to meet these quotas, they get nervous\nabout their jobs and will beat the slaves. This will increase the\nmotivation of the slaves and they will work even harder. But beatings\ntake a health toll.\n\nIt is possible to get the overseers to the point that they are\nbeating the slaves to great excess. This will cause the slaves to do\na tremendous amount of work for a month or two, while they sicken and\nsuddenly die on you. It is very easy for this to get out of control,\nand you must watch it very closely.\n\nWhen your slaves fail to get all their work done, it is assumed that\nthey did all the work proportionally. i.e. if they did 90% of the\nrequired work, then they only planted 90% of the wheat, harvested 90%\nof the crops, fed 90% of the wheat to the oxen, etc.\n\n### Running the Simulation\n\nThe game consists of a set of one month turns. At the beginning of\neach month, you buy and sell commodities, hire or fire overseers, and\nadjust planting, spreading, and feeding quotas. Then you *run* for a\nmonth.\n\nThe simulation then figures out what happened that month, and displays\nthe results on the screen.\n\n### Events\n\nMost months are uneventful. Your slaves reap, sow, and have babies.\nYour oxen and horses produce lots of manure. And your land grows\nwheat. But every once in a while, something happens to disturb the\nserenity of the scene.\n\nThere are all kinds of events that can occur. Acts of God, acts of\nmobs, plagues, wars, uprisings, etc. Each event will challenge the\nsecurity of your estate and the wisdom of your strategies. Never\ntrust your life to the status quo.\n\n### Contracts\n\nThere are contracts being offered by other kings in the area. These\ncontracts fall outside of the usual laws of supply and demand. So even\nif you would not be able to buy 1000 acres from the market, you can\ncontract to buy them from a neighboring king.\n\nSometimes these contracts can be real bargains, and sometimes they are\nhorrible rip-offs. You must be the judge. Also, there are penalties\ninvolved. If you fail to meet your contracts, you will be assessed a\npercentage of the value of the contract each month until your\ncommitment is fulfilled.\n\nIn general, contracts are an interesting way to make money, and to\ninfluence the market prices. It is possible to procure large amounts\nof a commodity from a neighboring king, and then dump it into your\neconomy, creating a glut.\n\n### Your Neighbors\n\nLike all good pharaohs, you have some neighbors. These are people\njust like you, trying to run their estates. You have 4 such\nneighbors. You will get to know their distinctive faces and voices.\n\nDuring the course of any particular game, the personalities of these\nplayers remains constant. But at the beginning of each new game they\nare shuffled. It therefore becomes one of the puzzles of the game to\nfigure out which face belongs to which personality.\n\n**The Good Guy.** The good guy is pretty reliable. He always tries to\ngive you good advice. If he sees that your slaves are underfed, he\nwill tell you that they look bad. If he notices that your crops are\npoor, he will suggest that you spread more manure.\n\n**The Bad Guy.** The bad guy is working against you all the time.\nPractically all the advice he gives you is bad. He will tell you how\nwonderful your slaves look, just before they keel over and die from\noverwork. He will commend you on your great standing at the bank,\njust as they foreclose.\n\n**The Village Idiot.** This guy's advice is completely undependable.\nSometimes it's right, and sometimes it's wrong. There is no telling.\n\n**The Banker.** The banker is the stooge that the bank sends around\nto bother you about making loan payments. The more worried the bank\nis, the more often he comes.\n\n**Idle messages.** Your neighbors will try to wake you up if you go\nto sleep while playing the game. Any time there is a period of\nsignificant inactivity, these helpful little guys will barge right in\nwith encouraging little slogans or pep talks.\n\n**Chats.** Sometimes your neighbors just pop in for a talk. It is\nthese particular chats which often contain advice or hints as to your\nstatus. But remember, don't believe everything they tell you. One of\nthose guys is an idiot, and the other is out to get you.\n\n### Building the Pyramid\n\nYou build the pyramid by setting the monthly stone quota. This\nspecifies the number of stones to be laid per month. The slaves lay\nthe stones, and the activity requires work. Just how many slaves it\ntakes to lay stones is a variable you will have to discover.\n\nPyramid stones are cubes of granite 6 feet on a side. They are carved\nfrom a nearby quarry and carted to the pyramid site. From there they\nmust be fitted into the pyramid structure itself. It takes a lot of\nwork and equipment to do all this. Work is provided by the slaves,\nand the cost is automatically deducted from your treasury. Make sure\nyou keep a close eye on these variables, they can easily surprise you.\n\nAs the pyramid grows, you will see it grow on the screen. Piece by\npiece you will see it being assembled.\n\n### What You Can't See Can Hurt You\n\nThere are quite a few invisible processes which go on behind the\nscreen. It is not possible to directly observe the state of these\nprocesses, so it must be inferred. It is very important to keep close\ntrack of them, because if they get out of control you can rapidly\nlose the game.\n\n**Health.** The health of all your livestock is monitored. If they are\noverworked, underfed, or mistreated, their health is adversely\naffected. If a sick slave or horse is left to recuperate, with little\nwork to do, and plenty of food to eat, it will heal quite rapidly.\nBad health affects work output, reproduction rate, and the final\nselling price (the buyers aren't dummies).\n\n**Stress.** When work gets done on time, the overseers feel confident\nin their jobs. But when the work schedule starts to slip, they get\nnervous. This will cause them to beat the slaves, which has the\nrewarding effect of getting them to do more work.\n\nIt is very important to manage the stress level of your overseers,\notherwise they will quickly kill all your slaves. This is very tricky\nto manage, since there is no direct indicator of their stress (except\nfor an occasional chat from a neighbor).\n\nJust remember, whenever a month goes by where all the work did not\nget done, the overseers will be a bit nervous that month. If two or\nthree such months go by, then the overseers will be that much more\nnervous. The more nervous they are, the more they will mistreat the\nslaves, and the sicker the slaves will become. It takes several good\nproductive months for overseers to completely relax and regain their\ncomposure.\n\n**Economy.** There are interesting processes underlying the market\nprices. Behind the scenes there are other estate owners producing and\nconsuming a global supply of commodities.\n\nWhen you become a major producer of a commodity, you start to compete\nwith these other producers. An oversupply will result, and the price\nwill begin to fall. Now it's a race. The longer you can maintain your\nproduction in the face of falling prices, the more of your\ncompetition you will displace, until you have carved yourself out a\nnice little niche.\n\nOn the other hand, if you become a major consumer of a certain\ncommodity, you will add to the demand for the commodity. This will\nresult in an under-supply, and the price will begin to rise. Rising\nprices attract new competitors to the arena, and they will begin to\nproduce more and more of the commodity until your demand has been\nsatisfied. Then the price will stabilize at its new higher level.\n\nThe market can only bear so much stress. If you attempt to sell a\nlarge enough quantity of a commodity, the market will refuse to take\nit. The same goes for attempting to buy too much -- the market can\nrun out.\n\nThe only cue you have to these economic factors of supply, demand,\nand current global production capacity, is the price of the\ncommodity, and the comments made by the market keepers when you try\nto buy or sell. If you are good, you will be able to predict\nfluctuations, and finally even control them to your benefit.\n\n**Credit rating.** The bank has a varying opinion of your ability to\nrepay any outstanding debts. As long as you make frequent payments,\nthe bank will love you. But if you forget to pay for a few months, or\nworse: run out of money at the end of a month, the bank will change\nits opinion.\n\nThis all has to do with your credit rating. You can never see your\ncredit rating, but it is there.\n\nIf your credit rating is high, then the bank will feel good about\ngiving you big loans, and will allow relatively severe debt to asset\nratios. But if your credit rating is poor, they will charge you\noutlandish interest rates, and refuse to give you even tiny little\nloans. They will also yell at you an awful lot, and may even close\nyou down if your debt gets too out of line.\n\n### The Screen\n\nThe pharaoh screen is divided into sections. Each section displays\nthe data for a certain category of information. The sections are\nsurrounded by rectangles and titled. Many of the cells are sensitive\nto mouse clicks.\n\n**Date.** Each game starts in January of Year 1.\n\n**Gold.** Current gold, last month's gold, and the percentage change.\nClick to borrow or repay a loan.\n\n**Loan.** Outstanding balance, monthly interest rate, and credit\nlimit. Click to borrow or repay.\n\n**Commodities.** Current holdings, last month's holdings, and delta\npercent for wheat, manure, slaves, horses, and oxen. Click to buy or\nsell.\n\n**Land.** Acres in each state: fallow, planted, growing, ripe, and\ntotal. Selling planted, growing, or ripe land destroys the crops on\nit.\n\n**Prices.** Current market prices. These represent how much you must\npay to purchase, and the maximum you will receive if you sell. The\nselling price can be less than the market price if the quality of the\nmerchandise is low (e.g. diseased horses).\n\n**Feed Rates.** How many bushels of wheat you are feeding each slave,\nox, and horse per month. Click to adjust.\n\n**Spread \u0026 Plant.** How many acres you are planting and how many tons\nof manure you are spreading. Click to adjust.\n\n**Overseers.** How many overseers are employed and the monthly salary\nper overseer. Click to hire, fire, or obtain.\n\n**Pending Contracts.** The contracts you are committed to.\n\n**Pyramid.** A picture of the pyramid, its stone count, height, and\nthe monthly stone quota. Click to adjust the quota.\n\n### Controls\n\n#### Keyboard\n\n| Key | Action             | Key | Action             |\n|-----|--------------------|-----|--------------------|\n| `w` | Buy/sell wheat     | `S` | Set slave feed rate |\n| `s` | Buy/sell slaves    | `O` | Set oxen feed rate  |\n| `o` | Buy/sell oxen      | `H` | Set horse feed rate |\n| `h` | Buy/sell horses    | `p` | Set acres to plant  |\n| `m` | Buy/sell manure    | `f` | Set manure to spread|\n| `l` | Buy/sell land      | `q` | Set pyramid quota   |\n| `L` | Borrow/repay loan  | `g` | Hire/fire overseers |\n| `c` | Contract offers    | `r` | Run one month       |\n| Esc | Close dialog       |     |                     |\n\n#### Mouse\n\nThe game can be driven almost entirely by the mouse. To adjust a\nparameter, simply click on its current value -- to buy wheat, click\non the current amount of wheat. Click the Run button to advance a\nmonth, or Quit to exit.\n\n#### Buying and Selling\n\nWhen you select a commodity to buy or sell, a dialog box appears.\nSelect the function by clicking the appropriate radio button, or type\nthe respective character: `b` = buy, `s` = sell, `k` = keep/acquire.\nThen enter the amount and click OK.\n\nKeep and Acquire mean that you want the system to buy or sell whatever\nis necessary so that when the transaction is over you will own the\nspecified amount. i.e., if you think you need 534 slaves total, then\nacquire 534.\n\n#### Hiring and Firing\n\nWhen you select the overseer function, you must specify whether you\nwant to hire, fire, or obtain overseers. Click the appropriate radio\nbutton, or type: `h` = hire, `f` = fire, `o` = obtain.\n\nObtain means that you wish to hire or fire the appropriate number in\norder to get your current head count to the specified number.\n\n#### Contracts\n\nTo browse the currently offered contracts, press `c` or click on the\ncontracts section. If you see one you like, select it and confirm\nyour commitment. The contract will appear in your list of pending\ncontracts.\n\nThere is no way to escape from a contract once you have committed it.\n\nSave and load are available from the File menu. Games are saved to\nthe `saves/` directory by default.\n\n### Skill Levels\n\n**Easy:** You win by building a pyramid 100 ft tall. The bank will\nnever reduce your credit limit lower than 5,000,000 gold pieces, and\nthe market prices start out in your overwhelming favor. The game\nstarts with commodities, overseers, feed rates, and planting already\nconfigured. This does not mean the easy level is easy to play. It\nshould take you some time to get the hang of how to win. But winning\nis possible if you develop the proper business strategy, and are\ncareful. At this level, your wheat production will most likely never\nget high enough to have serious economic effects.\n\n**Moderate:** Your pyramid must reach 300 ft. The bank can reduce\nyour credit limit all the way to 500,000, and the market prices start\nout weak at best. Great care must be taken at this level; it is very\neasy to get the business out of balance. Towards the end of the game,\nyou will probably find that you have to make a transition in the way\nyou do business. Your wheat production will be so high that the price\nof wheat will come crashing down and make your farming business\nunprofitable. You can solve this problem by dealing in other\ncommodities, or relying on external contracts.\n\n**Hard:** You must complete a pyramid of 1,000 ft. This is hard! The\nbank may deign to give you a piddling 50,000 gold pieces, and the\nmarket prices are decidedly poor. The rule of this game is flexibility\nand changability. You will no doubt be forced to change the\ncomposition of your business several times. Your production levels\nand purchasing powers will have to get so high that they can exert\noverwhelming effects on the local economy. You will be able to exert\nvast control over the market prices. The hard part is keeping your\nbusiness in balance, and keeping the bank happy.\n\n### Ownership Costs\n\nEvery month you pay a maintenance cost for your holdings. If your\ngold goes negative before the emergency loan tops it up, your\noverseers quit and demand a raise.\n\n| Asset  | Cost per unit per month |\n|--------|------------------------|\n| Land   | 100 gold / acre        |\n| Slaves | 10 gold / slave        |\n| Horses | 5 gold / horse         |\n| Oxen   | 3 gold / ox            |\n\nThese costs are multiplied by a random factor averaging ~1.0 each\nmonth. In addition you pay overseer salaries (default 300 gold each\nper month) and loan interest (0.5% of outstanding loan per month).\n\n### Hints\n\n- Be aware of the workload of your slaves. It depends upon a lot of\n  factors, among them: the amount of livestock you have, the amount of\n  land you are planting, the amount of fertilizer you are spreading,\n  the number of pyramid stones you are laying, random events such as\n  wars and revolts, and the amount of wheat that needs harvesting.\n\n- You will know if your slaves are not meeting their workload quota if\n  they fail to plant everything you asked for, and you know you had\n  enough land and wheat for the planting. In this case, the slaves'\n  work will be spread evenly over all their activities. If they only\n  managed to plant half the wheat you demanded, then they were only\n  able to feed the livestock half their food, harvest half the wheat,\n  and lay half the pyramid stones.\n\n- If your slaves are working fine through the winter, spring, and\n  summer, but fail to meet quota during the fall, it may be that the\n  fall harvests of the summer plantings (the really big harvests) are\n  too much for the slaves.\n\n- Watch the prices. Especially watch the price of your cash crop. If\n  you see it falling rapidly, you are probably overproducing. The\n  demand for products in your local economy increases with time. If\n  you produce at a rate which is in excess of this demand, then the\n  price will plummet as the inventories grow. If this happens to you,\n  then consider changing your cash crop, or selling outside your local\n  economy. Don't let the prices get out of control -- you may find\n  that you have devalued the worth of your estate to the point that\n  the bank will not be able to find sufficient collateral for a loan.\n\n---\n\n## Running\n\nRequires Java 11+ and [Clojure CLI tools](https://clojure.org/guides/install_clojure).\n\n```bash\nclojure -M:run\n```\n\nOr use the shell script:\n\n```bash\n./run.sh\n```\n\n## Testing\n\n```bash\nclojure -M:test\n```\n\nThe test suite includes:\n\n- **Unit tests** covering trading, loans, overseers, health, planting,\n  contracts, persistence, input handling, dialog execution, and more.\n- **Gherkin acceptance tests** -- 15 feature files with 370 scenarios,\n  executed by a custom Gherkin parser and runner.\n\n```bash\n# Coverage report\nclojure -M:coverage -o target/coverage\n```\n\n## Project Structure\n\n```\nsrc/pharaoh/           Clojure source\n  core.clj             Main game loop and rendering (Quil)\n  state.clj            Initial state and defaults\n  simulation.clj       Monthly simulation tick\n  trading.clj          Buy/sell market operations\n  overseers.clj        Hire/fire/obtain, stress, lashing\n  contracts.clj        Contract negotiation and settlement\n  loans.clj            Borrowing, repayment, credit checks\n  health.clj           Livestock and slave health model\n  feeding.clj          Feed rate calculations\n  planting.clj         Crop cycle and harvest\n  economy.clj          Market price and supply/demand simulation\n  events.clj           Random hazards\n  messages.clj         All message pools (~500 strings)\n  random.clj           Coveyou PRNG with uniform/gaussian/exponential\n  tables.clj           Piecewise-linear interpolation tables\n  ui/                  Input handling, layout, dialogs, menus\n  gherkin/             Custom Gherkin parser and step definitions\n\nfeatures/              Gherkin feature files\nresources/             Icons, face portraits, logo\ntest/                  Unit and acceptance tests\n```\n\n## History\n\nPharaoh was originally written in C for the Macintosh around 1988. The\ngame's resource fork contained bitmap portraits, icons, and hundreds of\nhumorous message strings -- all of which have been extracted and\npreserved in this port.\n\nThe Clojure rewrite began in February 2026 as an experiment in using\nClaude Code to translate a legacy C codebase into modern Clojure. The\noriginal C source (in `Pharaoh src/c/`) served as the reference. A\ndetailed specification (`initial-spec.md`) was reverse-engineered from\nthe C code, and the Clojure implementation was built from that spec\nusing test-driven development.\n\nThe port uses [Quil](http://quil.info) (a Clojure wrapper around\nProcessing) for rendering, matching the original's grid-based layout\nwith clickable sections, dialog overlays, and animated face portraits.\n\nKey milestones in the rewrite:\n\n- Core economic simulation (trading, planting, feeding, health)\n- Overseer stress and lashing mechanics\n- Loan system with credit checks and foreclosure\n- Contract negotiation with four AI neighbors\n- Random events (locusts, plagues, wars, revolts, acts of God)\n- Neighbor visit system with text-to-speech\n- Difficulty selection screen\n- Save/load with dirty-flag prompting\n- 632 unit tests and 370 Gherkin acceptance scenarios\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funclebob%2Fpharaoh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funclebob%2Fpharaoh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funclebob%2Fpharaoh/lists"}