JuliaReinforcementLearning / GridWorlds.jl

Help! I'm lost in the flatland!
MIT License
47 stars 9 forks source link

Cleanup naming convention #75

Closed Sid-Bhatia-0 closed 3 years ago

Sid-Bhatia-0 commented 3 years ago

Clean up naming convention. Use env to represent an instance of AbstractGridWorld (instead of w or 'gw`) because it represents an environment. This is consistent with the rest of the packages in the ecosystem.

codecov-io commented 3 years ago

Codecov Report

Merging #75 (aad3c67) into master (23f9514) will increase coverage by 0.26%. The diff coverage is 92.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #75      +/-   ##
==========================================
+ Coverage   70.81%   71.07%   +0.26%     
==========================================
  Files          14       14              
  Lines         490      491       +1     
==========================================
+ Hits          347      349       +2     
+ Misses        143      142       -1     
Impacted Files Coverage Δ
src/grid_world_base.jl 72.09% <0.00%> (ø)
src/render_in_terminal.jl 0.00% <0.00%> (ø)
src/abstract_grid_world.jl 87.50% <86.36%> (ø)
src/envs/collectgems.jl 100.00% <100.00%> (ø)
src/envs/doorkey.jl 100.00% <100.00%> (+1.85%) :arrow_up:
src/envs/dynamicobstacles.jl 100.00% <100.00%> (ø)
src/envs/emptygridworld.jl 100.00% <100.00%> (ø)
src/envs/fourrooms.jl 100.00% <100.00%> (ø)
src/envs/gotodoor.jl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 23f9514...aad3c67. Read the comment docs.

Sid-Bhatia-0 commented 3 years ago

To formulate a consistent naming convention, I also propose the following:

  1. Use env to represent environments.
  2. Use w as the shorthand for world to consistently represent instances of GridWorldBase (right now some files use both world and w within the same file to represent instances of GridWorldBase (already containing a world field, see point 3. below)
  3. Change field-name world of GridWorldBase struct to something like grid. The scope of the word world is a little vague and thus is overused in several different contexts. So GridWorldBase would become something like the following:
    struct GridWorldBase{O} <: AbstractArray{Bool, 3}
    grid::BitArray{3}
    objects::O
    end

    The word grid seems more appropriate than world to represent a multi-dimensional array. (and grid also gels with the Grid part of GridWorlds) Then the name world (or its shorthand w as is already used at several places) can be used to represent an entity that contains:

  4. A grid field (a multi-dimensional array representing the layout of the world) and
  5. An objects field (a tuple of objects present in the world)