JuliaReinforcementLearning / GridWorlds.jl

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

simplify & standardize makie rendering of objects #29

Closed Sid-Bhatia-0 closed 3 years ago

Sid-Bhatia-0 commented 3 years ago

This pull request is to simplify the Makie rendering process for objects. Instead of manually dispatching each object type (apart from Agent) using if statements and rendering it separately, this branch implements a default consistent rendering for an object (based on its character representation, as is done previously).

A change that occurs with respect to the previous rendering is that walls are now :white (implied by its get_color method), as opposed to being :darkgray earlier. Note that this default implementation can be easily overridden by explicitly checking for a particular object type. For example, in this case, we could add an if statement to check for a Wall and manually set the color to :darkgray. However, I feel that :white doesn't look too bad (in my humble opinion :smile: )

Overall, I believe this buys us a cleaner code and a consistent rendering across Makie and the terminal.

Screenshot from 2020-10-08 21-01-25 Screenshot from 2020-10-08 21-00-53

codecov-io commented 3 years ago

Codecov Report

Merging #29 into master will increase coverage by 0.93%. The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #29      +/-   ##
==========================================
+ Coverage   41.04%   41.98%   +0.93%     
==========================================
  Files          10       10              
  Lines         268      262       -6     
==========================================
  Hits          110      110              
+ Misses        158      152       -6     
Impacted Files Coverage Δ
src/render_with_Makie.jl 0.00% <0.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 b0a2d74...b0aa011. Read the comment docs.

findmyway commented 3 years ago

This looks great!