# Probably an easy issue but it’s driving me crazy.

So I want to have a "dice roll" in a game I'm making in processing. I click the mouse and have it pick a random int between 1 and 6 and move a counter that many squares. I also want it to say "you rolled a _"

My problem is that the "you rolled a _" will only stay on screen for the mousepressed time. Is there a way to get this to stay for a bit longer? Maybe a few seconds.

I've looked at using time = millis () And then saying If (time < 2000) {

Text ()

}

But still just get the flash of the sentence every click.

Like I said I'm sure this is an easy fix. I'm very new to this and after watching a lot of tutorials I decided to just throw myself into something and try and muddle through.

Any suggestions?

submitted by /u/litlee

# I made a little game with Processing!

I put all code on my github In addition to a pre-compiled .exe in the .zip file! I would LOVE your feedback! All code was written by me, with no libraries (not including processing itself)

submitted by /u/PurpleAlpacaCoding

# Help with scanline algorithm

Hello.

I need to implement my function of filling polygons. I've been trying to follow this tutorial and data structure: https://www.cs.rit.edu/~icss571/filling/how_to.html, but I can't understand what would be the differences if I were to follow this tutorial using Processing (cause Processing uses the 0,0 position on the upper left corner of the screen while this tutorial follows the 0,0 position on the lowest left corner of the screen, or am I crazy?) I mean, is there a difference on the algorithm? I need to use a scanline algorithm, but couldn't find a good one to break down and understand. Would gladly accept some help. Thanks.

submitted by /u/capnjord

# How do make many shapes in different locations move as a single unit?

I am very new to processing and I have an assignment to make a creature move around. I know how to make a single item move wherever but how do I keep the creature whole while moving? Do I just take account for the coordinates and move each segment alone but appear to be together? I'm lost here. I have several other questions but I think I can tackle those on my own.

submitted by /u/Comet0707

# Question how to create rainbow color cycle in processing on text or as the fill in shapes?

submitted by /u/One1cat

# The epic task of breeding fruit flies for life on Titan

In 2011, artist Andy Gracie set himself the task of using patient breeding and artificial selection to develop a new species of fruit flies that would be able to live on Titan, the largest moon of Saturn. Titan is not the most hospitable resort for us Earth-bound creatures. It’s a very dark and very cold (−179.2 °C) place, its surface lacks stable liquid water, its gravity is a bit weaker than the gravity of Earth’s moon, etc. On the other hand, the celestial body has an atmosphere, weather, tectonic activity, some sort of landscape with lakes and dunes as well as other features that make Titan one of the least hostile places for humans in the outer solar system.

Andy Gracie, Drosophila titanus, 2011

Gracie’s experimental breeding programme aims thus to gradually recreate, in an enclosed habitat, the atmospheric conditions found on Titan and make sure that the common fly would slowly acclimate to it. The insects that would emerge from the experiment would be a new species he calls Drosophila Titanus. The artist recreated the atmospheric conditions found on Titan by combining a DIY and hacking approach with a rigorous scientific methodology.

The project Drosophila Titanus belongs to a long tradition of sending flies into space. In fact, they were the first animals sent into space back in 1947 when the U.S.-launched a German V-2 ballistic missile loaded with fruit flies 109 kilometers away from the surface of the earth. The insects came back alive. Since then, they’ve been regularly propelled into space along with plants, rats and other biological organisms. The reason why fruit flies are popular guinea pigs in space and in labs is that they share a lot with us in terms of genetic makeup.

The project is of course impossible to achieve in a human life time but Gracie had planned to work on it for the rest of his life to see how far the experiment would lead him. Unfortunately, the fly population recently went through an environmental disaster, its population crashed and the experiment ended with a few sad corpses of flies.

Drosophila titanus remains a fascinating work and if you’re curious to know more about it, you could run to the always exciting Science Gallery Dublin where the work is exhibited as part of Life at the Edges, a show that explores survival in extreme environment, helping us contemplate what our own future on a planet Earth battling with increasingly unstable environmental conditions. Or, if you can’t make it to Dublin, here’s an interview with the artist:

Andy Gracie, Drosophila titanus, 2011. Life at the Edges at Science Gallery at Trinity College Dublin. Photo: Science Gallery Dublin

Hi Andy! Your experiment involves creating flies that could survive on Titan. I understand that Titan is incredibly cold so the flies have to gradually get used to the very low temperatures but what would be the impact of Titan’s orange sky and the low frequency radiowaves that emanate from Titan on their bodies? And how do you prepare them for that?

The project involved adapting the flies for a range of environmental conditions that are very different to those found on Earth. The cold is the most obvious along with the different atmospheric composition. There is also increased atmospheric pressure, radiation, chromatic characteristics and so on. To reach what could be conceived as the end of the project I would need to condition the flies for all of the characteristics of Titan.

The radio waves experiment has been earmarked for a future stage in the project so I haven’t got too much to say about that right now. However, the chromatic adjustment has been something I’ve been working on over the last couple of years. The natural phototaxis of Drosophila – its instinct to move towards a certain type of light – is geared towards the blue end of the electromagnetic spectrum. To overcome this I kept the flies for a year under a Titan analog orange light before testing for adaptation. The selection experiment was modelled on a Y-Trap apparatus, a simple way of offering an organism two choices. The flies crawl up a tube and are faced with a junction offering orange light in one direction and blue light in the other, each tube ending with another non-return trap. Any flies taking the orange option are considered adapted and kept for breeding. Repeated iterations of the project smooth out random events.

You’ve been breeding fruit flies for 6 or 7 years now. Are the changes in the insects already visible? Is anything already perceptible?

Due to the lower temperatures I’ve noticed that their life cycle is longer, which is to say that they mature and reproduce more slowly. The cycle defined by hatching to sexual maturity is 11 to 12 days at an optimum temperature of around 22 celsius. My flies which were living constantly at 15 celsius were taking almost twice as long and also living longer. In the above mentioned chromatic adjustment experiment I was also seeing some flies beginning to choose the orange route. Physiological changes are much harder to see, and I expect it would take several more years and increased adaptations and selections to see anything. The 57 year experiment by the late Dr. Syuichi Mori of Kyoto University and his team was also an inspiration to me in this respect.

And if you were to release the flies in the wild now, would they adjust easily to the outside conditions? Or are they already doomed and unfit to survive on Earth?

I think they would have no problem. Despite 7 years of conditioning and breeding my drosophila were still much much more Earth flies than Titan flies. Their tendency for genetic drift back to what is called wild-type (denoted the natural state of an organism or the prevalent phenotype) is also a factor. If the population remained isolated they would re-adapt to total Earth conditions fairly quickly, otherwise cross-breeding would wipe out any genetic variation in the drosophila titanus.

Bearing in mind one of the subtexts of the project, surviving on Earth might actually be the same as being doomed anyway.

Andy Gracie, Drosophila titanus, 2011

Andy Gracie, Drosophila titanus, 2011

Could you describe your homemade Titan simulation chamber? Has its configuration and equipment changed since the start of the project?

The chamber is an apparatus that has evolved over time as the project has developed. I’m not a great forward planner so the device adapted as I had new ideas or as new necessities presented themselves. The first consideration was being able to make it cold, then to add LEDs that would simulate the Titan lighting conditions. I was lately developing seals that would allow the internal pressure to be increased in order to begin the atmospheric pressure experiment. Future experiments would probably have demanded the fabrication of an entirely new device.

Outside of the main simulator I also made the gravitational realignment torus, it being impractical to rotate the main apparatus. This device did not have a cooling system so gravitaxis experiments had to take place in the winter with the heating off.

A large part of the project for me was drawing from my background in DIY culture – how to improvise experimental apparatus outside of a laboratory or research facility. I was interested in how subtle adjustments of everyday objects and situations can provide conditions that are not typically terrestrial.

Andy Gracie, Drosophila titanus, 2011

In an interview you gave about the work in 2011, you explain “It originally started out as an artistic project, but I am also interested in how I can run a metaphorical, speculative artistic project by following a completely rigorously scientific process. This means every artistic decision I make has to be accompanied by a rigour check.” How do you verify the scientific rigour of the experiment?

I’ve always been interested in making art that closely follows scientific procedure and Drosophila Titanus is probably the furthest I’ve taken this methodology. The project is purely artistic but without the scientific rigour it would become just a frivolous exercise.

I attempted to be as rigorous as possible by maintaining a control culture alongside my experimental flies, by keeping a lab journal outlining every procedure that took place, by carefully designing experiments according to verified information, by striving to iron out random fluctuations through repeated selection processes. And so on. The corner of my studio that was dedicated to this project was set up to resemble a standard fly lab as much as possible.

Andy Gracie, Drosophila titanus, 2011

Why did you decide to take the scientific process approach? What does it bring to the artistic dimension of the project? How do you manage to still do art and not just a scientific experiment?

As I mentioned, I am interested in what happens when you make an art project by following scientific protocol. Its a way of examining the notion that art and science are both ways of asking questions about nature and devising experiments to see if your hypothesis have any foundation or are cause for further thought.

To push this idea a little further I wanted to make a project that was framed as a scientific experiment and that closely followed a scientific methodology but that had an aim that was patently unscientific. It’s a ridiculous idea to try and breed a new species of drosophila suitable for living on Titan, but if you begin to carry out a serious experiment with the aim of getting there then you get into some interesting and provocative epistemological territory.

By tying together artistic and scientific methodologies I was looking for the ‘breaking point’, a hypothetical locus where what we call art and what we call science become unable to continue sharing practical and ontological space. I think that in this point we discover some very interesting things about how and why we seek new knowledge.

How much do you have to tend to the flies? Do they need a lot of time and attention? Now you’re on holiday are they taking care of themselves?

Regular maintenance is relatively easy. They just need to be ‘passaged’ – a practice of refreshing culture vessel and nutrient medium – every 3 to 4 weeks. This involves cooking up some new medium, sterilising some new culture pots and moving healthy adult flies from the old pots to the new ones. If I was at an experiment or selection point then this process would obviously become more complex. However, the bulk of the 7 years of the project was the flies sitting in their environment slowly getting used to new conditions, eating and mating. And dying.

The question about maintenance and holidays brings me to the point where I have to say that, as of the summer of 2017, the project is officially terminated. While absent from the Barcelona studio for a month the cooling system failed and 99% of the flies perished in the stifling summer temperatures. I was unable to revive stocks from the few survivors. It was fairly apocalyptic.

Faced with the choice of starting again from square one, or declaring the project over having achieved certain aims I decided on the latter. I have the bodies of last 10 flies preserved in alcohol and will probably make a commemorative piece with them. That will be the official end of the line and I can finally spend more time on other works. Actively maintaining a project for several years was a lot more challenging than I thought it would be.

It seems likely that large parts of the Earth will be barely inhabitable before the end of the century. Would it make more sense to try and change our own metabolism (maybe through more brutal adjustments than the ones you’re submitting the flies to) or to pack our bags and move to Mars?

Apocalyptic and post-apocalyptic scenarios are informing a body of current work I’m developing so its something I dwell on to a deeper extent even than when I was doing the post-terrestrial works. To be honest, I think we’re screwed either way. Colonising Mars is the romantic dream of SciFi aficionados and tech-god fanboys and fangirls. The reality is that it would be a chosen few eking out a fairly grim existence that would be barely better, if at all, than a ravaged Earth.

Altering our own physiology could be possible. I’m not totally up to speed with CRISPR but I understand that it could offer radical changes to the human genome in a very short time. As artificial selection of human traits could be even more ethically treacherous and a much slower process it might be seen by some as a solution. But do we really want to go there?

Do you think that at the end of the experiment, the flies will it still be Drosophila melanogaster? Or will you have created a new species of fly?

The claim I made at the beginning of the project was that I was going to develop a new species of Drosophila which would be called Drosophila titanus. To be able to make this claim I would need to test whether speciation had actually happened. Speciation is a broad and complex biological issue, with a range of forms and pathways, and of course some hotly contested definitions.

The standard test would be to check whether Mayr‘s textbook definition is valid, that the two groups are unable to reproduce. If my experimental flies were unable to produce fertile offspring with the control flies then I could claim a new species. However, I would also be interested to check whether I have achieved any of the other species descriptions such as typological, ecological or genetic. I’m completely convinced that it would be achievable and that Drosophila titanus would be listed among the official taxonomies.

The argument about what constitutes a species was another of the sub-narratives of the work.

Thanks Andy!

Life at the Edges at Science Gallery at Trinity College Dublin. Photo: Science Gallery Dublin

Life at the Edges at Science Gallery at Trinity College Dublin. Photo: Science Gallery Dublin

Drosophila Titanus is part of Life at the Edges. You have until until 30 September to visit the exhibition at Science Gallery Dublin

# The epic task of breeding fruit flies for life on Titan

In 2011, artist Andy Gracie set himself the task of using patient breeding and artificial selection to develop a new species of fruit flies that would be able to live on Titan, the largest moon of Saturn. Titan is not the most hospitable resort for us Earth-bound creatures. It’s a very dark and very cold (−179.2 °C) place, its surface lacks stable liquid water, its gravity is a bit weaker than the gravity of Earth’s moon, etc. On the other hand, the celestial body has an atmosphere, weather, tectonic activity, some sort of landscape with lakes and dunes as well as other features that make Titan one of the least hostile places for humans in the outer solar system.

Andy Gracie, Drosophila titanus, 2011

Gracie’s experimental breeding programme aims thus to gradually recreate, in an enclosed habitat, the atmospheric conditions found on Titan and make sure that the common fly would slowly acclimate to it. The insects that would emerge from the experiment would be a new species he calls Drosophila Titanus. The artist recreated the atmospheric conditions found on Titan by combining a DIY and hacking approach with a rigorous scientific methodology.

The project Drosophila Titanus belongs to a long tradition of sending flies into space. In fact, they were the first animals sent into space back in 1947 when the U.S.-launched a German V-2 ballistic missile loaded with fruit flies 109 kilometers away from the surface of the earth. The insects came back alive. Since then, they’ve been regularly propelled into space along with plants, rats and other biological organisms. The reason why fruit flies are popular guinea pigs in space and in labs is that they share a lot with us in terms of genetic makeup.

The project is of course impossible to achieve in a human life time but Gracie had planned to work on it for the rest of his life to see how far the experiment would lead him. Unfortunately, the fly population recently went through an environmental disaster, its population crashed and the experiment ended with a few sad corpses of flies.

Drosophila titanus remains a fascinating work and if you’re curious to know more about it, you could run to the always exciting Science Gallery Dublin where the work is exhibited as part of Life at the Edges, a show that explores survival in extreme environment, helping us contemplate what our own future on a planet Earth battling with increasingly unstable environmental conditions. Or, if you can’t make it to Dublin, here’s an interview with the artist:

Andy Gracie, Drosophila titanus, 2011. Life at the Edges at Science Gallery at Trinity College Dublin. Photo: Science Gallery Dublin

Hi Andy! Your experiment involves creating flies that could survive on Titan. I understand that Titan is incredibly cold so the flies have to gradually get used to the very low temperatures but what would be the impact of Titan’s orange sky and the low frequency radiowaves that emanate from Titan on their bodies? And how do you prepare them for that?

The project involved adapting the flies for a range of environmental conditions that are very different to those found on Earth. The cold is the most obvious along with the different atmospheric composition. There is also increased atmospheric pressure, radiation, chromatic characteristics and so on. To reach what could be conceived as the end of the project I would need to condition the flies for all of the characteristics of Titan.

The radio waves experiment has been earmarked for a future stage in the project so I haven’t got too much to say about that right now. However, the chromatic adjustment has been something I’ve been working on over the last couple of years. The natural phototaxis of Drosophila – its instinct to move towards a certain type of light – is geared towards the blue end of the electromagnetic spectrum. To overcome this I kept the flies for a year under a Titan analog orange light before testing for adaptation. The selection experiment was modelled on a Y-Trap apparatus, a simple way of offering an organism two choices. The flies crawl up a tube and are faced with a junction offering orange light in one direction and blue light in the other, each tube ending with another non-return trap. Any flies taking the orange option are considered adapted and kept for breeding. Repeated iterations of the project smooth out random events.

You’ve been breeding fruit flies for 6 or 7 years now. Are the changes in the insects already visible? Is anything already perceptible?

Due to the lower temperatures I’ve noticed that their life cycle is longer, which is to say that they mature and reproduce more slowly. The cycle defined by hatching to sexual maturity is 11 to 12 days at an optimum temperature of around 22 celsius. My flies which were living constantly at 15 celsius were taking almost twice as long and also living longer. In the above mentioned chromatic adjustment experiment I was also seeing some flies beginning to choose the orange route. Physiological changes are much harder to see, and I expect it would take several more years and increased adaptations and selections to see anything. The 57 year experiment by the late Dr. Syuichi Mori of Kyoto University and his team was also an inspiration to me in this respect.

And if you were to release the flies in the wild now, would they adjust easily to the outside conditions? Or are they already doomed and unfit to survive on Earth?

I think they would have no problem. Despite 7 years of conditioning and breeding my drosophila were still much much more Earth flies than Titan flies. Their tendency for genetic drift back to what is called wild-type (denoted the natural state of an organism or the prevalent phenotype) is also a factor. If the population remained isolated they would re-adapt to total Earth conditions fairly quickly, otherwise cross-breeding would wipe out any genetic variation in the drosophila titanus.

Bearing in mind one of the subtexts of the project, surviving on Earth might actually be the same as being doomed anyway.

Andy Gracie, Drosophila titanus, 2011

Andy Gracie, Drosophila titanus, 2011

Could you describe your homemade Titan simulation chamber? Has its configuration and equipment changed since the start of the project?

The chamber is an apparatus that has evolved over time as the project has developed. I’m not a great forward planner so the device adapted as I had new ideas or as new necessities presented themselves. The first consideration was being able to make it cold, then to add LEDs that would simulate the Titan lighting conditions. I was lately developing seals that would allow the internal pressure to be increased in order to begin the atmospheric pressure experiment. Future experiments would probably have demanded the fabrication of an entirely new device.

Outside of the main simulator I also made the gravitational realignment torus, it being impractical to rotate the main apparatus. This device did not have a cooling system so gravitaxis experiments had to take place in the winter with the heating off.

A large part of the project for me was drawing from my background in DIY culture – how to improvise experimental apparatus outside of a laboratory or research facility. I was interested in how subtle adjustments of everyday objects and situations can provide conditions that are not typically terrestrial.

Andy Gracie, Drosophila titanus, 2011

In an interview you gave about the work in 2011, you explain “It originally started out as an artistic project, but I am also interested in how I can run a metaphorical, speculative artistic project by following a completely rigorously scientific process. This means every artistic decision I make has to be accompanied by a rigour check.” How do you verify the scientific rigour of the experiment?

I’ve always been interested in making art that closely follows scientific procedure and Drosophila Titanus is probably the furthest I’ve taken this methodology. The project is purely artistic but without the scientific rigour it would become just a frivolous exercise.

I attempted to be as rigorous as possible by maintaining a control culture alongside my experimental flies, by keeping a lab journal outlining every procedure that took place, by carefully designing experiments according to verified information, by striving to iron out random fluctuations through repeated selection processes. And so on. The corner of my studio that was dedicated to this project was set up to resemble a standard fly lab as much as possible.

Andy Gracie, Drosophila titanus, 2011

Why did you decide to take the scientific process approach? What does it bring to the artistic dimension of the project? How do you manage to still do art and not just a scientific experiment?

As I mentioned, I am interested in what happens when you make an art project by following scientific protocol. Its a way of examining the notion that art and science are both ways of asking questions about nature and devising experiments to see if your hypothesis have any foundation or are cause for further thought.

To push this idea a little further I wanted to make a project that was framed as a scientific experiment and that closely followed a scientific methodology but that had an aim that was patently unscientific. It’s a ridiculous idea to try and breed a new species of drosophila suitable for living on Titan, but if you begin to carry out a serious experiment with the aim of getting there then you get into some interesting and provocative epistemological territory.

By tying together artistic and scientific methodologies I was looking for the ‘breaking point’, a hypothetical locus where what we call art and what we call science become unable to continue sharing practical and ontological space. I think that in this point we discover some very interesting things about how and why we seek new knowledge.

How much do you have to tend to the flies? Do they need a lot of time and attention? Now you’re on holiday are they taking care of themselves?

Regular maintenance is relatively easy. They just need to be ‘passaged’ – a practice of refreshing culture vessel and nutrient medium – every 3 to 4 weeks. This involves cooking up some new medium, sterilising some new culture pots and moving healthy adult flies from the old pots to the new ones. If I was at an experiment or selection point then this process would obviously become more complex. However, the bulk of the 7 years of the project was the flies sitting in their environment slowly getting used to new conditions, eating and mating. And dying.

The question about maintenance and holidays brings me to the point where I have to say that, as of the summer of 2017, the project is officially terminated. While absent from the Barcelona studio for a month the cooling system failed and 99% of the flies perished in the stifling summer temperatures. I was unable to revive stocks from the few survivors. It was fairly apocalyptic.

Faced with the choice of starting again from square one, or declaring the project over having achieved certain aims I decided on the latter. I have the bodies of last 10 flies preserved in alcohol and will probably make a commemorative piece with them. That will be the official end of the line and I can finally spend more time on other works. Actively maintaining a project for several years was a lot more challenging than I thought it would be.

It seems likely that large parts of the Earth will be barely inhabitable before the end of the century. Would it make more sense to try and change our own metabolism (maybe through more brutal adjustments than the ones you’re submitting the flies to) or to pack our bags and move to Mars?

Apocalyptic and post-apocalyptic scenarios are informing a body of current work I’m developing so its something I dwell on to a deeper extent even than when I was doing the post-terrestrial works. To be honest, I think we’re screwed either way. Colonising Mars is the romantic dream of SciFi aficionados and tech-god fanboys and fangirls. The reality is that it would be a chosen few eking out a fairly grim existence that would be barely better, if at all, than a ravaged Earth.

Altering our own physiology could be possible. I’m not totally up to speed with CRISPR but I understand that it could offer radical changes to the human genome in a very short time. As artificial selection of human traits could be even more ethically treacherous and a much slower process it might be seen by some as a solution. But do we really want to go there?

Do you think that at the end of the experiment, the flies will it still be Drosophila melanogaster? Or will you have created a new species of fly?

The claim I made at the beginning of the project was that I was going to develop a new species of Drosophila which would be called Drosophila titanus. To be able to make this claim I would need to test whether speciation had actually happened. Speciation is a broad and complex biological issue, with a range of forms and pathways, and of course some hotly contested definitions.

The standard test would be to check whether Mayr‘s textbook definition is valid, that the two groups are unable to reproduce. If my experimental flies were unable to produce fertile offspring with the control flies then I could claim a new species. However, I would also be interested to check whether I have achieved any of the other species descriptions such as typological, ecological or genetic. I’m completely convinced that it would be achievable and that Drosophila titanus would be listed among the official taxonomies.

The argument about what constitutes a species was another of the sub-narratives of the work.

Thanks Andy!

Life at the Edges at Science Gallery at Trinity College Dublin. Photo: Science Gallery Dublin

Life at the Edges at Science Gallery at Trinity College Dublin. Photo: Science Gallery Dublin

Drosophila Titanus is part of Life at the Edges. You have until until 30 September to visit the exhibition at Science Gallery Dublin

# New to processing, help with network library

Hello r/processing community. I have some questions to ask because i'm new to processing and some things are messed up in my mind. I will write my questions here one by one.

Before i start let me inform you that i have already read the following links i)https://processing.org/reference/libraries/net/index.html ii)https://processing.org/tutorials/network/ iii) http://learningprocessing.com/examples/chp19/example-19-01-simple-server

1) I want to share a canvas (an Elemental Cellular Automata) to another device (i'm using raspberry pi's), so obviously i'm using the net library and i create a server and a client.

On the client side which method am i supposed to use to depict the canvas to the server ? From the documentation (https://processing.org/reference/libraries/net/Client.html) my guess the method i think i have to use is readBytes(), but from the name itself something doesn't feel right.

2) Is it possible to assign a client to depict half (50%) of the canvas to the server and the other half (50%) from another client ? If yes, its has to do with void setup() { size(200, 200); } or something else ?

Sorry for bothering, thanks for reading and i hope to hear for your input.

submitted by /u/antonis13