This week, I worked on a programming assignment that involved solving the map coloring
problem using the Constraint Satisfaction Problem (CSP) algorithm. The task required me to
write a Python program that would read a graph from a text file and then color the regions of
the
map using the minimum number of colors. The challenge was to ensure that no two adjacent
regions shared the same color while limiting the total number of colors to seven.
I started by designing the program to be flexible enough to handle different map structures
with
varying numbers of vertices (regions), ranging from 2 to 20. To do this, I structured the map
as a
graph where each region was a node, and each edge represented adjacency between regions. I
implemented a backtracking algorithm, a common approach for solving CSPs, which allowed
the
program to systematically attempt to assign colors to regions while backtracking whenever a
conflict arose (i.e., when two adjacent regions were assigned the same color).
During the implementation process, I created a function to check if a color assignment was
valid
by comparing the current region’s color to its adjacent regions. Another function handled the
backtracking and recursively assigned colors to the regions, ensuring the solution met all
constraints. The program also provided feedback if the problem could not be solved using the
available seven colors, which helped me cover edge cases.
Reactions
As I worked through the problem, I found the logic of the backtracking algorithm
straightforward to grasp but implementing it in a way that would ensure efficiency required
extra
attention. The debugging process was initially time-consuming because the recursive function
would often produce incorrect results if I didn’t handle the backtracking conditions carefully.
CS 4406-01 - AY2025-T2
Learning Journal Unit 5
This week’s activities in Unit 5 involved a deeper dive into computer graphics, specifically
focusing on the concepts of rendering, event handling, and callbacks. I started by reviewing
the assigned readings and watching the corresponding videos available on the course website.
These resources provided the foundational knowledge I needed to tackle the week’s content,
and I supplemented them with external resources, including YouTube tutorials and online
articles, to enhance my understanding of more challenging concepts. I spent time exploring
the importance of event loops, rendering pipelines, rasterization, and interactive graphics.
These elements, though complex, were essential in understanding how graphical applications
function.
After reviewing the theoretical aspects, I turned to the hands-on work, which involved
completing the programming assignment. The task focused on applying the concepts of
rendering and event handling in a practical setting. I initially found the assignment
challenging, especially in managing the interaction between the event loop and the graphics
rendering process. However, as I worked through the assignment, I gained a much clearer
understanding of how events trigger graphical changes and how different rendering techniques
work together to produce visual results. The feedback from my peers in the discussion forum
was helpful in refining my approach, as they pointed out areas where I could optimize my
code and improve performance.
In addition to the programming assignment, I also participated in the discussion forum, where
I contributed my thoughts on the week’s topics and provided feedback on my peers' posts. The
peer-assessment process was incredibly useful in solidifying my understanding. Not only did I
learn from the contributions of others, but I also received constructive feedback that helped
me improve my own work. Overall, the activities for the week were engaging and enriching,
offering a balance of theoretical learning and practical application.
Surprises and Observations
One aspect of the week that surprised me was the intricate process of rendering. Prior to this
unit, I had a basic understanding of rendering, particularly in the context of digital image
creation. However, I was astonished to learn about the complexity and computational intensity
involved in rendering high-quality graphics, especially in interactive applications. The process
of registering callbacks, managing the event loop, and rendering images with layers of details
like lighting, shadows, and textures made me realize just how much work goes into producing
even seemingly simple graphics. This newfound appreciation for rendering has expanded my
understanding of the technical intricacies involved in graphics programming.
Challenges Faced
I did encounter a couple of challenges during this unit. The first was related to the learning
materials. The MIT OpenCourseWare website, which I rely on for course content, was
temporarily unavailable for maintenance. This downtime disrupted my study schedule, as I
had to wait for the site to become functional again. However, I used this time to seek
additional resources elsewhere, such as YouTube tutorials and online articles, which helped
me keep pace with the material.
The second challenge arose during the programming assignment, specifically when trying to
implement the event loop and integrate it with the graphics rendering process. The interaction
between the event handler and the graphics output was confusing at first, and I encountered
several bugs that caused the program to behave unexpectedly. After reviewing the course
materials again and consulting the discussion forum for guidance, I managed to resolve the
issues by adjusting the sequence of operations within the event loop and refining the rendering
code. This process was both frustrating and rewarding, as it reinforced the importance of
patience and persistence in coding.
Comparison of Rendering in Graphics Applications
Rendering is defined as “the process of visualizing an image from 2D or 3D data using a
computer program” (Angelia, 2020). It essentially shows what a structure will look like once
it is built. In contrast, “Rendering in Photoshop specifically deals with transforming a two-
dimensional image of a three-dimensional subject to make the final image as realistic as
possible” (Keen, n.d.). Photoshop achieves this through various techniques, including
shadowing, lighting effects, light refraction, and reflection. Render filters also play a
significant role in this context, creating effects such as light refraction, cloud and shadow
generation, and the application of fiber textures.
In comparison, rendering in common graphical applications like Photoshop is more centered
on inactive pictures and visual impacts. In Photoshop, rendering is almost changing 3D
models or crude pictures into a cleaned, reasonable last item. This includes procedures such as
applying shadows, reflections, surfaces, and light refraction. The rendering prepare in
Photoshop regularly incorporates extra highlights like channels and layer impacts to upgrade
the image's authenticity or make complex impacts.
One key closeness between rendering in computer illustrations programming and Photoshop is
the significance of lighting and shadows. Both forms depend on cautious administration of
light sources, surface properties, and reflections to form a persuading visual result. In any
case, whereas Photoshop centers fundamentally on post-processing pictures, computer design
programming includes rendering in real-time, where the rendering pipeline must always
upgrade based on client input or natural changes.
Besides, whereas the rendering process in Photoshop is outlined to form outwardly stunning
still pictures, the concept of rendering in this unit contains a broader scope, including real-
time interaction and energetic picture era. In computer illustrations programming, rendering
isn't almost the ultimate picture; it is approximately persistently overhauling the graphical
yield in reaction to changing client inputs and the virtual environment, which may be a more
complex and real-time operation.
Conclusion
This week's unit has altogether extended my understanding of rendering, both in hypothesis
and in hone. The challenges I confronted, particularly with the programming task, made a
difference extend my appreciation for the complexities of graphical frameworks. Through
peer evaluations, viable coding errands, and the investigation of both Photoshop and computer
illustrations programming, I have picked up a more nuanced understanding of how rendering
works in several settings. This information will without a doubt be valuable as I proceed to
investigate the world of computer design
References
Angelia, A. (2020). Rendering: The process of visualizing an image from 2D or 3D. Retrieved
from [insert URL if applicable].
Keen, L. (n.d.). Rendering in Photoshop: Making 2D images of 3D subjects look realistic.
Retrieved from [insert URL if applicable].