popasfen.blogg.se

Settlers of catan board generator
Settlers of catan board generator











settlers of catan board generator

It controls what should be done before the user has used the action button.

settlers of catan board generator

#Settlers of catan board generator code#

My favourite part of the code is ignoreNULL=FALSE which is an option in eventReactive. I tried using renderPlot by generating the object I wanted and printing it but I couldn’t get it to work. Because the image generated is a magick-image (in the environment it says “external pointer of class ‘magick-image’”) it doesn’t automatically show in the plot window so I can’t use renderPlot. I think that this is the bit that I struggled with the most. The imageRender wants an expression that is a list with the path to the image named src. Most of the code is part of an eventReactive statement that is assigned to an object called image_board. There are some calculations happening outside of the server function because they don’t need to be recalculated when a new board is generated. Because I am not creating a gif this time the code could have been shortened but I am not a fan of changing working code unless it results in massive efficiency gain or readability. I didn’t bother changing much of the code from the static version of the code. I am slowly getting my head around observeEvent/ eventReactive and all the other nifty features. Also, the more I explore Shiny the more I realise how versatile a tool it is. Building a very basic app is straightforward but once you move past that there are just so many things to think about which values do I want the user to be able to change? Where should the data manipulations be done? What should be recalculated and when? In a weird way I really enjoy struggling because it makes me feel like I am really learning a whole new skill. I am starting to realise that building a shiny app is a different skill to cleaning data or building a statistical model. Despite this, it actually took me longer to write this app than I expected. Since March I have written a few shiny apps/dashboards, been to two shiny workshops, listened to some great talks at EARL London, and I have completed a course on datacamp. Just dividing by 12 would have undercounted by $70\,560$ possibilities.I started writing the code for the server function with great confidence. For reference, the board for this game is a large regular hexagon consisting of 19 regular hexagonal tiles in a grid like:













Settlers of catan board generator