Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defer(?) operations #72

Open
MaanooAk opened this issue Oct 5, 2019 · 1 comment
Open

Defer(?) operations #72

MaanooAk opened this issue Oct 5, 2019 · 1 comment
Labels
c++ involves C++ code nice new thing ☺ adds new functionality specification involves the nyan language specification

Comments

@MaanooAk
Copy link
Contributor

MaanooAk commented Oct 5, 2019

Example:

Archer(Unit):
    firerate : float = 0

Crossbowman(Archer)
    firerate = 12

Longbowman(Archer):
    firerate = 10


ThumbRing(Technology):
    ThumbRing1<Longbowman>():
        firerate *= 1.2
    ThumbRing2<Crossbowman>():
        firerate *= 1.2

    patches = {ThumbRing1, ThumbRing2}

This is the correct solution so far, am I wrong ?

If you try to do this:

ThumbRing<Archer>(Technology):
    firerate *= 1.2

Then the stack of calculation would be:

firerate = 0
firerate *= 1.2
firerate = 10
  V
firerate = 10

However there could be something like defer which would move the operation to the end:

ThumbRing<Archer>(Technology):
    firerate defer *= 1.2

And then there would be two stucks:

firerate = 0
defer firerate *= 1.2
firerate = 10
                                   V       
firerate = 0
firerate = 10
firerate *= 1.2
                                   V                   
firerate = 10
firerate *= 1.2
                                   V
firerate = 12
@TheJJ TheJJ added nice new thing ☺ adds new functionality specification involves the nyan language specification c++ involves C++ code labels Oct 5, 2019
@TheJJ
Copy link
Member

TheJJ commented Oct 5, 2019

Good idea, that could be a solution to something we worked around with the API itself (through a bonus system that is applied "last" in the stack in the c++ engine implementation).

This defer flag even works with inherited patches: They add their calculation part to the "end" of the stack one after the other starting at the top (as this is how the patch application is chained).

We have to think a bit about unforseen consequences, although just now it seems like a great idea 😄 . We should evaluate other syntactical variants of this though, especially in sight of future directions the nyan language may head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ involves C++ code nice new thing ☺ adds new functionality specification involves the nyan language specification
Projects
None yet
Development

No branches or pull requests

2 participants