xxxxxxxxxx
266
let scene = 1
let introbg
let secondbg
let thirdbg
let sudokuGrid = [];
let symbols = ["✽", "✿", "✤", "★", "♡", "✄", "☭", "ﷲ" , "ء"];
//let names = ["ﷲ" ," ٱللَّٰهِ","ٱلرَّحِيمِ","ٱلرَّحْمَٰنِ","بِسْمِ"]; //array/list of allah's names
let names = [
"الله", "الرَّحْمن", "الرَّحِيم", "المَلِك", "الْقُدُّوس", "السَّلَام", "المُؤْمِن", "الْمُهَيْمِن",
"الْعَزِيز", "الْجَبَّار", "الْمُتَكَبِّر", "الْخَالِق", "الْبَارِئ", "الْمُصَوِّر", "اَلْغَفَّار",
"الْقَهَّار", "الْوَهَّاب", "الرَّزَّاق", "الْفَتَّاح", "الْعَلِيم", "الْقَابِضُ", "الْبَاسِطُ",
"الخافض", "الرَّافِعُ", "المعز", "المذل", "السَّمِيعُ", "الْبَصِير", "الْحَكَم", "العدل", "اللَّطِيفُ",
"الْخَبِيرُ", "الْحَلِيمُ", "الْعَظِيمُ", "الْغَفُورُ", "الشَّكُورُ", "الْعَلِيُّ", "الْكَبِيرُ",
"الْحَفِيظُ", "المُقِيت", "الْحَسِيبُ", "الجليل", "الْكَرِيمُ", "الرَّقِيبُ", "الْمُجِيبُ", "الْوَاسِعُ",
"اَلْحَكِيمُ", "الْوَدُودُ", "الْمَجِيدُ", "الباعث", "الشَّهِيدُ", "الْحَقُّ", "الْوَكِيلُ", "الْقَوِيّ",
"الْمَتِينُ", "الْوَلِيُّ", "الْحَمِيدُ", "الـمُحصِي", "المبدئ", "المعيد", "المُحيي", "المميت",
"الْحَيُّ", "الْقَيُّومُ", "الواجد", "الماجد", "الْوَاحِدُ", "الصَّمَدُ", "الْقَادِرُ", "الْمُقْتَدِرُ",
"الْمُقَدِّمُ", "الْمُؤَخِّرُ", "الْأَوَّلُ", "الْآخِرُ", "الظَّاهِرُ", "الْبَاطِنُ", "الوالي",
"الْمُتَعَالِ", "الْبَرُّ", "التَّوَّابُ", "الْمُنْتَقِمُ", "العَفُو", "الرَّؤُوفُ", "مَالِكُ الْمُلْكِ",
"ذُو الْجَلَالِ وَالْإكْرَامِ", "المقسط", "الْجَامِعُ", "الْغَنِيُّ", "المغني", "الْمُعْطِي", "المانع",
"الضار", "النافع", "النُّورُ", "الْهَادِي", "الْبَدِيعُ", "الباقي", "الْوَارِثُ", "الرشيد", "الصبور"
];
let explanations = [
"الله: وهو الاسم الأعظم الذي تفرد به الحق سبحانه وخص به نفسه وجعله أول أسمائه، وأضافها كلها إليه فهو علم على ذاته سبحانه. Allah: It is the greatest name that is unique to Allah, the Almighty, and He made it the first of His names, and He added them all to Himself, so it is a name for His Self, the Almighty.",
"الرَّحْمن: كثير الرحمة وهو اسم مقصور على الله عز وجل ولا يجوز أن يقال رحمن لغير الله، وذلك لأن رحمته وسعت كل شيء وهو أرحم الراحمين. Al-Rahman: The Most Merciful, and it is a name limited to Allah, the Almighty, and it is not permissible to say “Rahman” to anyone other than Allah, because His mercy encompasses everything, and He is the Most Merciful of the merciful.",
"الرَّحِيم: هو المنعم أبدا، المتفضل دوما، فرحمته لا تنتهي. Al-Raheem: He is the One who is always generous, always kind, and His mercy is endless.",
"المَلِك: هو الله، ملك الملوك، له الملك، وهو مالك يوم الدين، ومليك الخلق فهو المالك المطلق. Al-Malik: He is Allah, the King of Kings, His is the kingdom, and He is the Owner of the Day of Judgment, and the King of creation, so He is the absolute Owner.",
"الْقُدُّوس: هو الطاهر المنزه عن العيوب والنقائص وعن كل ما تحيط به العقول. Al-Quddus: He is the Pure One, free from faults and shortcomings and from everything that the minds encompass.",
"السَّلَام: هو ناشر السلام بين الأنام وهو الذي سلمت ذاته من النقص والعيب والفناء. Al-Salam: He is the One who spreads peace among mankind, and He is the One whose Self is free from deficiency, defect, and annihilation.",
"المُؤْمِن: هو الذي سلم أوليائه من عذابه، والذي يصدق عباده ما وعدهم. Al-Mu’min: He is the One who saves His friends from His punishment, and He fulfills what He promised His servants.",
"الْمُهَيْمِن: هو الرقيب الحافظ لكل شيء، القائم على خلقه بأعمالهم، وأرزاقهم وآجالهم، والمطلع على خفايا الأمور وخبايا الصدور. Al-Muhaymin: He is the Watcher and Preserver of everything, who is in charge of His creation with their deeds, their provisions and their terms, and who is aware of the hidden matters and the secrets of the hearts.",
"الْعَزِيز: هو المنفرد بالعزة، الظاهر الذي لا يقهر، القوي الممتنع فلا يغلبه شيء وهو غالب كل شيء. Al-Aziz: He is the One who is unique in glory, the Manifest who is not defeated, the Strong and Invincible, so nothing can defeat Him and He is the Victorious over everything.",
"الْجَبَّار: هو الذي تنفذ مشيئته، ولا يخرج أحد عن تقديره، وهو القاهر لخلقه على ما أراد. Al-Jabbaar: He is the One whose will is enforced, and no one goes outside His estimation, and He is the One who subdues His creation as He wills.",
"الْمُتَكَبِّر: هو المتعالي عن صفات الخلق المنفرد بالعظمة والكبرياء. Al-Muttakkabbir: He is the One who is exalted above the attributes of creation, unique in greatness and pride.",
"الْخَالِق: هو الفاطر المبدع لكل شيء، والمقدر له والموجد للأشياء من العدم، فهو خالق كل صانع وصنعته. Al-Khaliq: He is the Initiator and Originator of everything, and the One who determines it and brings things into existence from nothing, so He is the Creator of every maker and his creation.",
"الْبَارِئ: هو الذي خلق الخلق بقدرته لا عن مثال سابق، القادر على إبراز ما قدره إلى الوجود. Al-Bari’: He is the One who created creation with His power and not from a previous example, and is able to bring forth what He has determined into existence.",
"الْمُصَوِّر: هو الذي صور جميع الموجودات، ورتبها فأعطى كل شيء منها صورة خاصة، وهيئة منفردة، يتميز بها على اختلافها وكثرتها. Al-Musawwir: He is the One who formed all existences and arranged them, giving each thing a special image and a unique form, which distinguishes it despite its differences and abundance.",
"المُقِيت: هو المتكفل بإيصال أقوات الخلق إليهم وهو الحفيظ والمقتدر والقدير والمقدر والممدد. Al-Muqīt. The Provider: He is the One who is responsible for delivering the sustenance of creation to them. He is the Preserver, the Powerful, the Mighty, the Estimator, and the Provider.",
"الْحَسِيبُ: هو الكافي الذي منه كفاية العباد وهو الذي عليه الاعتماد يكفي العباد بفضله. al-Ḥasīb. The Reckoner: He is the Sufficient One from whom the servants are sufficient. He is the One upon whom the servants depend. He is sufficient for them by His grace.",
"الجليل: هو العظيم المطلق المتصف بجميع صفات الكمال والمنعوت بكمالها المنزه عن كل نقص. al-Jaleel. The Majestic: He is the Absolute Great One, characterized by all the attributes of perfection and described by their perfection, free from all deficiency.",
"الْكَرِيمُ: هو الكثير الخير الجواد المعطي الذي لا ينفد عطاؤه وهو الكريم المطلق الجامع لأنواع الخير والشرف والفضائل المحمود بفعاله. Al-Kareem: He is the One who is abundant in goodness, the Generous, the Giver, whose giving never runs out. He is the Absolutely Generous, the One who encompasses all types of goodness, honor, and virtues, and is praised for His actions.",
"الرَّقِيبُ: هو الرقيب الذي يراقب أحوال العباد ويعلم أقوالهم ويحصي أعمالهم وهو الحافظ الذي لا يغيب عنه شيء. Al-Raqeeb: He is the Watcher who watches over the conditions of His servants, knows their words, and counts their deeds. He is the Preserver from whom nothing is hidden.",
"الْمُجِيبُ: هو الذي يجيب دعاء من دعاه، وسؤال من سأله، ويقابله بالعطاء والقبول، ولا يُسأل أحد سواه. Al-Mujeeb: He is the One who answers the supplication of whoever calls upon Him, and the question of whoever asks Him, and meets it with giving and acceptance, and no one is asked except Him.",
"الْوَاسِعُ: هو الذي وسع رزقه جميع خلقه، وسعت رحمته كل شيء المحيط بكل شيء. Al-Wasee’: He is the One whose provision has expanded to all of His creation, and His mercy has expanded to everything, encompassing everything.",
"اَلْحَكِيمُ: هو المحق في تدبيره اللطيف في تقديره الخبير بحقائق الأمور العليم بحكمه المقدور فجميع خلقه وقضاه خير وحكمة وعدل. Al-Hakeem: He is the One who is just in His management, gentle in His estimation, knowledgeable of the truths of matters, and knowledgeable in His predestined judgment, so all of His creation and His judgment are good, wise, and just.",
"الْوَدُودُ: هو المحب لعباده، والمحبوب في قلوب أوليائه. Al-Wadud: He is the One who loves His servants, and is beloved in the hearts of His friends.",
"الْمَجِيدُ: هو الله تمجَّد بفعاله، ومجَّده خلقه لعظمته، والمجيد هو واسع الكرم، ووصف نفسه بالمجيد وهو متضمن كثرة صفات كماله وسعتها، وعدم إحصاء الخلق لها، وسعة أفعاله وكثرة خيره ودوامه. Al-Majid: He is God, glorified by His actions, and His creation glorified Him for His greatness. Al-Majid is the One with vast generosity, and He described Himself as the Glorious, which includes many ranks. His perfection and vastness, and the innumerability of creation, and the vastness of His actions and the abundance of His goodness and perpetuity.",
"الباعث: هو باعث الخلق يوم القيامة، وباعث رسله إلى العباد، وباعث المعونة إلى العبد. Al-Ba'ith: He is the One who will resurrect creation on the Day of Resurrection, and the one who will send His messengers to the servants, and the one who will send aid to the servant.",
"الشَّهِيدُ: هو الحاضر الذي لا يغيب عنه شيء، فهو المطلع على كل شيء مشاهد له عليم بتفاصيله. Al-Shahid: He is the one who is present from whom nothing is hidden, for He is the one who is aware of everything, watching it and knowing its details.",
"الْحَقُّ: هو الذي يحق الحق بكلماته ويؤيد أولياءه فهو المستحق للعبادة. Al-Haqq: He is the one who establishes the truth with His words and supports His guardians, so He is the one who deserves worship.",
"الْوَكِيلُ: هو الكفيل بالخلق القائم بأمورهم فمن توكل عليه تولاه وكفاه، ومن استغنى به أغناه وأرضاه. Al-Wakeel: He is the guarantor of creation, who is in charge of their affairs, so whoever relies on Him, He takes care of him and suffices him, and whoever is content with Him, He enriches him and satisfies him.",
"الْقَوِيّ: هو صاحب القدرة التامة البالغة الكمال غالب لا يُغلب فقوته فوق كل قوة، ولا يرد قضاءه راد، ينفذ أمره، ويمضي قضاؤه في خلقه، شديد عقابه لمن كفر بآياته وجحد حججه. Al-Qawy: He is the one who has complete power that is the ultimate in perfection, the victorious, who cannot be defeated, for His power is above all power, and no one can repel His judgment, He executes His command, and His judgment goes forward in His creation, severe in punishment for whoever disbelieves in His signs and denies His proofs.",
"الْمَتِينُ: هو الشديد الذي لا يحتاج في إمضاء حكمه إلى جند أو مدد ولا إلى معين، فهو المتناهي في القوة، التي لا تلحق أفعاله مشقة، ولا يمسه فيها لغوب. Al-Mateen: He is the Strong One who does not need soldiers, reinforcements, or a helper to implement His rule. He is the One with the utmost strength, whose actions are not burdensome, and who is not affected by fatigue.",
"الْوَلِيُّ: هو المحب الناصر لمن أطاعه، ينصر أولياءه، ويقهر أعداءه، والمتولي الأمور الخلائق ويحفظهم. Al-Wali: He is the One who loves and supports those who obey Him. He supports His friends, subdues His enemies, and is in charge of the affairs of creation and protects them.",
"الْحَمِيدُ: هو المستحق للحمد والثناء له منتهى الحمد وأطيبه على ذاته وصفاته وعلى نعمه التي لا تحصى. Al-Hamid: He is the One who deserves praise and commendation. He has the utmost and best praise for Himself, His attributes, and His countless blessings.",
"الْمُتَعَالِ: هو الذي جل عن إفك المفترين، وتنزه عن وساوس المتحيرين. Al-Muta'al: He is the One who is exalted above the lies of the slanderers, and is far removed from the whispers of the perplexed.",
"الْبَرُّ: هو العطوف على عباده ببره ولطفه، ومن على السائلين بحسن عطائه، وهو الصدق فيما وعد. Al-Barr: He is the One who is compassionate towards His servants with His kindness and gentleness, and bestows His good gifts upon those who ask, and He is the Truthful in what He promised.",
"التَّوَّابُ: هو الذي يوفق عباده للتوبة حتى يتوب عليهم ويقبل توبتهم فيقابل الدعاء بالعطاء، والتوبة بغفران الذنوب. Al-Tawwab: He is the One who guides His servants to repentance so that He may accept their repentance and respond to supplication with gifts, and repentance with forgiveness of sins.",
"الْمُنْتَقِمُ: هو الذي يقصم ظهور الطغاة، ويشدد العقوبة على العصاة، وذلك بعد الإعذار والإنذار. Al-Muntaqim: He is the One who breaks the backs of tyrants and intensifies punishment for the disobedient, after giving excuses and warnings.",
"العَفُو: هو الذي يترك المؤاخذة على الذنوب ولا يذكرك بالعيوب فهو يمحو السيئات ويتجاوز عن المعاصي. Al-'Afw: He is the One who leaves accountability for sins and does not remind you of your faults, so He erases the bad deeds and overlooks the transgressions.",
"الرَّؤُوفُ: هو المتعطف على المذنبين بالتوبة، الذي جاد بلطفه ومَنَّ بتعطفه، يستر العيوب ثم يعفو عنها. Al-Ra'uf: He is the One who is compassionate towards the sinners with repentance, who is generous with His kindness and bestows His compassion, covering up the faults and then forgiving them.",
"مَالِكُ الْمُلْكِ: هو المتصرف في ملكه كيف يشاء لا راد لحكمه، ولا معقب لأمره. Mālik-ul-mulk. The Owner of the Kingdom: He is the One who disposes of His Kingdom as He wishes. There is no one who can reverse His judgment, nor can He question His command.",
"ذُو الْجَلَالِ والْإكْرَامِ: هو المنفرد بصفات الجلال والكمال والعظمة، المختص بالإكرام والكرامة وهو أهل لأن يجل. Ḏū l-Jalāli wa l-ʾIkrām. The Possessor of Majesty and Honor: He is the One who is unique in His attributes of majesty, perfection, and greatness. He is the One who is distinguished by honor and dignity, and He is worthy of being honored.",
"المقسط*: هو العادل في حكمه، الذي ينتصف للمظلوم من الظالم، ثم يكمل عدله فيرضي الظالم بعد إرضاء المظلوم. al-Muqsiṭ. The Just*: He is the One who is just in His judgment, who takes revenge for the oppressed against the oppressor, then completes His justice and satisfies the oppressor after satisfying the oppressed.",
"الْجَامِعُ: هو الذي جمع الكمالات كلها، ذاتا ووصفا وفعلا، الذي يجمع بين الخلائق المتماثلة والمتباينة، والذي يجمع الأولين والآخرين. al-Jāmiʿ. The Gatherer: He is the One who gathered all perfections, in essence, description, and action, who brings together similar and dissimilar creatures, and who brings together the first and the last.",
"الْغَنِيُّ: هو الذي لا يحتاج إلى شيء، وهو المستغني عن كل ما سواه، المفتقر إليه كل من عاداه. al-Ghāniyy. The Rich: He is the One who does not need anything, and He is independent of everything other than Him, and everyone who opposes Him is in need of Him.",
"المغني*: هو معطي الغنى لعباده، يغني من يشاء غناه، وهو الكافي لمن شاء من عباده. al-Mughniyy. The Enricher*: He is the Giver of wealth to His servants, He enriches whomever He wills with His wealth, and He is sufficient for whomever He wills of His servants.",
"الْمُعْطِي المانع*: هو الذي أعطى كل شيء، ويمنع العطاء عن من يشاء ابتلاء أو حماية. Al-Muti al-Māniʿ. The Giver and the Withholder*: He is the One who gives everything and withholds giving from whomever He wills as a test or protection.",
"الضار* النافع*: هو المقدر للضر على من أراد كيف أراد، والمقدر النفع والخير لمن أراد كيف أراد كل ذلك على مقتضى حكمته سبحانه. aḍ-Ḍār an-Nāfiʿ. The Harmer* and the Benefactor*: He is the One who decrees harm upon whomever He wills however He wills, and He decrees benefit and goodness for whomever He wills however He wills, all of that according to His wisdom, glory be to Him.",
"النُّورُ: هو الهادي الرشيد الذي يرشد بهدايته من يشاء فيبين له الحق، ويلهمه اتباعه، الظاهر في ذاته، المظهر لغيره. an-Nūr. The Light: He is the Rightly Guided One who guides with His guidance whomever He wills, showing him the truth and inspiring him to follow it, the Manifest in His Essence, the Manifester for others.",
"الْهَادِي: هو المبين للخلق طريق الحق بكلامه يهدي القلوب إلى معرفته، والنفوس إلى طاعته. al-Hādī. The Guide: He is the One who shows creation the path of truth with His words, guiding hearts to His knowledge and souls to His obedience.",
"الْبَدِيعُ: هو الذي لا يماثله أحد في صفاته ولا في حكم من أحكامه، أو أمر من أموره، فهو المحدث الموجد على غير مثال. al-Badīʿ. The Innovator: He is the One to whom no one is comparable in His attributes, nor in any of His rulings, nor in any of His affairs, for He is the Originator, the Originator without an example.",
"الباقي*: هو وحده له البقاء، الدائم الوجود الموصوف بالبقاء الأزلي، غير قابل للفناء فهو الباقي بلا انتهاء. al-Bāqī. The Eternal*: He alone has permanence, the everlasting existence described as eternal permanence, not subject to destruction, so He is the Eternal without end.",
"الْوَارِثُ: هو الأبقى الدائم الذي يرث الخلائق بعد فناء الخلق، وهو يرث الأرض ومن عليها. Al-Warith: He is the Everlasting, the Eternal, who inherits the creation after the creation perishes, and He inherits the earth and whoever is on it.",
"الرشيد*: هو الذي أسعد من شاء بإرشاده، وأشقى من شاء بإبعاده، عظيم الحكمة بالغ الرشاد. Al-Rashid*: He is the One who makes happy whomever He wills by guiding him, and makes miserable whomever He wills by distancing him, of great wisdom and perfect guidance.",
"الصبور*: هو الحليم الذي لا يعاجل العصاة بالنقمة، بل يعفو ويؤخر، ولا يسرع بالفعل قبل أوانه. Al-Sabūr*: He is the Forbearing, who does not hasten to punish the disobedient, but rather pardons and delays, and does not rush to do something before its time.",
];
//let explanations = [
// "bismi",
// "arrahmani",
// "arrahimi",
// "allahi",
// "allahu"
// ]
let explanation
let colors = ["#f9ec00", "#f47920", "#e21d3c", "#583f99", "#9a258f", "#17479e", "#00addc", "#ed1846", "#ffffff"];
let selectedSymbols = [];
let selectedColors = [];
let btn;
let inpt; //holds the textbox
let name; //will hold the chosen name
function preload(){
introbg = loadImage("m_bg1i.png")
secondbg = loadImage("m_bg1.png")
thirdbg = loadImage("m_bg1g.png")
}
function setup() {
createCanvas(450, 450);
textAlign(CENTER, CENTER);
textSize(27);
rectMode(CENTER)
inpt = createInput("What would you like to attract?");
// Button for generating a new Sudoku
btn = createButton('***********');
// btn.position(width/2 - 100, height - 130);
btn.mousePressed(generateNewSudoku);
}
function draw(){
if(scene == 1){
image(introbg, 0, 0, 450, 450)
fill(255)
noStroke()
// rect(width-25, height/2, 50, 50)
// rect(25, height/2, 50, 50)
} else if(scene == 2){
image(secondbg, 0, 0, 450, 450)
fill(255)
noStroke()
rect(width-25, height/2, 50, 50)
rect(25, height/2, 50, 50)
drawSudoku();
} else if(scene == 3){
image(thirdbg, 0, 0, 450, 450)
fill(255)
noStroke()
rect(width-25, height/2, 50, 50)
rect(25, height/2, 50, 50)
fill('#ffaee2')
rect(width/2, height/2, 300, 300)
fill('#b8eea4')
text(explanation, width/2, height/2, 300, 300)
// textSize(18)
stroke(255)
}
}
function mousePressed(){
if(scene == 1 && dist(mouseX, mouseY, width-25, height/2) < 25){
// scene = 2
} else if(scene == 2 && dist(mouseX, mouseY, 25, height/2) < 25){
scene = 1
btn.show()
inpt.show()
} else if(scene == 2 && dist(mouseX, mouseY, width-25, height/2) < 25){
scene = 3
} else if(scene == 3 && dist(mouseX, mouseY, 25, height/2) < 25){
scene = 2
} else if(scene == 3 && dist(mouseX, mouseY, width-25, height/2) < 25){
scene = 1
btn.show()
inpt.show()
}
}
function generateNewSudoku() {
btn.hide();
inpt.hide();
name = random(names); //choosing a 'random'
explanation = explanations[names.indexOf(name)]
selectedSymbols = shuffle(symbols).slice(0, 9); // Pick 9 random symbols
selectedColors = shuffle(colors).slice(0, 9); // Pick 9 random colors
sudokuGrid = generateSolvedSudoku(); // Generate a new solved grid
scene = 2
}
function drawSudoku() {
fill(0);
rect(width/2, height/2, 300, 300 )
textSize(18)
for (let row = 0; row < 9; row++) {
for (let col = 0; col < 9; col++) {
// make sudoku smaller or bigger
let x = col * 31.5;
let y = row * 31.5;
let num = sudokuGrid[row][col];
fill(selectedColors[num - 1]);
if(selectedSymbols[num-1] == "ﷲ"){
textSize(81)
x = col * 50;
y = row * 50;
text(name, x+20.5, y+20.5)
} else {
textSize(18)
text(selectedSymbols[num - 1], x + 100, y + 100);
}
}
}
}
function generateSolvedSudoku() {
// Initialize empty 9x9 grid
let grid = Array.from({ length: 9 }, () => Array(9).fill(0));
// Fill the diagonal 3x3 blocks
for (let i = 0; i < 9; i += 3) fillDiagonalBlock(grid, i, i);
// Backtrack to fill the entire grid
solveSudoku(grid);
return grid;
}
function fillDiagonalBlock(grid, row, col) {
let nums = shuffle([1, 2, 3, 4, 5, 6, 7, 8, 9]);
for (let i = 0; i < 3; i++) {
for (let j = 0; j < 3; j++) {
grid[row + i][col + j] = nums.pop();
}
}
}
function solveSudoku(grid) {
let emptyPos = findEmpty(grid);
if (!emptyPos) return true; // Solved
let [row, col] = emptyPos;
for (let num = 1; num <= 9; num++) {
if (isSafe(grid, row, col, num)) {
grid[row][col] = num;
if (solveSudoku(grid)) return true;
grid[row][col] = 0; // Backtrack
}
}
return false;
}
function findEmpty(grid) {
for (let i = 0; i < 9; i++) {
for (let j = 0; j < 9; j++) {
if (grid[i][j] === 0) return [i, j];
}
}
return null;
}
function isSafe(grid, row, col, num) {
for (let x = 0; x < 9; x++) {
if (grid[row][x] === num || grid[x][col] === num) return false;
}
let startRow = row - row % 3, startCol = col - col % 3;
for (let i = 0; i < 3; i++) {
for (let j = 0; j < 3; j++) {
if (grid[i + startRow][j + startCol] === num) return false;
}
}
return true;
}