Documentation
- License
- Artificial Assymetric Intelligence
- Psyop Detection
- Graph Based Naive Bayes
- Decision Ambiguity
- Collisikekkenshiki
- Distribute Nervoussystem And Dynamic Reward Allocation
- Shortest Path Between Statistics
- Intelligent Ultra Compressed Autonomous Agent
- Daticesupe: Concepts For Nightmare Solstice
- Selection By Vortex
- Maximum Read, Minimum Write
- Expanding On Containerization
BASIC CONCEPTS
INTERMEDIATE CONCEPTS
Maximum Global Read, Minimum Write Access
When you here people say never use global variable, there is a lot of extra information they're excluding that is a software way to enforce good practice.
As A General Rule
Any variable defined in a string, integer, float, array, or hash should be defined inside of a constant if defined outside of a module or class. This includes immortal symbols.
Any variable defined locally should have maximum read access in its own dominion, but no ability to read variables outside its own function, with the exception of global variables.
Global variables are initialized by constants, but you never modify the constant directly. You can think of this like a bucket and pond, you can never deplete the pond ( in most cases, except on an industrial scale ). These can be used across the program, as you're never directly interacting with the constant. These are "moderate read, moderate write".
Here is an example ruby program based on variable access priviledge.
$INTIALIZE_GLOBAL_DAY_COUNT = 0
$TRUE_HP_LEVEL_1 = 15
$TRUE_HP_LEVEL_2 = 32
$TRUE_HP_LEVEL_3 = 76
module Game
class Environment
def self.initialize
@current_day = $INITIALIZE_GLOBAL_DAY_COUNT
@possible_hp_resets = [$TRUE_HP_LEVEL_1,
$TRUE_HP_LEVEL_2,
$TRUE_HP_LEVEL_3]
@player_level = 0
end
def self.operation
if @current_day == 30
@current_day = $INITIALIZE_GLOBAL_DAY_COUNT
puts "The lunar calender has reset to zero."
else
if @player_level == 0
current_hp_reset = @possible_hp_resets[0]
@current_day = @current_day + 1
elsif @player_level == 1
current_hp_reset = @possible_hp_resets[1]
@current_day = @current_day + 1
elsif @player_level == 2
current_hp_reset = @possible_hp_resets[2]
@current_day = @current_day + 1
else
current_hp_reset = @possible_hp_resets[0]
@current_day = @current_day + 1
end
end
end
end
end