Peg solitaire questions

Hello guys, I have this code for a peg solitaire, and there are 2 things I can't figure out.

The first one : I don't understand how the mousei_int and mousej_int work... Without them, I can select the piece but when I click a second time, it disappears, so obviously the mousei_int/mousej_int are useful but I don't understand the mechanics behind.

The second one : mousePressed, I have some difficulties to see to what correspond the i and j in the : if((abs(i) == 2) && (j == 0)) and if((i == 0) && ((abs(j) == 2). Is that the coordinates in the 2D array ?

Thanks for the help, here is the code :

int taillet = 7; int taillep = 700; int taillec = 100; int mousei; int mousej; int newmousei; int newmousej; int mousei_int; int mousej_int; int[][] plateau = { {2,2,1,1,1,2,2}, {2,2,1,1,1,2,2}, {1,1,1,1,1,1,1}, {1,1,1,0,1,1,1}, {1,1,1,1,1,1,1}, {2,2,1,1,1,2,2}, {2,2,1,1,1,2,2} }; boolean select = false; boolean spot = false; void setup() { size(700, 700); } void draw() { for (int i = 0; i < taillet; i++) { for (int j = 0; j < taillet; j++) { Case(i, j, plateau[i][j]); } } if (select) { pion(newmousei, newmousej); } } void Case (int x, int y, int value) { if (value == 0) { fill(50,250,50); } if (value == 1) { fill(50,250,50); } if (value == 2) { fill(50); } noStroke(); rect(y*taillec, x*taillec, taillec, taillec); if (value == 1) { fill(color(50,100, 0)); ellipse(y*taillec+taillec/2, x*taillec+taillec/2, taillec-10, taillec-10); } } void pion(int x, int y) { noStroke(); fill(200, 100, 50); ellipse(y*taillec+taillec/2, x*taillec+taillec/2, taillec-10, taillec-10); } void mousePressed() { mousej = (mouseX/taillec); mousei = (mouseY/taillec); if (select) { spot = false; if (plateau[mousei][mousej] == 0) { int i = mousei - newmousei; int j = mousej - newmousej; if ((abs(i) == 2) && (j == 0)) { mousej_int = mousej; if (i < 0) { mousei_int = (mousei + 1); } else { mousei_int = (mousei - 1); } spot = true; } if ((i == 0) && (abs(j) == 2)) { mousei_int = mousei; if (j < 0) { mousej_int = (mousej + 1); } else { mousej_int = (mousej - 1); } spot = true; } } if (spot) { plateau[newmousei][newmousej] = 0; plateau[mousei_int][mousej_int] = 0; plateau[mousei][mousej] = 1; } select = false; } else if (plateau[mousei][mousej] == 1) { select = true; newmousei = mousei; newmousej = mousej; } } 
submitted by /u/wasp_007
[link] [comments]

Upcoming online classes: A mapping of socially-engaged creative practices

This is a public service announcement!


The USS Iowa firing during target exercises near Vieques, Puerto Rico, 1984. Photo: Phan J. Alan Elliott. Via wikipedia

In May, i will be giving online classes at the School of Machines, Making & Make-Believe. The school is based in Berlin but is also traveling from one art&tech venue to another to teach and discuss imaginative exploration of art, technology, design, and human connection. I’ve given talks there twice. Once in Berlin and once at Casa Jasmina in Turin.

And now as befits a blogger, i’m going to run one of the first online classes organized by the school. As will the brilliant artist and a researcher Joana Moll (whom i interviewed recently.) In The Internet, Deconstructed, Joana will be exploring how interfaces mediate most of our life transactions and how we can democratize them. Far from being neutral entities, interfaces exercise a great deal of power over its users, representing one of the major anti-democratic governance entities in our society.

And i will, unsurprisingly, be running classes that focus on activist art and provide an overview of the most inspiring and thought-provoking actions performed and orchestrated by members of the ‘creative resistance’. A Mapping of Socially-Engaged Creative Practices is aimed at politically-minded artists, designers and makers who believe that their ideas, concerns and beliefs should be heard outside of the usual white walls of cultural institutions. It could also interest activists looking for inventive strategies to get their message across. And it’s for pretty much anyone worried about the state of the world today.

Each week, the first half of the course will look at a particular political, cultural, technological or ethical theme that is the source of growing concern in society. Namely: the anthropocene, the persistence of colonialism, the rise of intelligent machines, the new forms of life engineered in laboratories. The other half of the course will explore strategies, tools, and ideas to keep in mind no matter what the topic of the week will be. And i also want to leave space for debates and discussions during the classes.

The online classes will be taking place over the course of four weeks, for two hours each week. Plan in an extra hour for homework and you’ll be set!

Classes are live meaning that you can directly interact with the instructor as well as with the other participants from around the world. Classes will also be recorded for playback in case you are unable to attend for any reason.

The online classes are now open for enrollment!

Also Joana, Rachel Uwa who runs the school and i will be in Belgrade in April for the Resonate festival, get in touch if ever you’re curious about the classes (or about other things we do!)
The School also has an impressive program of Summer workshops and classes. There might be something that interests you in here!

(Big thanks to smart and intrepid Rachel for inviting me to give the classes.)

Upcoming online classes: A mapping of socially-engaged creative practices

This is a public service announcement!


The USS Iowa firing during target exercises near Vieques, Puerto Rico, 1984. Photo: Phan J. Alan Elliott. Via wikipedia

In May, i will be giving online classes at the School of Machines, Making & Make-Believe. The school is based in Berlin but is also traveling from one art&tech venue to another to teach and discuss imaginative exploration of art, technology, design, and human connection. I’ve given talks there twice. Once in Berlin and once at Casa Jasmina in Turin.

And now as befits a blogger, i’m going to run one of the first online classes organized by the school. As will the brilliant artist and a researcher Joana Moll (whom i interviewed recently.) In The Internet, Deconstructed, Joana will be exploring how interfaces mediate most of our life transactions and how we can democratize them. Far from being neutral entities, interfaces exercise a great deal of power over its users, representing one of the major anti-democratic governance entities in our society.

And i will, unsurprisingly, be running classes that focus on activist art and provide an overview of the most inspiring and thought-provoking actions performed and orchestrated by members of the ‘creative resistance’. A Mapping of Socially-Engaged Creative Practices is aimed at politically-minded artists, designers and makers who believe that their ideas, concerns and beliefs should be heard outside of the usual white walls of cultural institutions. It could also interest activists looking for inventive strategies to get their message across. And it’s for pretty much anyone worried about the state of the world today.

Each week, the first half of the course will look at a particular political, cultural, technological or ethical theme that is the source of growing concern in society. Namely: the anthropocene, the persistence of colonialism, the rise of intelligent machines, the new forms of life engineered in laboratories. The other half of the course will explore strategies, tools, and ideas to keep in mind no matter what the topic of the week will be. And i also want to leave space for debates and discussions during the classes.

The online classes will be taking place over the course of four weeks, for two hours each week. Plan in an extra hour for homework and you’ll be set!

Classes are live meaning that you can directly interact with the instructor as well as with the other participants from around the world. Classes will also be recorded for playback in case you are unable to attend for any reason.

The online classes are now open for enrollment!

Also Joana, Rachel Uwa who runs the school and i will be in Belgrade in April for the Resonate festival, get in touch if ever you’re curious about the classes (or about other things we do!)
The School also has an impressive program of Summer workshops and classes. There might be something that interests you in here!

(Big thanks to smart and intrepid Rachel for inviting me to give the classes.)

Help with project idea

I have to make a 30-second animation for a class using a Processing sketch. I essentially wanted to make a sketch with a character who walks through a jungle/forest type environment. However I don't really know where to start, especially cause in order to create the environment, the character, and animals to populate the environment, I would need to find away to create them in Processing which doesn't really have any easy way of creating complex shapes. I've looked at createShape() and whatnot but it just seems so tedious to draw trees and grass using it and completely counterintuitive.

Any ideas on how to start this project? It doesn't need to be a very elaborate project, this is an intro class. I just need some help getting started.

submitted by /u/thekingofthejungle
[link] [comments]

OpenCV/Marker Detection in Processing

Hello,

I'm trying to do fast realtime marker detection and use the position and perspective warping to manipulate an image on screen. Maybe there's a better way of going about this with processing, but so far I've only been experimenting with the OpenCV library for Processing. However the problem is that this lib is based off of the CV Java API version 2.4.5 which is many years old at this point and I'm curious how difficult it would be to get the new version of the API working with Processing 3+.

I'm pretty naïve about libraries/APIs so if this is no small endeavor I'm willing to just suck it up, that being said any information would still be greatly appreciated.

submitted by /u/Rowinish
[link] [comments]