I have this code so solve a
challenge of Advent Of Code :
that works fine for the given
tests
but on the real data I have to
change 2 numbers
so I can do :
but that breaks all the tests
is there a way I can make it
work for the tests and for the real data without breaking
anything ?
so to be clear. In the test are data given which not has to be changed. As soon as you have to solve the real problem , some data needs to be changed. Roelof
|
Administrator
|
Pharo Smalltalk Users mailing list wrote
> so to be clear. In the test are data given which not has to be changed. As > soon as you have to solve the real problem , some data needs to be > changed. It's difficult to give good design advice with such a partial picture of the domain, but two straightforward solutions might be: 1. self isDeploymentMode ifTrue: [ "change data" ] 2. or, self sanitizationStrategy: (NoSanitization | ProductionSanitization) ----- Cheers, Sean -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
Cheers,
Sean |
Oke
Maybe it is better to give the whole challenge On the way to your gravity assist around the Moon, your ship computer beeps angrily about a "1202 program alarm". On the radio, an Elf is already explaining how to handle the situation: "Don't worry, that's perfectly norma--" The ship computer bursts into flames. You notify the Elves that the computer's magic smoke seems to have escaped. "That computer ran Intcode programs like the gravity assist program it was working on; surely there are enough spare parts up there to build a new Intcode computer!" An Intcode program is a list of integers
separated by commas (like Opcode For example, if your Intcode computer encounters Opcode Once you're done processing an opcode, move to the next
one by stepping forward For example, suppose you have the following program:
For the purposes of illustration, here is the same program split into multiple lines:
The first four integers,
Step forward
Stepping forward Here are the initial and final states of a few more small programs:
Once you have a working computer, the first step is to restore
the gravity assist program (your puzzle input) to the "1202
program alarm" state it had just before the last computer caught
fire. To do this, before running the program, replace
position
so as you can see in the tests there are no data changed so my
code works fine and all the tests are green but when you want to
work with the real data the say that you have to replace two
values. So my question is how to make that part work without breaking
the tests. Roelof
Op 28-12-2019 om 21:46 schreef Sean P. DeNigris: Pharo Smalltalk Users mailing list wroteso to be clear. In the test are data given which not has to be changed. As soon as you have to solve the real problem , some data needs to be changed.It's difficult to give good design advice with such a partial picture of the domain, but two straightforward solutions might be: 1. self isDeploymentMode ifTrue: [ "change data" ] 2. or, self sanitizationStrategy: (NoSanitization | ProductionSanitization) ----- Cheers, Sean -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html |
Free forum by Nabble | Edit this page |