All right, so welcome back and we are talking about how to pray for people who are lost. We said that usually when we are praying for those who are unbelievers, there is something more than praying to the Father because there is also Satan and we have to fight the devil. And we said that he deceives people, he keeps them in bondages and that he will try to oppose the proclamation of the Gospel. So how exactly to go about you know, releasing these people is the question. But one more thing we have to understand as a church, right, when we say you are the church, I am the church, that means each and every one of us is a part of the church, okay. So all of us are the church and when we look at the scriptures in the Word of God, we see that the church is a very powerful entity. So when we think about the church, do we consider it powerful or weak? Powerful. The church is powerful, right. How are we saying it's powerful because sometimes we have only small gatherings, some churches have only 5 people, 10 people, how is it powerful or maybe they don't have a lot of money. So how are you saying church is powerful, spiritually that's right. So spiritually according to the work that God has done, the church, meaning whenever we say the church, think about yourself, I am the church, right, you are the church. We are powerful as far as God is concerned. Why are we powerful because God has called the church to be the light in the darkness. So we are the light in the darkness.   Wouldn't that be nice because everything Jesus has done on the cross, why should we be here on earth and struggle but there is a reason why we are still here. One is we are growing, maturing to become more like Jesus. One is there is an assignment or there is some work that God is giving all of us. If there is no assignment, no work, just go to heaven, right, be happy. Jesus did everything, all the blessings are mine, just be happy but we have to do a work. As the church, God is calling us to be that light, okay, that's why we are still here and we need to understand, there are many scriptures, I am not going to go through all those scriptures. One passage we can read that is Isaiah 61 verses 1 and 2, Isaiah 61 verses 1 and 2. So if anybody is there, you can go ahead, open it and read it aloud please. Yeah, Isaiah 61 verses 1 and 2, you can read, okay, yes, you can read, Isaiah 61, yes, the spirit of the Lord God is upon me because the Lord has anointed me to preach good tidings to the poor, he has sent me to heal the broken hearted to proclaim liberty to the captives and the opening of the prison to those who are bound. To proclaim the acceptable year of the Lord and the day of vengeance upon God to comfort all who mourn. Yes, so in this passage, thank you sister, we see that Jesus, you know, later on in Luke chapter 4, Jesus said the same passage when he started the ministry. So he opened the book of the law and then he started reading in the synagogue and he read this passage Isaiah 61 and he said, the spirit of the Lord is upon me to proclaim the good news to the poor, to set the captives free. So he goes on to state that. So what we understand here is, when the Holy Spirit is upon us, we will proclaim the good news. We will set the captives free or we will set the prisoners free. Who are the prisoners, who are the prisoners, captives, sinners, yeah, sinners or unbelievers, in other words. So what we recognize here is that the church has a responsibility, why are we still here on earth? We have a big responsibility and that responsibility is we have to proclaim the gospel to the people. We have to set the captives free, that is our job and we need to understand that this authority has been given to the church. What if the church doesn't do it or if you and I don't do it, who will do it? Who will do it? We are only supposed to do it, right? So we have to understand this, when we talk about people are lost, you know, so many people don't know about God, there are so many unreached people groups in the world, we talk about all these things. But whose responsibility is it to go and preach the gospel to all of them? We, because the great commission has been given to us and Jesus is authorizing us to be the light to the people who are in darkness, for us to set the captives free. Those who are prisoners, we are the ones who are supposed to set them free. So what I want us to recognize today is, yes, pray for the lost, but remember that you and I carry the authority. So it's going to be so sad if we have the authority and we did not use it at all, right? To bring people to Christ. So use that authority to set people free. So we are carrying kingdom authority, we have spiritual weapons, okay, we will read about weapons and all later when you read about believers authority. But do you know that you have some spiritual weapons? What weapons do you have? Some guns and some, you know, danda and everything, no? So what weapons are you carrying as a believer? I can't hear what weapons you have, Asapu, speaking in tongues, faith, word of God, prayer, okay, Jesus, the name of Jesus, right? Yeah, so many of these things that you've listed come under the category of weapons. So when you speak the word of God, how did Jesus fight the devil when the devil came? He was fasting for 40 days, right?  What did Jesus do? He fought the devil. How? Word of God. He said, it is written, Satan, it is written like this. So he spoke the word of God, after sometime the devil was like, okay, leave me alone, I'm going, bye, right? So you can fight the devil with some spiritual weapons and Jesus gives the weapons to the church, we have the weapons, imagine, right? Like let's say the thief comes to somebody's house and they have all the weapons, right?  So as believers, the point that I'm trying to make is, you know, we don't realize how powerful Christ has made us.  Just use the weapons, use the name of Jesus against the devil, use the word of God against the devil, use the power of the blood of Jesus against the devil and say, devil, stop it, I'm already victorious, you can't do this, right? So as a church, we have to wake up because we have been given the authority, we have been given the weapons, in fact, it's the devil who should be running around because he's scared, oh, these people will attack me, he should know that we can attack him. You got it? So we are so powerful as far as who Jesus has made us, but we need to take our position. What is the use of a soldier who doesn't fight? Imagine somebody is a soldier, right? But goes home, nicely sleeping, eating, enjoying his life, war is going on, but soldier is enjoying his life. What's the use? No use. Weapon is there, authority is there, everything is there, but not using it, that's the problem. So when especially we pray for the unbelievers, those who are lost, those who are not saved, we have to take up our position and say, we will not let you do this, devil, okay? By the Spirit of God, in the name of Jesus, we are coming against you and you have to let the prisoners go free. So it's a fight and we have to engage in that fight. How do we exercise our authority against the devil? Tell me, weapons are there, use the weapons, what else can we do? Anything else we can do? Spiritual warfare. Prayer, yes we can pray, good, yeah. What else we can do? We are fighting the devil, how are you going to fight the devil? Okay, use the authority, how to use it? Does the Bible say anything? Command, okay, command, okay, good. There is one particular passage, okay, Matthew 16 verses 18 and 19, where Jesus said, I give you the keys of the kingdom, whatever you bind on earth will be bound in heaven, whatever you lose on earth will be lost in heaven. So how to exercise our authority, you know what we can do? We can bind, we can lose. So how do we do that? It's very simple, when we see that there are, you know, something the devil is doing, we can as, you know, Daniel just said command, we can command the devil and we can say I bind you in the name of Jesus, okay, I stop you, these are all words we can use to use the authority. Now if we don't use our authority, you know, it's actually our fault because we are letting the devil do whatever he wants to do, you got it? So just bind the devil, if you see the devil is doing something, we'll come to that.  So generally, you know, some things of the kingdom of God, we say that we are losing it on people's lives, got it? So bind the devil and lose the works of the kingdom on the people. So when we say things like that, you will understand that, you know, it's really powerful and it works. So this is one way to use the authority. Second way to use the authority is in second Corinthians 10, verses three to six, it says taking every thought captive, which exalts itself against the knowledge of God. So that means, you see, can one wrong thought be harmful? My question to you, just one wrong thought, every thought is correct according to the Bible. Only one wrong thought, is that dangerous or is it okay? Dangerous? Why? Why is it dangerous? Just one wrong thought, no? One wrong belief we have. Think about the garden of Eden, okay? How many mistakes did they make? Only one mistake. The whole earth is now corrupted with sin because God is so holy, even one tiny mistake good enough for us to fall short of his glory, right? We just fell from his glory, but just one mistake because God is so pure and so holy that it just cannot accommodate even one wrong thought. You got it? So in second Corinthians 10, what we just saw, we need to take every thought captive, right? Which exalts itself against the knowledge of God. So always be mindful of what we are thinking because what is the battleground for the devil? The mind. So that is where he gets us and we have to be careful and here we are learning one way of exercising authority is to pull down the wrong thoughts. So when we are praying against the devil, we can pray something like this wrong thought or this deception. I tear it down in the name of Jesus. Got it? And how we can exercise authority, bind, lose, tear down, pull down. These are the words that you can use. So imagine, okay, we are fighting against the devil. We are praying for somebody, that person is lost. That person is, okay, imagine, maybe my family member, a young man, he is not saved. He is into all kinds of worldly things and maybe he is into some addictions and I am praying, maybe my brother and I am praying for my brother, right? So how do I fight the devil? How will it sound when I am fighting the devil for my brother? How will the prayers sound? So I am exercising authority on behalf of him. So how will I pray? Just use all the weapons, right, against the devil. It's okay to get angry with the devil, right? So when you are fighting, you are praying, it may sound like fighting. Because you are saying, devil, I will, I am coming against you in the name of Jesus. I won't let you do this. In my brother's life, I bind every deceptive spirit, I bind every spirit of confusion, I bind every spirit of anxiety, every spirit of fear in the name of Jesus. I command every demonic stronghold in his life to be broken in the name of Jesus. So you are literally shouting, screaming, fighting the devil. Okay, doesn't sound like ordinary prayer. How does your usual prayer sound when you pray to the Heavenly Father? A little more mellow, a little more calm, right? The Heavenly Father, that's how we pray. But when we are doing spiritual warfare, we're talking to the devil. Got it? So you can be angry, no problem. Just stop him. Say, you can't do this. I'm coming against you. Okay, so that's how it should be. We have to take our position and pray for the people whom the devil is binding and making them as prisoners. If we don't do that, who will do that for them? So we have to engage in spiritual warfare for the people. And here is one more thing. To exercise our authority, one more thing what we can do is, we can tell the devil what Jesus has done on the cross and he doesn't like it. Okay? He just doesn't like it. I don't know if any of you, when you are casting out demons, you observe this. You know, when you start saying Jesus has won the victory on the cross, the person whoever is, you know, demon person, they'll be like, no, stop it. I don't want to hear that. Okay, I don't want to hear it because Satan does not want to hear about the victory of Jesus on the cross. So then we should do it more because he doesn't like it. So we start to say, 2000 years ago, Jesus has defeated you, devil, you have no authority. You have no power.  So I speak to you in the name of Jesus. I command you in the name of Jesus. So this is the way spiritual warfare has to go on for somebody who is lost. So start to do this. See, we all go for outreaches, right?  One is we are praying, God, you work in their lives, you bless them. All that's nice. You're praying to the Father. On the other hand, we have to do some spiritual warfare and say, come on, whatever spirits are working behind them, you have no chance.  We ask for open doors in the name of Jesus. So when we pray for people who are lost, it's a spiritual activity. You have to combine praying for them and fighting with Satan. That's the right way of doing it. Okay. So as we do this, what can we expect? What can we expect? Yeah, victory. But how may it look like, let's imagine, okay? We are going to some area to do outreach. The first time we go there, there's a lot of opposition. Then we are also praying before we go. We are praying for them. We are doing spiritual warfare and we are going. Maybe we are praying for one month. What can you expect on the ground where you're doing outreach? Some changes, hopefully, right? Some changes, some new opportunity, maybe favor from one person. They say, okay, you come, no problem. You preach, right? You see, it's never easy because the devil will not let us do it. He'll create some trouble. So when we fight against the devil, we pray hard and then we go. What we are doing is we are pushing. Spiritually, we are pushing into those places. So even when we talk about church planting, right? Some of you want to be pastors, right? That time we will talk about one of the stages of church planting, which is to take time in prayer and spiritual warfare. Because in that region where we are going to plant the church, we have to overcome the demonic strongholds in that place. Then the work of our ministry can go strong. If we don't do spiritual warfare, actually, there will be demonic opposition, but we won't be able to do our work effectively. You got it? So it is a very important aspect of any form of outreach ministry, right? We need to pray, we need to engage in spiritual warfare, destroy the work of the devil and then go inside, okay? So now we have understood how to pray against the devil. Now how to pray to God for the people? What prayers can we make to God for the people? The devil will say, okay, we stop you. This is what Jesus has done. You are defeated, all that we tell the devil. What do we pray to God? Any prayers to God? Prayer of deliverance, sister. Prayer of deliverance, okay? Sure, yeah, yeah. Prayer of deliverance, fine. Yeah, we can ask the Father to set them free. That's correct. Anything else, any other points? Holy Spirit can speak to them through dreams and visions. True, so in John chapter 16 verses 7 through 11, the Bible says that the work of the Holy Spirit is to convict people of sin, righteousness and judgment. So you're right, sister Gertrude, it's the work of the Holy Spirit to help them understand. So sometimes what do we do when people are not born again in our families? We try to behave like the Holy Spirit, right? We try to convict them, we tell them, you're so wrong, God will never bless you. You never come to church, you are like this, you are like that. We are trying to condemn them. Does that help? See, if you don't believe in Jesus, you're going to hell, right? Some people say like that also. But will that encourage them to become a believer? No, so if we nag them, if we scold them, if we condemn them, it won't work. Instead of that, what we can do is, we can say, Holy Spirit, you speak to them. Because in John 16, it says, the work of the Holy Spirit is to convict. In the heart, the Holy Spirit will go and speak to them and say, what you're doing is not correct. This path is not correct. So let the Holy Spirit speak to them. We should not condemn them. Understood? So yes, sister Gertrude, so we can pray and say, Holy Spirit, speak to them. Speak to their hearts. So you will be so amazed when you see God working in their lives. We are praying for them, quietly. But God is working in their lives, right? In an amazing way. They'll come back with all kinds of testimonies. So at one point, I was praying for one person. And this sister, she was just not listening, right?  Not at all listening. So I was just praying for her. And especially in that one season, it was amazing because she was coming back to me and sharing some testimonies. She said something like, I had gone traveling and she likes museums and things like that. So there was a museum there. She went to the museum and the museum had butterflies. It had butterflies. All kinds of butterflies and all that. So she came back and told me, can you know what? I was so feeling so sad, but that day I found a museum. I went to the museum and it had butterflies. And I felt like she's telling me, okay, she doesn't believe in God, nothing. She's telling me. I felt maybe God is asking me to change because what is the meaning of butterfly? Usually the butterfly, it changes, right? From a caterpillar into a butterfly. So she felt like God is speaking to her just by visiting that museum and telling her that you need to change. So she came and told me. So I was so amazed. I was like, oh, my prayers are working. I need to pray more. See, it's better to pray than to keep condemning them. You guide them, that's nice. But most of the time, what believers end up doing is we put people down and we say, God will never bless you. You're so unholy, so many things we say, but that's not how we should do it. Just pray for them, pray for them. Ask the Holy Spirit. Holy Spirit, you speak to them and Holy Spirit will speak in their hearts. So this is a prayer which we can pray. Holy Spirit, you speak to them, you convict them. We can ask God, God, they are far away from you. You bring them close to yourself. Can we pray that? Yes, so many stories are there like that. I remember one person, one of my friends, her family members, one by one, they started, they gave their life to Christ. This girl, she never listened. She was just doing her own thing all the time. Everyone else is saved except her.  Something amazing happened. One night, when she was sleeping, she had a dream. In that dream, she saw a beautiful sea and she's walking on the beach and Jesus came. Jesus was also walking with her and she asked him, what do you want, Jesus? Do you want to tell me something? Then Jesus told her, why are you running away from me? And then as if Jesus is sharing his love with her and saying, I am the one who has wiped away your sins and I have great plans for your life but you are running away from me. She had that in her dream. She just woke up in the morning and she's like, that fear of God came on her. She became a believer. Today, she and her husband, they are pastors and they are serving in a particular country. So amazing things happen when we pray for people. They are so far away from God but you ask God to work in their life and say, God, you bring them close to you. We don't know how you will do it. Maybe a dream, a vision or send somebody to come and speak to them about the love of Jesus or through some experience, something. God, you do something. Bring them close to you. We can pray such prayers. And surely God answers, he hears these prayers. Then we can also pray that God give them good knowledge, help them to understand. They are not understanding. They are speaking all kinds of worldly philosophies but you set them free from those philosophies. Maybe in their mind they have some thoughts that God doesn't like me or God will never bless me. It is stuck in their heads. So we pray, God remove all those wrong philosophies, patterns of thinking. We break it in the name of Jesus, give them good knowledge, help them understand who you are, what you have done for them. So pray like this. When you pray like this, slowly they'll begin to understand. What Jesus has done for them. Pray that God will give them the understanding of their calling. You know what? Sometimes people, one very sad incident that happened to me, I think maybe I shared with you. I was talking to one young person and I said, okay, tell me what do you want to do after the few years? And the young person looked at me and said, I don't know. So I was like, why something, there must be something you want to do, right?  I'm just living. There's no meaning, there's no purpose. I felt so sad. I was like, I can't believe it that people are living like that. Anything, I'll do anything, whatever happens tomorrow, let it happen.  So we can pray and we can say, God, give them the understanding. What do you want from their life? Help them to wake up, right? So that they know their calling. Think about Apostle Paul.  You have to be a minister of the gospel.  He was living for that. So everybody has a call from God. We can pray and say, God, this young person or this person is so far away from you, but help them understand. Why did you create them? What is the purpose of their lives? Then they will be able to, you know, once they know it, they can live for God, okay? So that is another prayer we can pray. We can also pray that God will send more people. You remember Jesus said, pray to the God of the harvest to send more laborers. So we need more people doing the ministry work, right? So when I say more people doing God's work, I don't mean full-time ministry. You can even be in the workplace, but you can be a, you know, you can be a minister of God, but we can ask God, you put people in their lives who are believers so that they can speak to them about Jesus. Even in my own experience, I've seen that for the people whom I pray for, it's amazing. They suddenly meet some believers and they have some conversations. They won't, see, when we say the same thing, they may not listen, but when God puts them in a place where there are other believers and they speak to them, maybe they might listen, right? So in this way, what God does is, he starts to get their attention. Got it? So we can pray, Lord, send more and more people to speak about you in this person's life, where they are working, you know, where they are studying, where they are doing other things. Lord, let them meet believers. Let them sow the word of God in their lives. Pray like that. Then you will find that they'll come back to you with some testimonies. We can also pray for supernatural encounters. Okay? Supernatural encounters, miracles, signs, wonders. So it's when miracles happen that, you know, it helps people realize there is a God. Okay? It saves people from their, whatever, addictions or their behaviors and all that. And then they start to live for God. There are so many such testimonies that even I have heard where, you know, somebody got healed and because they got healed, they started believing in Jesus or they got delivered, right? And they started believing or they were trusting God for a miracle. The miracle happened. So they started believing. So there is one particular family that comes to our location and they have an amazing testimony. So one sister, she had a very serious sickness when she was in, I think school, high school, college, something like that, around that age. And they are not Christians. So they used to believe in some baba and you know, pray and all that. So that's how they were. But they did not find healing anywhere. So one day, I think on the radio, on the radio, somebody is talking about Jesus, Jesus heals, Jesus will set you free, just pray to Jesus. He will, you know, heal you from any sickness, something like that. So that uncle, that sister's dad, those days, he was so desperate, he didn't care which God it was. The moment he heard that on the radio, he told her, okay, come, we'll pray to this Jesus because nobody healed you. At least let this Jesus heal you. And they prayed, she got healed. Okay, she's now, she with her family, they attend.  So everyone became believers and that uncle, right? That sister's dad is such a strong believer. Every time we spend time with him, he'll have some encounter to share. Like when he spent a lot of time in prayer, what were some of the experiences that he had, so strong in the Lord, so strong in the Lord. But how did it happen? One miracle, one healing. It changed their whole life. Okay, so the point that I'm trying to make is, we can ask God, God, you do a miracle in their life, then they will believe. Tell me if a miracle happens, who won't believe? Isn't it? A healing, a deliverance, something, amazing. So we can say, God, this is how we want you to touch them. So pray all these prayers and God will minister to them. We can, finally, just a few thoughts and then I will close. So, pray against the devil, break every stronghold, fight the devil, pray to God, to send people, give dreams, Holy Spirit, to convict them, so many things. So in both of these ways, we pray and trust that people's lives can be transformed. You remember that story of Franklin Graham, last class, I told us, Billy Graham's son, he was not in the Lord, but yeah, how he came to the Lord and his life was changed.  There are so, so many testimonies. Isn't it? So many testimonies where God changes the entire direction of somebody's life once they are born again. Okay? So we need to trust God for that. When we look at this man called as Caleb in the Bible, Caleb, you know Joshua and Caleb? Okay, Joshua Caleb. So Caleb, he had asked for a mountain when finally the Israelites get their promised land, he had asked God to give him one piece of the land known as, it is no, the name of that land is Kirjat Arba. Okay, that's the, whatever, I don't know what language, yeah, some language. Okay? So it's Kirjat Arba, that land. But the meaning of that land is the land of giants. The land of giants or where like big people, scary people live. So can you imagine? Caleb prayed for a land. God gave him a land, but that land had giants. Now what are you going to do?  Now you have to fight the giants, right? And you have to get them out. Only then you can occupy that place. But the beautiful thing is that land which was given to Caleb, later on, it was called as Hebron. The name of that place changed. Hebron means a place of friendship because what happened after Caleb took the land is that they would send people who are outlaws or, you know, those who are sent away from the city or banished from the community. Those people, maybe they are weak, they are not very good, such people, right? They say, okay, you leave the community and they have no place to go to. They used to go to this place, Hebron and they used to make their living there. So it became a city of friendship or it became a city of refuge. Refuge means when we don't have any shelter, we find shelter somewhere, okay? That is refuge. So the understanding is that even a land which is occupied by giants can become a place of refuge. When God works. So bringing this thought to people who are unsaved. Now we may look at our land and say, oh, people here don't know about God, you know, they worship other gods, they do this, they do that.  We may say things like that, but you see when you trust God, when we trust God, even the land of the giants can become a place where those who don't have anywhere to go, they can come here, it can become a place of refuge, okay? So God can do that. God can not only touch one life, but he can transform the entire land. He can transform the entire city. But we as believers, we need to rise up because we have the authority. Yes or no? We have the authority, correct? And we can do spiritual warfare, we can pray to the Father, okay? In this way, we can see many, many people saved. So I just wanna encourage us, even our daily prayer for those who are unsaved or maybe outreaches, right? We all engage in outreaches, right?  Without prayer, we won't get the victory, okay? You can do very good outreach, smart ideas, all PowerPoints, this and that, but there is a spiritual aspect. Unless we pray, take authority on those demonic spirits, you can't see the victory, okay? So this is a little bit about praying for the lost. And yeah, I think with that, I'm just going to stop unless there is a question. Okay, one last point that I wanna say is when we say that there are some demon spirits which are influencing people and we have to pray against those demon spirits, right? There is also a concept known as spiritual mapping, okay? Spiritual mapping means what some people do is they will try to understand which demon spirit is behind the work that is going on in any given place. For example, I remember once I'd gone to for Mission Strip, I think we had gone somewhere. There I met one brother and he was saying, I have made a map of all the places in this region and this, you know, one place has this temple, another place has another temple. So he made a list of all the temples, places of worship and also some spirits. You know, this spirit is behind this worship. Like that he made one map. For outreach, what they all do is they'll pray against those demon spirits, those exact demon spirits, okay? So a lot of people practice this. They understand that in a given region, there might be some demonic strongholds. So you identify those spirits, you make a map and you start praying against those specific spirits. For example, you know, we might see that in some place there is alcoholism. All the people are drinking. So it gives us an idea. Why is everybody being affected by alcoholism? Maybe there is that regional territorial spirit of alcoholism that is making everybody drink or in some regions we see prostitution, right? Why are everybody engaging in these wrong matters? Maybe there is a demon spirit of prostitution, right? Things like that. So as believers in some communities, what people do, they make a map of what demon spirits exist and then they start to pray against each one of them.  It is okay to do something like this, but we should not get too deep into it. Now, sometimes people go so deep, they want to research every demon spirit. What's happening? Okay. Yeah, somebody went on mute. Yeah, so there's no need to get so deep into it. That's the point. Okay, a little bit, you understand the background? That's fine. But if you go too deep into it, it's actually unhealthy for believers. That's the last point that I missed, which was in the notes. Okay, Parimitha, there is a question which you asked, you said, do we need to tell a believer that he is lacking faith in certain areas or we should just pray for him? I think it depends, Parimitha, if you know that person or you're working with that person, then maybe they are open to taking your feedback. Then you can share. But if they are not going to listen to you, then there's no point, no? You just pray for them. Is that okay? Yeah, great. Sister Gertrude is asking what is channeling Jesus? Sister, I don't think I know the answer for that question. Can you elaborate on that? Sister, I don't know because I think it is channeling through dead people, I'm not sure. It's channeling through some medium. But I wanted to know more, what is it? Channeling, is it? Yeah, channeling. It is like a new age movement, I'm not very sure. New age movement. Yeah. Okay. Yeah, so obviously it's wrong. Whatever that is, it's wrong, but I don't know exactly what channeling means. Even I try to Google and see, but I didn't quite follow. But I know it is not a biblical way. Yeah. Why would we want to channel and do all those things when we already have direct access to Jesus, no? If somebody sent me a video, I didn't see it when I saw the name only I Googled and so I know it was wrong. I didn't watch that video. Yeah, yeah, don't watch it, best. Don't watch it, don't get into these things. There's no need to research all this. You know, sometimes there are demon spirits behind even the videos and the music. So just don't touch it, best. Okay, thank you, sister. Yeah, thank you. Okay, Nadel, what is Christian service? I think you had asked the same question earlier and I have answered it in some of the previous classes. Christian service is Christian ministry. Yeah, so maybe I'll just leave it at that. You may have to refer back to some of the earlier videos. Thank you. Yes. Ma'am, hello, check, check. Ma'am, there, if we show in the world, there are a lot of people like they have to debate on faith. Debate on? Faith. Faith, okay. Because they are in our side also, Christianity also. In other faiths also, people are like their scholars and different people. Yeah. Those who gain knowledge about their faith, particularly. And after that, some situations are there on social media anywhere in any function or any platform. They are getting into a debate. They are debating on their faith. Is it right or wrong? Okay, is debating right or wrong? See, it's okay to provide reasons when people ask a question. It's okay to provide reasons, but I think just debating for the sake of debating is not helpful. It's not helpful. Also, when people ask a question, think more than the question. Why are they asking that question, right? So you should be able to answer why. Then that person can have an encounter with Jesus. You got it? So I would say, if it's just debate for the sake of debate, it's unnecessary. Stay out of it. But if answering the question means that somebody will encounter Jesus, then answer the question. Does it make sense to you? Okay, fine. All right. Yeah, so no more questions. We'll just pray and we'll close. How about you pray? Since the mic is in your hands. Dear Heavenly Father, we give thanks for this time, for this opportunity. You give us, Father, as we learn a lot of things about, as we learn a lot of things today, Father, give us better understanding to understand all these things better and give us sharp memory so we can memorize all these things till our last breath, Father. We submit the rest of the time in your mighty hand. We ask in the name of Jesus, amen. Amen. Thank you. Thank you, everyone. God bless you. Have a great day.


horse for the speed of light, a cloud of dust, and a ha-hey-hay-oh silver! The Lone Ranger! Before this exciting adventure, a word from our sponsor. General Mills, makers of Cheerios, the ready-to-eat oat cereal that gives you go-power, and Wheaties, the breakfast of champions, present by special recording, The Lone Ranger! G-man Jimmy is eight years old. He is strong and he is bold. He can capture outloss cause he knows. He's got go-power from Cheerios. Yes, he's got go-power. There he goes. He's feeling his Cheerios. Cheerios. Cheerios. That's Cheerios, all right. The nourishing oat cereal that shaped like little letter O's. The ready-to-eat cereal with a wonderful toasted oat flavor. What's more, every delicious spoonful of Cheerios and milk is real muscle building food. That's right, each spoonful contains vitamins, minerals, and proteins your body needs. And these good things in a Cheerios breakfast do good things for your body. Help you have healthy nerves, good red blood, strong bones, and muscles. Yes, Cheerios is made to give you real go-power. So try Cheerios, the famous oat cereal that needs no cooking. And soon you'll hear people say, he's feeling his Cheerios. This faithful Indian companion, Toto, the daring and resourceful mass writer of the Plains, led the fight for law and order in the early Western United States. Nowhere in the pages of history can one find a greater champion of justice. Return with us now to those thrilling days of yesteryear. From out of the past, come the thundering hoof beats of the great horse, Silver. The lone ranger rides again.  The big wagon crane moved in snake-like fashion over the prairie. Get up, get up there. Jatmua, a gruff, weather-beaten man who was in charge of the train, rode a horse alongside the lead wagon, which was driven by his daughter, Jane. On the seat beside her was Judd's 10-year-old son, Douglas.  He catches outlaws and bad Indians, and he helps people, Uncle Caleb, say. Oh, golly, I hope we see him sometime. Well, look, Shawnee, you mustn't go taking everything to heart to Caleb too, yeah? He likes to amuse folks with tall stories.  Yeah, that's right. That mass man is probably some sort of a legend out here, Doug. We don't want to meet mass conglomerates anymore and we want to meet hostile Indians. Heavens know. From what I hear, the Western outlaws are mean and vicious men. They don't scare the lone rangers. Well, it's under Doug's stubborn yoast here. Leaving in that mass man, it's probably what we told him. We'll see him someday, I betcha. Then you won't say I'm stubborn, Dad. Yeah, maybe, son, but I won't count on it. Hey, Jane, you better get those horses moving a bit faster. All right, Dad.   On the seat of the last wagon in the train, two men rode side by side. Jake Logan was a thin, wiry man. His companion Duke Thorne was a stocky build. As they moved along, Jake was saying, Duke, if the wagon master, Jud Moss, knew we had rifles and ammunition in the boxes on our wagon, instead of merchandise for the hardware store like he thinks, he'd have a fit. Yeah. Does he know you've been out west before, Jake? Oh, he thinks I'm a tender foot. And you too, Duke. Yeah, tell me, how do we get the rifles to the Indians? Well, after we pass Fort Belknap, the Indians will raid the wagon train. Now, in the excitement, we'll break away and drive our wagon southward across the plains as if we're trying to escape the raid. When do we pass the fort? Late this afternoon, or after we stop for the night. A renegade named Muller will come and tell us of the chief's plan. The streaks of red paint on our canvas top up here Let the Indians know that we're with the train. They'll be watching the trail.  Meantime, the lone ranger and his Indian companion, Toto, rode along the Butterfield Trail west of Fort Belknap. The masked man was saying, Toto, Red Wolf and his hostile tribe are getting rifles and ammunition. So far, no one's been able to find out who's supplying them. That's not good. The Colonel at Fort Belknap is very much concerned about it. An Audi sent to the mission was a request that we try to locate the source and help catch the smugglers. You think maybe they're bringing guns from east Kimasami? Yes. This territory is too far from the Mexican border for the guns to be brought in that way. Most wagon trains coming to southwest go past Fort. Be easy for Colonel to check for guns? I'm sure he does. Each wagon master is responsible for what comes through. Any one of them should know what each wagon carries. Maybe one wagon master's crooked Kimasami. That's possible. You'll pitch cam soon and use it as a base from which to do some scouting to see if Red Wolf's Indians are in this territory. Then when the next train comes through, we'll follow it. Come on, Toto.  After a short stop at the fort, the wagon train moved on until nightfall. Then the wagons were drawn into a circle and preparations made for the night. Jake and Duke waited until all were sleeping. They were sitting in their wagon smoking when they heard the expected signal. That must be Lala. Wait here and watch how go over that grove where the signal come from. All right. Now we'll be long. We'll say him wait till wagons leave camp. Braves make raid on wagons hour after dawn. Good. Now our wagon has red marks on the canvas top or at the end of the train. As soon as the raid starts, we'll turn off and head over the prairie. Chief tell Braves I'm not shooting wagon that go cross plane. Him say bring you to village. Sure. Duke and me will use the wagon horses to ride to the village with you. You go tell the chief that everything will be ready for him. We go now. Tell chief. The lone ranger and totter would seen the wagon train on the trail and had followed it at a distance. When the wagon circled for the night, the masked man and Indian had camped nearby. They had stopped in some cotton woods and after making their horses comfortable, the two men sat in the darkness talking. Look him as I leave. Yes. We see someone riding over slope. He's coming from the direction of the wagon train. Him Indian look like. We'll pick up his trail and follow him. The lone ranger and totter followed the mullah cautiously. The Indian had disappeared over another slope of the rolling prairie, but the masked man and totter were not concerned about keeping him in sight. The white moonlight helped them pick up his trail and they moved at a leisurely pace. Totter realizing that they too might be seen and followed, look back as they rode over a rise, then spoke. Hey Musami. Yes. Feller and horse back in plain, him following. Yes, I've seen Totter, leeches out line. There's some trees on slope. Maybe we stop there. Wait for Feller. Yes, that's what we'll do. We're over the rise now and out of his sight. Come on, Totter. Give up the scouts. The two men galloped through the trees partway down the slope and stopped in the shadows. We will stay in the saddle and wait, Totter. Uh, him come over top a slope soon. There he comes now. Have your gun ready. We'll stop him and find out who he is. Uh-huh. We'll ride out and stop him. Come on, Totter. Give up the scouts. Holy Mr. Reach! Hold him, hold him. Hold scouts, hold him. He must be him boy. Are you a wild Indian? What are you gonna do to me? Don't be frightened, son. We won't hurt you. Why are you out here alone? What's your name? I'm Douglas Moss. I came from the wagon train back there. I found an Indian who must have been spying on us. I sneaked away. Well, you saw an Indian come across the planes. It's, uh, dangerous for you to ride the planes alone, Doug. I wanted to see some Indians. Wild ones. Anyway, I saw Jake Logan who has a wagon in the train go into a grove. What a coyote howl. He talked to an Indian there. When the Indian left, I followed him. I thought a coyote howl must have been a signal. That's right. That man Jake Logan will bear investigate. We'll continue our lone ranger adventure in just a moment. Yep, take Mickey Mantle born in Oklahoma. Star with the New York Yankees. From out west where a man's a man. And what a man is Mantle. Say, Mickey's been eating Wheaties for years. Now listen, here's another champion with plenty of zing in his swing. Zing, that's a service ace for champion Poncha Gonzalez, a native Californian. He hits them hard, he makes them swish, and in the morning enjoys his dish of Wheaties. Sure, lip smack and taste ticklin' rib-stickin' good. And there's a whole kernel of wheat in every Wheaties' flake. Now to continue. Noting that they were followed as they trailed the Indian Muller, the lone ranger and tattle waited in a grove until the rider came by. Then they stopped him and were surprised to learn he was a boy. Douglas Moss told them about Jake Logan's meeting with Muller, and the information seemed to mean a great deal to the masked man. He questioned Doug further. What do you know about Jake Logan, Doug? Oh, I don't like him much. He looks sort of mean. My father's a wagon master, and I heard dad say Jake Logan and Duke Thorn must be sharp traders. Traders? Uh-huh. They're going to open up a hardware store out west, they said. They had a lot of big boxes of stuff in their wagon. That sounds strange, give us, Ollie. Yes, tunnel. Are the boxes all the same size, Doug? No, sir. I read some of the printing on the boxes once. One says axes, and another says shovels, and there's a couple marked picks. They were just the ones on top that I saw. That's all very interesting. Otto, I still want to follow that Indian's trail. What we do with Boy? It may not be safe for him to return to the wagon camp right now. That fellow Jake realized Doug had seen him go to meet the Indian, he might harm Doug. Nobody saw him and leave the camp. Jake Logan might see you coming back. Otto, take Doug along with us. Take him back to the wagon camp before dawn. Gosh, you mean I'm to help you trail that Indian? Yes, Doug. All right, let's go. Come on, soldier. Get him up, scout. Get up there! Half an hour later, the two men and the boy grew rain on the edge of a secluded valley. Lookin' valley came us up here. Many Indians have camped there. The Indian we saw went to the report after talking to Jake Logan. That's right. The wagon frame's in danger. Tutto, we still have time before dawn. I had to fort bellnap and tell the Colonel what we found out. You remember you. He sends troopers, they may prevent a massacre, and catch the gun smugglers at the same time. Follow me, go. What you do? I'll take Doug back to the wagon camp and warn them. Hurry, Tutto. Follow me, hurry. Adios. Adios. Get him up, scouts. All right, let's turn back now, Doug. Come on, soldier. Get up there. Later at the wagon camp, Doug's father, Judd Moss, discovered that Doug was missing. He and his daughter Jane searched the camp but found no trace of him. Then, Judd Moss found that his horse was missing. He approached a group of men who were around the campfire discussing the boy's disappearance. Hey, I just found out my horse is gone. That young rascal must've been in the way on him. Wow, where would he go? Yeah, and why? It's dangerous for him to be alone on the ferry. I'm sure we must find him. Dad, you must do something. Well, it'll soon be done, Jane. I'll take a few of the men and try to trail the boy. He ought to get a good wallet when you do find him. But Doug wouldn't just ride away without a reason. I'm sure of that. What, what reason could he have, Jane? I don't know. He's been talking about wanting to see wild Indians. Dad, you don't think he... You mean do I think he suddenly got the idea to go look for some? Yes. Yeah, maybe that's it, Jane. All right, get your horses, man, and be ready to ride with me. Judd Morse was preparing to leave the wagon camp with some of the men when one of them pointed across the prairie and spoke. Hey, Mr. Morse, we're coming across the prairie. Hey, that looks like Douglas. Oh, it is, Doug. Daddy's safe. Why, it's time to let Umbry ride in with him, his mask. Well, maybe he should go between us and frown, boys. Get your guns, men. We'll make him talk. I don't understand what Doug is doing with that mask, man. Hold it, hold it, hey. All right, reach, mister, we got you covered. Those guns are necessary. Dad, I'll tell you about him and what happened. Now, keep quiet, Jane. I'll talk to this mask, Umbry. I never did trust anyone who covers this face. There isn't time for a discussion, Mr. Morse. I suggest you tell your men to keep the wagons in a circle. You mean they're fixing to start the wagon train and no mask, Umbry? Dad, you gotta listen. Dad, it won't hurt to listen to what the mask man has to say. Thanks, Mr. Morse. Yeah, go ahead then. Say you'll say, mister. But whatever it is, we won't believe it. But, Dad, he's the mask man Uncle Caleb told me about. Don't you see? The mask. The big white stallion named Silver and all. But, Dad, Doug's right. Well, I'd be... Wait, there must have been something two Caleb stories after all. Now, listen, a tribe of hostile Indians are camp not far from here. I think they'll raid the wagon train this morning. What makes you think that? A friend and I found signs that show the train has been followed by Indian scouts. We were told at the fort the last two trains went through without trouble. There'd be no reason why they'd attack this wagon train, Mr. Morse, unless you have rifles and ammunition in one of your wagons. Tommy Rut, I checked every wagon in this wagon train. You have a man named Jake Logan with you. Yep, Jake and his partner Duke Thorn. They're hitching their team over yonder there. Did you inspect the contents of their wagon? I sure did. He even opened one of the boxes on the top. It was filled with pickaxes, so I didn't look any further. They figured open a store for the worst. Your son saw Jake Logan go to a nearby grove during the night after a coyote howled. Soon after, Doug saw an Indian right away, so he followed. That's right, Dad. Yeah, not sirs. Doug has a vivid imagination, that's all. A boy's been seen Indians in his sleep. But I did see one. I did. So did Tommy and I. He rode across the plains from this direction. I know. Well, I don't know it. It's the word of a boy. Holy mackerel, look out there. Engines. Easy, silly, silly. There comes the attack. Great day.  Mean hurry. Within a few minutes, the pioneers have taken their places near the wagons to ward off the attack. The Indians rode close. Then began to circle the camp. The lone ranger was in the midst of the fray, offering advice and doing all he could to ward off the Redskins. He was busy firing at the Uncircling Indians when Doug Moss ran up to him saying, He must be stopped. Hey, that's Jake Logan's wagon. Who's Jake Logan's, huh? He's heading toward the Indians. His wagon must be loaded with guns. Come on, Tilly. The lone ranger headed after the wagon. Jake and Duke were driving. The wagon had pulled away from the circle and was heading out across the prairie. Faster, big fella, faster. Come on, Tilly. As the lone ranger started after the wagon, he noticed that the circle of Indians parted to let it through without seeming to bother the two men on the seat. He realized that he was in for trouble when he saw the circle closed behind the wagon and some of the Indians were waiting to head him off. We must get through, Silver. Come on, big fella. At that moment when it seemed that his path was blocked by several mothed Redskins, he heard a welcome sound. The troopers had arrived. Come on, Tilly. When a bugle sounded, the Indians broke their line, then turned and started away across the plains with the troopers in pursuit. Gradually, the masked man drew closer to the racing wagon. A couple of bullets whizzed close and he knew he'd been seen by Jake and Duke. He lifted his gun and fired. One of them wounded. Come on, Tilly. A moment later, the lone ranger reached the swaying covered wagon. Then, swerving around the wagon, he cut in toward the horses' heads, swinging them suddenly to one side. Even as Jake tried to take aim, the sudden turning of the wagon caused it to overturn.  The lone ranger leaped from the saddle. The two men clappled and swung blows at each other, then getting to his feet, the masked man dragged Jake with him.  I'll fix you! Oh, try it! Put it off! Go! Keep us up, Ian. Yes, Tutto. My troopers will bring in the Indians. Good. You arrived just in time, Colonel. This wagon was carrying rifles and ammunition for the Indians. Colonel, he's right. Look, there's some of the boxes that broke and opened. All right. Look, there's some of the boxes that broke and opened. That's the reason the Indians attacked this train, Lieutenant. Go there! Go there! Go there! Go there!  Doug says you a friend went for the soldiers. That's right.  If the masked man hadn't come along, we'd all be dead by now. You may blame those two men. Jake Logan and his partner. I suggest they be tied up, Colonel. We'll take charge of them, sir. Good enough. Lieutenant. Mr. Morse, you're a great deal to your boy, Doug. He's a brave boy. Anthony's search for adventure did his part in saving the train and exposing the gun smugglers. Well, I always knew Douglas would inherit some of the Morse courage. Oh, Dad, don't forget you put it all down to just being bad when you found he'd left camp. No, golly. We'd like to tell the kids back home about our great adventure.  Oh, they'll sure believe what Uncle Caleb says after this, too, when I tell them by you, sir. Dad was very hard to convince. Well, not at all, gee. Not at all. Mr. Morse, I'll detail someone to ride with your wagons as far as the next port. Though I'm sure the danger's over. Yes, I think it is, too. But tell them all right on the head of the wagon train just to make sure the way is clear. I know we'll all meet again. Of course. We'll always be glad to see you, Mr. I'm sure you'll like the far west. We need pioneers like you out here. Well, we'll start ahead now, Tonneau. Easy, sir. Not a big deal. Don't worry. Adios. Good bye. Adios. Good bye. One, two, three, let's go. There goes one of the finest men I've ever met. We've heard about him back east, Colonel. What did Uncle Caleb tell you he's called, Doug? Oh, gosh. Don't tell me you forgot already. He's called the Lone Ranger. Little Campbell Muir Incorporated. A part of the Lone Ranger is played by Brace Beamer. Your announcer, Fred Foy. Listen to the Lone Ranger brought to you by special recording Mondays through Fridays at this same time.


Hi. I'm Will. I'm a developer at Carbon 5 here in our Santa Monica office. As my colleague Andrew said earlier, we're an Agile product development company and work with clients ranging from new startups to large enterprises who are looking to build a thing and get a little better at Agile while they're at it. We also often host the Elixir LA meetup in Santa Monica, so perhaps hopefully I'll see some of you there. So today we're going to talk about ants, swarms of ants. And because you paid to go to an Elixir conference, we'll talk about some Elixir stuff too, like processes and gen servers and registries and dynamic supervisors and contacts and types, but mostly ants. Now a great man once said, a person is smart, people are dumb, panicky, dangerous animals and you know it. Luckily we're not talking about people today, we're talking about ants, and they're just the opposite. An ant is dumb, apologies to any ants in the room. A colony is a smart, efficient, coordinated group. So how do they do it? Well, the answer in short is pheromones. Now ants are a diverse set of creatures, but one, here's a common strategy. Let's follow an ant named Alice. Alice, who like all worker ants is female, wanders the world in a semi-random way, searching for food. But wherever Alice goes, she's generally able to keep track of where she is. Scientists think that some ants can keep track of landmarks, but that others actually count their steps and know their location by dead reckoning. We know this because some scientists glued tiny stilts to the legs of desert ants, gave them food and let them go back to their colony. What they found was that the ants totally overshot the colony because their step and distance counts were off. They also found they had been gluing tiny stilts onto ants, which is a pretty awesome way to do science. Anyway, so once Alice comes across food, she picks up a piece and then she heads back home. And since she knows where she is, she's able to take a direct path back. When she's traveling with food, she leaves a pheromone trail behind her. For some ants, the mechanism is just the food weighs them down enough that their stinger drags across the ground. But however they do it, other ants are able to smell this pheromone trail. And so once Alice gets back to the colony, she can drop the food off and then head back out. So now we can follow Bobby, another maybe less talented ant. She follows the same steps as Alice, but happens to find food that's twice as far out. Still she takes it back, also leaving a pheromone trail behind. But there's an important caveat. Pheromone trails evaporate over time. So because Bobby's trips take twice as long as Alice's, Bobby's laying down half the pheromones that Alice is for a given hour of collecting. And because the pheromones evaporate over time, Bobby's trail will never get that strong. This is important for our last ant, Eve. It turns out there's another step in the ant algorithm that Alice and Bobby were following. If while wandering, a ant comes across a pheromone trail, they may decide to follow it to food, depending on how strong the trail is. So now we can see how this comes together. If in Eve's wandering, she comes across Bobby's weak trail, she may decide to pass it by. But when she sees Alice's strong trail, she's much more likely to get on it, follow it to food, and then bring it back, leaving her own pheromone trail on top. Pretty quickly, more and more ants make that same choice as the path is reinforced, till eventually the whole colony has focused up on this, the closest source of food. Once the food's gone, the pheromone trail evaporates, and then all the ants can go wandering again, perhaps now finding Bobby's slightly weaker trail and focusing on that. This is known as a recruitment strategy. It's a way for members of a swarm to tell each other, hey, I found something good, help me out. So that's more or less how at least some ants work, which is interesting, maybe, but as a developer, what is maybe more interesting is that what Alice and friends were doing sounds a little bit like code. In fact, it's pretty straightforward to translate our ants' instructions into some pseudocode like this. There are two main cases here, one where the ant doesn't have food and one where she does. In the no food case, if Alice sees food, she grabs it. If she sees a strong pheromone trail, she probably gets on it, and if she sees a weak one or nothing, then she carries on randomly walking. If Alice is carrying food on the other hand, then she just keeps going, depositing pheromones, and going towards home. When she gets home, she drops off the food and heads back out. So this is pretty algorithmic. As it turns out, we're not the first people to notice that ants seem sort of similar to computer programs. Back in 1992, a man named Marco Dorgio, who, as you can see, is into both ants and robots, which I can relate to, came up with what he called the ant system for his PhD thesis. This was a start of what's now called ant colony optimization, or ACO, which is a method of applying Alice's ant algorithm to tricky problems like the traveling salesman and NAPSAC problems. This is the general formula for ACO. There's a lot of Greek in here, but all it really means is, for a set of possible moves, the probability of picking one of them is the amount of pheromone deposited on that move to the power of some influence factor, which is 2.0 in the literature by default, times the desirability of the move, which in traveling salesman might be related to distance or in NAPSAC related to value. Also taken to a factor divided by the value of all the other possible moves. So for instance, in the traveling salesman problem, this is a classic hard problem in computer science. A traveling salesperson wants to visit a bunch of cities and do it in the least amount of time possible. So how do they choose which cities, which order? Well, it turns out there's no easy way to figure it out, but ACO provides a pretty good approach. With an colony optimization, you have a bunch of virtual ants randomly traverse a graph of cities, making sure to visit each one once. Afterwards, each ant drops a pheromone trail on its path with the strength of the trail corresponding to how short the trip was. Since the ants use the ACO algorithm to choose moves over multiple iterations, the ants coalesce onto the optimal solution. Pretty smart for some ants. So, ACO is an interesting technique. But if you want to do that kind of number crunching, Elixir is not your language. But a few months ago, I was reading about ACO, because that's how I roll on a Tuesday night, and it got me thinking about something else. An ant has a little bit of state, it knows its location, and if it has food, it can take a limited set of actions, like moving, depositing pheromones, and grabbing and dropping off food. And the ACO algorithm that determines the ant's next state is just a function of its current state, plus its surroundings and a little bit of randomness. That means ants are like actors, not that kind. But they do fit pretty well into the actor model that Erlang and Elixir use for concurrency, which got me wondering, can you simulate a forging ant colony using Elixir processes with GenServer? So the short answer is yes, it works, and we'll see that later on in the talk. But that's not really the point here. The point is that if you're like me, you spend a lot of your time writing CRUD applications, even in Elixir, and don't actually explicitly drop into OTP that often. When I'm trying to solve a problem, my instinct is to reach for a database table. So today I want to walk you through a sort of sufficiently complex example of how you might go about building a program where you're thinking in actors, supervisors, and data types instead. You might not be writing an ant simulation because you won't be able to compete with this one, but maybe you'll be inspired for your next problem. So in Phoenix 1.3, as we heard earlier today, introduce the concept of context as a way to organize your code. As a reminder, instead of putting all your logic in a flat hierarchy of schemas and controllers, 1.3 encourages you to pull your business logic out into separate cohesive bundles of structs, functions, and modules called context. So following 1.3 best practices will start with defining some context. Coming up with good context for your domain is definitely an art, and it's one that I personally find kind of challenging. But these are the three that I came up with for this project. Ants, worlds, and simulations. Ants are definitely their own thing. The ant's context will have logic for choosing a move based on locations it receives and keeping state stuff that ants know about. But outside of the ant's site line, there's a whole world. The world knows about locations of food, even if no ants do, and can report to an ant what's immediately around it. That should definitely be separate from the ant code, and ants ought to only be able to query data from the world using its defined API. So that's clearly another context. And then finally, outside of the simulated world, they're the mechanisms of actually running a simulation.  So we can keep the things that we're actually simulating focused by taking the simulation itself out into its own context. I also ended up with sort of a shared context that holds a grab bag of stuff that was used across the app, which is maybe a code smell? Or is it a code pheromone? No, that's not good. Okay. So now that we've got our base context figured out, the next step is to set up our data types, the structs and other things that define the domain. Then we can figure out how the data will be interpreted and transformed as a simulation progresses. So a reasonable place to start might be to define our humble ant. Like we discussed earlier, the ant only really knows two facts, where they are in the world and if they're carrying food. So our ant model is equally simple. It knows its x, y coordinates and it has a food Boolean. You'll notice I also defined a type for our ant. Types obviously aren't required in Elixir, but declaring types for structs lets the static type checker dialyzer be a lot smarter about knowing, are you using them, and is also a nice bit of documentation. In the Elixir standard library as well as type functional languages like OCaml, it's idiomatic to name the main type in a module t. That way you can say that a function takes an ant.t like in this function and it's clear what you're talking about. So the few other types in this domain will focus on the world of the simulation. And how an ant will interact with it. So what does that world look like? Well, for this simulation, the world is pretty simple. It's a grid of tiles surrounded by impassable rocks. The world is mostly empty land, but it has a few brown food tiles for ants to find and a pink colony for them to start at and return the food to. So given this, how would we represent in types? Well, they're pretty much just the English descriptions. Land tiles can have pheromones on them. Food tiles can have food to be collected. The home tile has food that's been collected, and rocks don't have any particular data associated with them. For brevity, I've skipped the type declarations here, but pheromones float and food is an integer. So given those types, we can define a tile.t type, which can be any one of the four sorts of tile. This is a key concept in type functional programming, and it's called a discriminated union, or a tag union, destroy union, variant, or some type, depending on the language. But whatever you call it, the point is that a tile.t could be any sort of tile, but we can use pattern matching to figure out which one it is. Being able to pattern match out, the type is what makes a tag union different than a simple union type. So, for instance, because we know that we have a tile.t in this rating function, we can make some decision based on what type it is. Obviously, this kind of pattern matching on a thing is common and elixir, but it's nice to give the technique a name, or several in this case. And because I've declared the possible types of a tile, it's easy to verify that the rating function is a total function, in that it handles all possible inputs. A couple other types, points, and moves round out the main domain model. Both of these are defined as pairs of integers, but points are x, y coordinates on the grid, whereas moves are changes to x and y that go from negative one to one. So even though they're internally represented in the same way, they have different modules so that we have a clear place to put functions that operate in one of the other, we have types that say what an x or a y means in particular function, and if someday we want to change one of the data structures, we can do all that work in one place. So now that we've got some types, we can sketch out how the system will work. For the most part, I'm not going to dive into the actual implementation of the modules, but you might be interested in seeing some of the mechanics of managing a bunch of processes. So here's the supervision tree for this application. I want to be able to run multiple simulations at once, so the two top-level processes are a SIMID agent that keeps track of the IDs for the different running simulations, and then a simulation supervisor, which is a dynamic supervisor that can spin up many child simulation supervisors and restart them when they have errors. A quick note on dynamic supervisors. They've been mentioned a couple of times today. They're a new addition in Elixir 1.6 and replace the old simple one-for-one supervisors. Both kinds let you create many trial processes at runtime rather than supervising a static list of processes. The only difference is that the new dynamic supervisors have a little bit nicer syntax, and they can supervise multiple different types of children. But whatever sort of dynamic supervisor you use, there's always a problem. There's naming. To work with an Erlang process, you need to know its name or PID to send it messages. That's easy for processes that you only have one instance of, since you can give a global name, like often the name of the module it's defined in, like with this simulations supervisor. But for a process that you're going to have a bunch of, like an ant, that doesn't work. Instead, we'll need a registry and a via-tubble. So you can do a lot of different things with registries, but the one that matters here is naming processes. Using the registry, you can construct a via-tubble, which is a data structure that can be used to uniquely identify a process. That way, even if a process is dynamically started and then later restarted with a new PID, you can still pass messages to it. A via-tubble has this structure. It's a three-tubble of the Atomvia, the registry module, which is Thing and Elixir, and then some tuple that starts with the name of a module you set up as a registry, and then some uniquely identifying information. So with that, we can start simulation supervisors. Each one of these controls the supervisors for a given simulation, super well-named, so they can be taken down as one unit. Simulation supervisors can be referred to by their via-tubble, which includes the SimRegistry, that's the registry for this app, the simulations ID, and then an Atom saying, hey, this is a simulation process.  Each tile is a gen server that holds the tile.t data in state and can be told to add pheromones or remove food from its state. The via-tubble for tiles includes the x, y coordinates of the tile. That's important because it means that for an ant, at a certain set of coordinates, it can easily look about the tiles around it. For an ant at 1, 1, all the tiles from 0, 0 to 2, 2. That kind of lookup would be really inefficient if the tiles were kept in a big list. So we also have a process for each ant, since that was sort of the point of the exercise. But since there's nothing identifying about an ant that's coordinates change, there's no x, y that you can send a message to, it needs a little anti-D agent to give a unique identifier for each ant and then be able to tell you which IDs you can loop through to send a message to all of them. The ant gen servers, like tiles, keep an ant.t in memory. They can take external commands to move themselves or to deposit pheromones to decide where to move each ant to ask the world's context for its surroundings, which is just a list of tiles. The ant then does a weighted random selection from that list using the ACO algorithm and goes in that direction. Since the tile gen server logic is in the world's context, the ants are able to work with tiles without needing to know how they're persisted. So if we wanted to change our mind and decide to store tiles in a map or a database, because that's in the world's context, the ant's context wouldn't have to change. So those are the highlights. With a simple tree, we're able to spin up hundreds of ants and tiles, have them work together in a useful way. So now that we've gone through that, let's actually see this thing in action. OK, it worked. So this is a gift, but of the running simulation, that you can see that the ants at first spread out into the world, quickly found the first one, and you can see the yellow trails as they lay down pheromones and focus up, getting further and further ones away. For the each turn, it takes about six milliseconds to run, and the way it works is the app is waiting every 50 milliseconds, is requesting another turn from the server, it's doing all these calculations, and then sending back some state that's rendering. Since we heard about Elm earlier, I'll mention that this is a Reason React app, which is another super functional front-end language, but a topic for a whole nother conference. Yeah, so I think that's kind of neat. I don't know. All right, so what did we learn? First of all, this is how Skynet starts. And OTP supervisors already know how to terminate it. We've learned that dynamic supervisors, registries, and via tuples are useful for handling large numbers of dynamic processes. We've learned that answer pretty cool, good note. We've learned keep your business logic in your context. We didn't even look at the Phoenix web code in this talk because there's nothing to see. The turn end point just immediately calls out to the simulations context, which orchestrates telling all the other contexts to do their work, and then kicks it back to the client. And it's useful to declare the types of your data structures, including structs, and you can name the main type in a module, t. And finally, you can do a lot with processes. The funny thing about this program is even though we're running all these things, it's essentially synchronous. Every turn we wait for all the ants to move, then we have them place their pheromones, then gather everything up for display, then respond to the client. So why go through all the trouble with gen servers? One potential benefit would be concurrency. If you can, on a multi-core processor, you can have ants all working at once, maybe you'll get some performance benefits. In this case, things actually got faster when I turned the concurrency down a little bit. But a more important gain is fault tolerance. Without processes, if one of these ants had a bug, no pun intended, they could corrupt the state of the entire simulation and bring it down. But with every ant in its own process, if an ant manages to wander off the edge of the world, as they did for a while, the supervisor is able to kill that ant and restart it back at home. If we needed to keep this thing up for a long time, that would be really useful. Finally, it's a nice way to think. I'm simulating independently acting ants, so it's nice to be able to model my code that way. In some ways, this almost feels object-oriented. Essentially, we've got a bunch of instances of ant and tile classes, each with its own state and then methods that you can call to update them. So we get some of the benefits of OOP, nice models, but without the drawbacks of mutable state and crazy inheritance trees and all the other reasons that we are all at an elixir conference. So going all in on processes isn't going to be the right fit for every project, but I think it's a good fit for more projects than we realize. That's it. If you want to crib any code or play with the ants yourself, that's all in the repo here. Thanks.