FreeOrion

Forums for the FreeOrion project
It is currently Tue Oct 17, 2017 8:27 pm

All times are UTC




Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Mon Oct 24, 2016 1:10 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 11999
Location: Munich
em3 wrote:
My 2c: Value could be made of type with __add__ and __radd__ methods overloaded...
Note that the current implementation has arbitrary parameters for what value = is set to... it can be just Value, or Value + 5, or Max(Value, 5), or Value*3 + 1, or sin(Value^log(Value)), or various other complicated expressions... Point being, don't just think of needing to overload the add methods due to that being the most common case.


Top
 Profile  
 
PostPosted: Mon Oct 24, 2016 1:55 pm 
Offline
Vacuum Dragon
User avatar

Joined: Sun Sep 25, 2011 2:51 pm
Posts: 500
Geoff the Medio wrote:
Note that the current implementation has arbitrary parameters for what value = is set to... it can be just Value, or Value + 5, or Max(Value, 5), or Value*3 + 1, or sin(Value^log(Value)), or various other complicated expressions... Point being, don't just think of needing to overload the add methods due to that being the most common case.

I just wanted to note, that example created by adrian_bother could be discouraging to some people because of the syntax:
Code:
Set("Detection", Add(Value, 10))
, and that it can be simplified - actual arithmetic operation could be used instead of the lengthy "functions", like Add, Multiply etc. Granted, some of these functions would have to stay (Max, Sin, Log, ...).

I understand, that designing everything about potential foss replacement in python is a bit too soon, as far as this discussion is concerned. I just wanted to make it sound like a better idea to people that would be bothered by the implied complexity.

_________________
[...] for Man has earned his right to hold this planet against all comers, by virtue of occasionally producing someone totally batshit insane. - Randall Munroe, title text to xkcd #556


Top
 Profile  
 
PostPosted: Tue Oct 25, 2016 12:07 am 
Offline
Space Squid

Joined: Mon Aug 27, 2012 7:24 pm
Posts: 54
Effects groups could be made callable. That would eliminate any special handling or typing requirements.
Code:
Special(
    name = "WORLDTREE_SPECIAL",
    description = "WORLDTREE_SPECIAL_DESC",
    stealth = 0,
    spawnrate = 1.0,
    spawnlimit = 1,
    location = lambda planet: (
        isinstance(planet, Planet)
        and (planet.planet_type not in [PlanetType.Asteroids, PlanetType.GasGiant, PlanetType.Inferno])
        and (planet.size not in [PlanetSize.TINY, PlanetSize.HUGE])
        and not (within_starlane_jumps(planet, jumps=2, condition=lambda system: (
            isinstance(system, System)
            and not [planet2 for planet2 in system.planets if planet2.owner]
            )))),
)

_________________
All contributions are submitted under GPL or LGPL v2 or later, or under appropriate Creative Commons licence, consistent with project guidlines.


Top
 Profile  
 
PostPosted: Tue Oct 25, 2016 10:07 am 
Offline
Vacuum Dragon
User avatar

Joined: Sun Sep 25, 2011 2:51 pm
Posts: 500
spikethehobbit wrote:
Effects groups could be made callable. That would eliminate any special handling or typing requirements.
Code:
[...]

I think the whole point is for effects to not be executed in python, just constructed from python scripts (compiled into already existing engine structures).

_________________
[...] for Man has earned his right to hold this planet against all comers, by virtue of occasionally producing someone totally batshit insane. - Randall Munroe, title text to xkcd #556


Top
 Profile  
 
PostPosted: Wed Oct 26, 2016 2:35 am 
Offline
Space Squid

Joined: Mon Aug 27, 2012 7:24 pm
Posts: 54
em3 wrote:
spikethehobbit wrote:
Effects groups could be made callable. That would eliminate any special handling or typing requirements.
Code:
[...]

I think the whole point is for effects to not be executed in python, just constructed from python scripts (compiled into already existing engine structures).


Fair enough.

_________________
All contributions are submitted under GPL or LGPL v2 or later, or under appropriate Creative Commons licence, consistent with project guidlines.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group