Comments (7)
Just to clarity, what is arr[2] in your second example supposed to be? Should be it be 0, 4, 8, ...
or 0, 2, 4, ...
(i.e. same as arr[1])? In the current implementation it would be the latter.
Edit:
The second option probably doesn't make much sense but just to be sure....
from compiler.
I would think the first one. If you want the second do:
new arr[10][20] = {{0, 1, 2, ...}, {0, 2, 4, ...}, {0, 2, 4, ...}, ...};
As with one dimension {0, 1, 1} to fill with almost all 1s using just the last two specified values.
from compiler.
Forgive me for the dumb question, but I'm still kind of trying to figure out how to calculate arr[2]
via arr[0]
and arr[1]
, so far I came up with this:
d = diff_2 - diff_1
arr[2] = { arr[1][0] + d, arr[1][1] + d, ...}
where diff_1
and diff_2
are the differences between the elements of arr[0]
and arr[1
] respectively. And the question is:
Does this look like the correct formula? I'm asking because this would yield arr[2]
as 0, 3, 6
instead of 0, 4, 8
like I wrote before.
Edit:
If instead we do
d = diff_2 / diff_1
arr[2] = { arr[1][0] * d, arr[1][1] * d, ...}
I believe this would give 0, 4, 8
as intended. Still not sure what to do here: for the 1d case we subtracted/added things, but here we are dividing/multiplying (kind of confusing).
from compiler.
I would expect {0, 3, 6}, since the increase is linear.
from compiler.
Actually, I would do it:
arr[0][2] = arr[0][1] + diff(arr[0][0], arr[0][1]); // As in 1-d.
arr[2][0] = arr[1][0] + diff(arr[0][0], arr[1][0]); // Same in the other dimension
arr[2][1] = arr[1][1] + diff(arr[0][1], arr[1][1]);
Thus:
arr[2][2] = arr[2][1] + diff(arr[2][0], arr[2][1]);
Which gives:
{{0, 1, 2, 3, 4,...}, {0, 2, 4, 6, 8, ...},{0, 3, 6, 9,12, ...}}
from compiler.
Seems working now, if you need an executable for testing you can download it here:
https://ci.appveyor.com/project/Zeex/pawn/branch/master/artifacts
from compiler.
Awesome, thanks.
from compiler.
Related Issues (20)
- Packed string access in enum arrays
- Optimization of conditional expressions
- Can't compile on linux! HOT 2
- when to wait for the next build? HOT 1
- Classes and objects in PAWN? HOT 3
- Compiler giving false positive warnings (240) HOT 4
- Named only parameters. HOT 3
- External natives are always in the header, even when not used. HOT 2
- Constant "Run time error 19: "File or function is not found"" error
- default include path for standard libraries? HOT 1
- The Application was unable to start correctly.(0xc000007b) HOT 1
- fatal error 100: cannot read from file: "Pawn.CMD" HOT 1
- fatal error 100: cannot read from file: "interception"
- [DIY] Build from source on Apple Chip M1 using rosetta2 HOT 6
- `initialization data exceeds declared size` when using progressive initialization with an array size 1
- `const` can be specified for a function argument more than once
- error compile
- pawnc reports wrong filenames and line numbers on warning number 203 & 213
- Some weird error appeared using my custom build of dev branch... unlike official builds from omp(from the released server archive) or the regular community build (this repo's released build)
- Some weird error appeared using my custom build of dev branch... unlike official builds from omp(from the released server archive) or the regular community build (this repo's released build) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compiler.