The “Fundamentals of Programming” course employs a blended learning model that integrates online resources with offline instruction to enhance students’ self-directed learning and practical skills. Powered by knowledge graphs, the curriculum enables personalized learning paths where students autonomously design their study plans, while instructors dynamically adjust teaching strategies based on learning data to achieve precision education. The gamified practice platform transforms grammar training into immersive gaming experiences, significantly boosting learning engagement and practical retention. The teaching strategy adopts tiered cultivation, combining macro-level projects with micro-level knowledge points to strengthen computational thinking and practical abilities. Implementation results demonstrate improved mastery of knowledge points, continuous enhancement of coding and debugging skills, and markedly strengthened learning motivation. This model creates a closed-loop system for knowledge transfer and competency development, laying a solid foundation for subsequent specialized courses. It embodies innovative concepts of knowledge graph-driven learning, gamified practice, and tiered cultivation, effectively fostering students’ self-directed learning drive and critical thinking.