Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
The current year, current cows, and current fertile cows should be the three latches
Looking for a hint here.
I think I have figured out a way to get the right values to add to the right values (won't say more for fear of spoiling for others).
What has me stumped is how to set the initial value in slot 0.
Any hints (no spoilers, I'm not that desperate!) on how to do that?
Thanks!
EDIT: Solved the puzzle. Hint: At no point do you need to use the read module. You don't even need to use the subtract module. I used a total of 4 latches to solve the problem (within the goal).
Coding this in Python and looking at the output confirmed the importance
of keeping track of cows in previous years. The starting point of year 0 was elegantly solved in one of the solutions provided here.
Python Code :
fcows = 0
tcows_year = []
tcows = 1
for year in range(14):
tcows_year.append(0)
if year > 2:
fcows = tcows_year[year-3]
tcows = tcows + fcows
tcows_year[year] = tcows
print('Year = {:2d}, Tcows = {:2d}, Fcows = {:2d}'.format(year,tcows,fcows))
First off in the problem description they give you the formula to the solution. f(x) = f(x-1) + f(x-3)
Simple right but due to how the game works it isn't as simple as reading values from memory and adding them together. Instead this game works off this idea of cycles.
Levels before it wasn't so bad but for this problem it was extremely annoying to try solve by reading from memory because of this cycling and the limitations to your modules you have a very limited scope to solve.
The latch implementation imo should had another option depending if a 0 or 1 is passed in to store the value. But I digress.
Here's how I went about it.
First I gave up with reading values in memory.
Second I realized latches could work as a buffer to store the values in an array. You only need to keep track of 3 previous values to calculate the latest value. Place 3 latches in a row. Create an addition to add zeroth latch and 2nd latch.
So first problem is how do kick start it? Well compare the 0th latch value with 0. Add this value to the addition that adds zeroth latch and 2nd latch and store back into the 0th latch.
Now you got values being calculated.
So now you need to make an iterator that increments when you got the first 3 values calculated. Well to do that again we can look at the last latch and if there is a 0 it hasn't finished initializing. So do to how the game works there is no other operators we can work with so it is easier to know when to tell if it is uninitialized rather than initialized by checking if there is a 0 if there is it will spit a 1, which tells us it hasn't been initialized. We want initialized so we flip 0 into a 1 by comparing output to 0. We then use an addition and a latch to create the iterator and feed that into the mem slot of write.
We feed the "To Write" the value at the end of the 2nd latch.
https://imgur.com/a/FIY2tIF
https://steamcommunity.com/sharedfiles/filedetails/?id=3100617469