The article presents the construction of an agent-based model of segregation step by step. The article is intended as a tutorial for the reader’s first steps with agent-based modeling. The model is programmed in the NetLogo software and provided in two versions: first as an online executable version, for first-impression purposes, and second as NetLogo code, for serious experiments and further model improvements by the reader. The article describes the user interface and source code of the model in close detail. Most of the article is dedicated to careful, in-depth explanation of the NetLogo code. The model aims to answer Schelling’s classical question: "Is it possible to obtain an ethnically segregated structure of a town with relatively tolerant inhabitants?" The model also aims to answer the question: "Does size of recognized neighbourhood suppress tendency to segregation?" Analysis of the data produced by the model informs us that the tendency to segregation decreased with larger recognized neighbourhood - the larger the neighbourhood the lower the number of inhabitants living in an ethnically homogenous neighbourhood. However, size of recognized neighbourhood did not moderate the relationship between intolerance and tendency to segregation - the slope of the relationship was still the same (or even steeper for larger neighbourhoods)., František Kalvas., and Obsahuje bibliografické odkazy