Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
title: "DMP’25 Week 10 Update by Justin Charles"
excerpt: "Finalized brick connection infrastructure in the workspace and began defining AST parsing constraints for mapping between Masonry and program representation"
category: "DEVELOPER NEWS"
date: "2025-08-10"
slug: "2025-08-10-dmp-25-justin212407-week10"
author: "@/constants/MarkdownFiles/authors/justin-charles.md"
tags: "dmp25,sugarlabs,week10,justin212407"
image: "assets/Images/c4gt_DMP.webp"
---

<!-- markdownlint-disable -->

# Week 10 Progress Report by Justin Charles

**Project:** Music Blocks 4 Masonry
**Mentors:** [Anindya Kundu](https://github.com/meganindya/), [Sumit Srivastava](https://github.com/sum2it)
**Assisting Mentors:** [Devin Ulibari](https://github.com/pikurasa/), [Walter Bender](https://github.com/walterbender)
**Reporting Period:** 2025-08-04 - 2025-08-10

---

## Goals for This Week

- Complete the **brick connection infrastructure** in the workspace
- Define **AST parsing constraints** for converting between Masonry representation and program AST

---

## This Week’s Highlights

### 1. **Brick Connection Infrastructure Completed**

- **Workspace Presentation**
- Computed absolute coordinates of all incoming connection points (expression-right, statement-bottom, compound-inner-top) whenever a tower is added.
- Reverse map utility converts notch IDs into `{BrickId, TowerId}` references.
- Optimized for performance by recomputing only towers/bricks that change.

- **Collision Maps**
- Created two separate maps:
- **Expression Map** → stores expression-brick notch coordinates
- **Statement Map** → stores statement-brick notch coordinates
- Each map indexes by unique **Notch ID**, reverse-mapped to brick and tower ownership.

- **Collision Detection**
- On drag-start, remove dragged brick/tower notch coords to prevent self-matching.
- On each mouse-move, check outgoing notches against map entries.
- Overlapping notch pairs are logged as *potential connections* via reverse mapping.
- Example: standalone brick connecting to a tower uses the parent brick model (via reverse map) to identify exact position.

---

### 2. **AST Parsing Discussions**

- Defined constraints for **AST ↔ Masonry conversions**:
- Each **Brick ID** in Masonry must map directly to an **AST Node ID** for consistency.
- Constants and rules established for parsing tree hierarchies from visual blocks to program representation.
- Ensured that parsing is bidirectional: Masonry → AST for execution, AST → Masonry for reconstruction.

- Clarified how the tree structure should be preserved while respecting parent-child and tower relationships.

---

## Challenges & Solutions

**Challenge:** Keeping connection maps efficient while supporting continuous drag.
**Solution:** Limited recomputation scope to only changed towers/bricks, combined with quadtree partitioning.

**Challenge:** Ensuring AST parsing rules remain flexible yet consistent with brick model.
**Solution:** Established a shared ID system and constants for mapping, ensuring robust future conversions.

---

## Key Learnings

- **Collision Map Architecture**
Gained hands-on experience designing performant quadtree-based collision maps.

- **Reverse Mapping Importance**
Saw how a utility mapping notch IDs to `{BrickId, TowerId}` streamlines both collisions and merges.

- **AST Consistency**
Understood the importance of keeping **brick IDs == AST IDs** to prevent desync during parsing.

---

## Next Week’s Roadmap

- Complete brick connections with on merge effects.
- Parse the AST from masonry to program according to the constraints defined in the previous meetings.

---

## Resources & References

- [musicblocks-v4 Branch (with the work)](https://github.com/sugarlabs/musicblocks-v4/tree/gsoc-dmp-2025/week-9/justin)
- [musicblocks-v4 Repository](https://github.com/sugarlabs/musicblocks-v4)
- [Quadtree Algorithm Notes](https://en.wikipedia.org/wiki/Quadtree)

---

## Acknowledgments

Thanks to my mentors for guiding me through both the technical and architectural aspects of connection logic and AST design.