|
| 1 | +--- |
| 2 | +title: "DMP’25 Week 10 Update by Justin Charles" |
| 3 | +excerpt: "Finalized brick connection infrastructure in the workspace and began defining AST parsing constraints for mapping between Masonry and program representation" |
| 4 | +category: "DEVELOPER NEWS" |
| 5 | +date: "2025-08-10" |
| 6 | +slug: "2025-08-10-dmp-25-justin212407-week10" |
| 7 | +author: "@/constants/MarkdownFiles/authors/justin-charles.md" |
| 8 | +tags: "dmp25,sugarlabs,week10,justin212407" |
| 9 | +image: "assets/Images/c4gt_DMP.webp" |
| 10 | +--- |
| 11 | + |
| 12 | +<!-- markdownlint-disable --> |
| 13 | + |
| 14 | +# Week 10 Progress Report by Justin Charles |
| 15 | + |
| 16 | +**Project:** Music Blocks 4 Masonry |
| 17 | +**Mentors:** [Anindya Kundu](https://github.com/meganindya/), [Sumit Srivastava](https://github.com/sum2it) |
| 18 | +**Assisting Mentors:** [Devin Ulibari](https://github.com/pikurasa/), [Walter Bender](https://github.com/walterbender) |
| 19 | +**Reporting Period:** 2025-08-04 - 2025-08-10 |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## Goals for This Week |
| 24 | + |
| 25 | +- Complete the **brick connection infrastructure** in the workspace |
| 26 | +- Define **AST parsing constraints** for converting between Masonry representation and program AST |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## This Week’s Highlights |
| 31 | + |
| 32 | +### 1. **Brick Connection Infrastructure Completed** |
| 33 | + |
| 34 | +- **Workspace Presentation** |
| 35 | + - Computed absolute coordinates of all incoming connection points (expression-right, statement-bottom, compound-inner-top) whenever a tower is added. |
| 36 | + - Reverse map utility converts notch IDs into `{BrickId, TowerId}` references. |
| 37 | + - Optimized for performance by recomputing only towers/bricks that change. |
| 38 | + |
| 39 | +- **Collision Maps** |
| 40 | + - Created two separate maps: |
| 41 | + - **Expression Map** → stores expression-brick notch coordinates |
| 42 | + - **Statement Map** → stores statement-brick notch coordinates |
| 43 | + - Each map indexes by unique **Notch ID**, reverse-mapped to brick and tower ownership. |
| 44 | + |
| 45 | +- **Collision Detection** |
| 46 | + - On drag-start, remove dragged brick/tower notch coords to prevent self-matching. |
| 47 | + - On each mouse-move, check outgoing notches against map entries. |
| 48 | + - Overlapping notch pairs are logged as *potential connections* via reverse mapping. |
| 49 | + - Example: standalone brick connecting to a tower uses the parent brick model (via reverse map) to identify exact position. |
| 50 | + |
| 51 | +--- |
| 52 | + |
| 53 | +### 2. **AST Parsing Discussions** |
| 54 | + |
| 55 | +- Defined constraints for **AST ↔ Masonry conversions**: |
| 56 | + - Each **Brick ID** in Masonry must map directly to an **AST Node ID** for consistency. |
| 57 | + - Constants and rules established for parsing tree hierarchies from visual blocks to program representation. |
| 58 | + - Ensured that parsing is bidirectional: Masonry → AST for execution, AST → Masonry for reconstruction. |
| 59 | + |
| 60 | +- Clarified how the tree structure should be preserved while respecting parent-child and tower relationships. |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## Challenges & Solutions |
| 65 | + |
| 66 | +**Challenge:** Keeping connection maps efficient while supporting continuous drag. |
| 67 | +**Solution:** Limited recomputation scope to only changed towers/bricks, combined with quadtree partitioning. |
| 68 | + |
| 69 | +**Challenge:** Ensuring AST parsing rules remain flexible yet consistent with brick model. |
| 70 | +**Solution:** Established a shared ID system and constants for mapping, ensuring robust future conversions. |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +## Key Learnings |
| 75 | + |
| 76 | +- **Collision Map Architecture** |
| 77 | + Gained hands-on experience designing performant quadtree-based collision maps. |
| 78 | + |
| 79 | +- **Reverse Mapping Importance** |
| 80 | + Saw how a utility mapping notch IDs to `{BrickId, TowerId}` streamlines both collisions and merges. |
| 81 | + |
| 82 | +- **AST Consistency** |
| 83 | + Understood the importance of keeping **brick IDs == AST IDs** to prevent desync during parsing. |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | +## Next Week’s Roadmap |
| 88 | + |
| 89 | +- Complete brick connections with on merge effects. |
| 90 | +- Parse the AST from masonry to program according to the constraints defined in the previous meetings. |
| 91 | + |
| 92 | +--- |
| 93 | + |
| 94 | +## Resources & References |
| 95 | + |
| 96 | +- [musicblocks-v4 Branch (with the work)](https://github.com/sugarlabs/musicblocks-v4/tree/gsoc-dmp-2025/week-9/justin) |
| 97 | +- [musicblocks-v4 Repository](https://github.com/sugarlabs/musicblocks-v4) |
| 98 | +- [Quadtree Algorithm Notes](https://en.wikipedia.org/wiki/Quadtree) |
| 99 | + |
| 100 | +--- |
| 101 | + |
| 102 | +## Acknowledgments |
| 103 | + |
| 104 | +Thanks to my mentors for guiding me through both the technical and architectural aspects of connection logic and AST design. |
0 commit comments