An open API service indexing awesome lists of open source software.

https://github.com/andreainfufsm/evento-interacoes


https://github.com/andreainfufsm/evento-interacoes

Last synced: 10 months ago
JSON representation

Awesome Lists containing this project

README

          

# Algoritmos, códigos e programação

const typedText = document.getElementById('gpt1');
typedText.style.fontSize = "32px";

const textToType = 'Aliados da criatividade!';
let currentIndex = 0;

function typeCharacter() {
typedText.innerHTML += textToType[currentIndex];
currentIndex += 1;

if (currentIndex < textToType.length) {
setTimeout(typeCharacter, 100);
}
}

typeCharacter();

{{1}}
************************************************

Quem?

> Sou professora da área de Computação no Centro de Tecnologia da UFSM

************************************************

{{2}}
************************************************

O quê?

> Um ponto de vista sobre algumas interAÇÕES na temática do evento

************************************************

## Programação

Definição clássica:

> Processo de criar algoritmos e instruções que possam ser executados por um computador para realizar tarefas.

### É uma arte?!

Programação como uma arte:

> Dicionário Priberam: *"Capacidade ou habilidade para a aplicação de conhecimento ou para a execução de uma ideia.*"

{{1}}
************************************************

Donald Knuth. The Art of Computer Programming. 1st ed. 1968, rev. 1997.

![](img/shopping.png)

************************************************

{{2}}
************************************************

Winnie Soon, Geoff Cox. Aesthetic Programming: A Handbook of Software Studies
http://www.openhumanitiespress.org/books/titles/aesthetic-programming/

![](img/estetica.png)

************************************************

### É um superpoder!?

> Ações para público jovem têm apresentado programação como um "superpoder"

{{1}}
************************************************

Poder de visão "raio-x":

![](img/Earth2AXRayvision1-resize.png)

************************************************

{{2}}
************************************************

Poder de criação:

![](img/superpower-creation.png)

************************************************

## Desafios, criações, códigos

const typedText = document.getElementById('gpt2');
typedText.style.fontSize = "32px";

const textToType = 'Dois exemplos de interAÇÕES...';
let currentIndex = 0;

function typeCharacter() {
typedText.innerHTML += textToType[currentIndex];
currentIndex += 1;

if (currentIndex < textToType.length) {
setTimeout(typeCharacter, 100);
}
}

typeCharacter();

![](img/screenshot-interacoes.png)

### Games de Paradigmas de Programação

Um desafio:

> Criar games no tema "Ciência, Biologia e Meio Ambiente" como projeto final de disciplina de programação.

{{1}}
************************************************

Varias criações:

> Muitos games e uma galeria ilustrada!

https://itch.io/jam/games-paradigmas-programacao-ufsm-2020a

![](img/recording.gif)

************************************************

{{2}}
************************************************
Um dos games criados:

> Uma sereia acordou de um sono profundo só para se deparar com seu lar repleto de lixo e sem nenhum peixe à sua volta. Seu objetivo é limpar a água e assim criar um lugar que possa ter vida novamente.

https://alegz.itch.io/syrene

![](img/screen-syrene.png)

************************************************

{{3}}
************************************************

Um código:

> Apenas algumas das 5354 linhas em linguagem Java

``` java
package com.alegz.mermaid;

import com.alegz.mermaid.rendering.Renderer;
import com.alegz.mermaid.rendering.material.Material;
import com.alegz.mermaid.states.GameState;
import com.alegz.mermaid.states.MenuState;
import com.alegz.mermaid.utils.GameUtils;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Matrix4;

public class MermaidGame implements ApplicationListener
{
private Assets assets;

private Renderer renderer;
private float t;

private GameState gameState;
private GameState transitionState;

@Override
public void create ()
{
assets = new Assets();
assets.load();

renderer = new Renderer(1);
renderer.setProjectionMatrix(new Matrix4().scl(2.0f, 2.0f, 1.0f));

SoundManager.init(assets);
SoundManager.playMusic();

changeState(new MenuState(this, assets));
}

@Override
public void render ()
{
gameState.update();
if (transitionState != null)
transition();
SoundManager.update();
}

public void setState(GameState newState)
{
if (transitionState != null || newState == null)
return;
transitionState = newState;
t = -1.0f;
}

private void changeState(GameState newState)
{
if (newState == null)
return;
if (gameState != null)
gameState.dispose();
newState.create();
newState.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
gameState = newState;
}

private void transition()
{
float cutout = GameUtils.easeStep(Math.abs(t));
float flip = t < 0.0f ? 0.0f : 1.0f;

Material transition = assets.getMaterial(Assets.MATERIAL_TRANSITION);
transition.setFloat("u_cutout", cutout);
transition.setFloat("u_flip", flip);
transition.setVector2("u_size", 6.0f * Gdx.graphics.getWidth() / Gdx.graphics.getHeight(), 6.0f);

renderer.begin();
renderer.setMaterial(transition);
renderer.draw();
renderer.end();

float oldT = t;
t += Gdx.graphics.getDeltaTime();
if (oldT < 0.0f && t >= 0.0f)
changeState(transitionState);
else if (oldT < 1.0f && t >= 1.0f)
transitionState = null;
}

@Override
public void resize(int width, int height)
{
gameState.resize(width, height);
}

@Override
public void pause()
{
gameState.pause();
SoundManager.stopMusic();
}

@Override
public void resume()
{
gameState.resume();
SoundManager.playMusic();
}

@Override
public void dispose ()
{
gameState.dispose();
assets.dispose();
}
}
```

************************************************

### Visita Autoguiada ao Jardim Botânico

Um desafio:

> Criar um app para visitantes do Jardim Botânico da UFSM

{{1}}
************************************************

Uma criação:

> Projeto de interface, equipe do Desenho Industrial UFSM

![](img/app-jbsm1.png)

************************************************

{{2}}
************************************************

Uma criação:

> App em desenvolvimento...

![](img/recording-jb.gif)

************************************************

{{3}}
************************************************

Um código:

> Apenas algumas linhas em linguagem JavaScript

``` javascript
import { defineStore } from 'pinia';
import { api } from 'boot/axios';

export const useArraysStore = defineStore('arrays', {
state: () => ({
pointsOfInterest: [],
pointsOfInterestLoaded: false,
collection: [],
collectionLoaded: false,
hikingTrails: [],
hikingTrailsLoaded: false,
}),

getters: {
},

actions: {
addToPointsOfInterest(item) {
this.pointsOfInterest.push(item);
},

addToCollection(item) {
this.collection.push(item);
},

addToHikingTrails(item) {
this.hikingTrails.push(item);
},

async loadPointsOfInterest() {
if (this.pointsOfInterestLoaded === true)
return;

const pointsOfInterest = await this.readSheet('pontos_interesse');
this.handlePointOfInterestSpreadsheetData(pointsOfInterest);
this.pointsOfInterestLoaded = true;
},

async loadCollection() {
if (this.collectionLoaded === true)
return;

const collection = await this.readSheet('acervo');
this.handleCollectionSpreadsheetData(collection);
this.collectionLoaded = true;
},

async loadHikingTrails() {
if (this.hikingTrailsLoaded === true)
return;

const hikingTrails = await this.readSheet('trilhas');
this.handleHikingTrailsSpreadsheetData(hikingTrails);
this.hikingTrailsLoaded = true;
},

async loadHikingTrailPoints(hikingTraildId) {
if (hikingTraildId == null)
return;

var hikingTrail = this.hikingTrails.find(hikingTrail => hikingTrail.id === hikingTraildId);

if (hikingTrail == null || hikingTrail.pointsLoaded === true)
return;

const hikingTrailPoints = await this.readSheet('pontos_trilha');
this.handleHikingTrailPointsSpreadsheetData(hikingTrail, hikingTrailPoints);
hikingTrail.pointsLoaded = true;
},

async readSheet(sheetName) {
const url = `https://sheets.googleapis.com/v4/spreadsheets/${process.env.VUE_APP_SPREADSHEET_ID}/values/${sheetName}?key=${process.env.VUE_APP_API_KEY}`;
const response = await api.get(url);

if (response.data && response.data.values) {
return response.data.values;
} else {
return [];
}
},

handlePointOfInterestSpreadsheetData(data) {
const header = data[0];
const body = data.slice(1);

body.forEach(row => {
const poi = {};
row.forEach((value, index) => {
poi[header[index]] = value;
});
if (poi.id == null || poi.categoria == null || poi.nome == null || poi.latitude == null || poi.longitude == null)
return;

poi.links = this.handleLinks(poi.generic_links, poi.drive_links);

this.addToPointsOfInterest(poi);
});
},

handleCollectionSpreadsheetData(data) {
const header = data[0];
const body = data.slice(1);

body.forEach(row => {
const colItem = {};
row.forEach((value, index) => {
colItem[header[index]] = value;
});
if (colItem.id == null || colItem.nome == null)
return;

colItem.links = this.handleLinks(colItem.generic_links, colItem.drive_links);

this.addToCollection(colItem);
});
},

handleHikingTrailsSpreadsheetData(data) {
const header = data[0];
const body = data.slice(1);

body.forEach(row => {
const hikingTrail = {};
row.forEach((value, index) => {
hikingTrail[header[index]] = value;
});
if (hikingTrail.id == null || hikingTrail.nome == null)
return;

hikingTrail.pointsLoaded = false;
hikingTrail.points = [];

this.addToHikingTrails(hikingTrail);
});
},

handleHikingTrailPointsSpreadsheetData(hikingTrail, data) {
const header = data[0];
const body = data.slice(1);

body.forEach(row => {
const hikingTrailPoint = {};
row.forEach((value, index) => {
hikingTrailPoint[header[index]] = value;
});
if ([hikingTrailPoint.trilha_id, hikingTrailPoint.latitude, hikingTrailPoint.longitude, hikingTrailPoint.ordem].some(value => value == null))
return;
if (hikingTrailPoint.trilha_id != hikingTrail.id)
return;

hikingTrail.points.push(hikingTrailPoint);
});
hikingTrail.points.sort((a, b) => a.ordem - b.ordem);
},

handleLinks(generic_links, drive_links) {
if (generic_links == null && drive_links == null)
return null;

let links = [];
if (generic_links != null) {
generic_links.split(';').forEach(link => {
links.push(link.trim());
});
}
if (drive_links != null) {
drive_links.split(';').forEach(link => {
let driveId = link.split('/')[5];
links.push('https://lh3.googleusercontent.com/d/' + driveId);
});
}
return links;
},

}
})
```
************************************************

## Um desafio, uma experiência

Um desafio:

> Pensar em formas inovadoras de visualizar (e compartilhar) uma visita ao Jardim Botânico, usando um mapa como pano de fundo.

Um QR Code:

var qrcode = new QRCode(document.getElementById("qrcode"), {
text: window.location.href,
width: 256,
height: 256
});

{{1}}
************************************************

Um código para compartilharmos ideias (concorrente do "mentimeter" :-) ):

``` python
import requests

data = 'minha ideia'

url = 'https://script.google.com/macros/s/AKfycbyp7nIYtEIGPmXe53f5wfgxxg7xOgAWm1oVy0jMFbzDH0vBm6-iG5CTT5Ho5R7x7hD0/exec'
print('Enviando...')
response = requests.post(url, json=data)
print('Pronto!')
```
@LIA.eval(`["main.py"]`, `none`, `python3 main.py`)

************************************************

{{2}}
************************************************

Nosso "mural" de ideias:

``` python
import requests

url = 'https://script.google.com/macros/s/AKfycbyp7nIYtEIGPmXe53f5wfgxxg7xOgAWm1oVy0jMFbzDH0vBm6-iG5CTT5Ho5R7x7hD0/exec'

response = requests.get(url)
print('Buscando ideias geradas:')
if response.status_code == 200:
json_data = response.json()
for item in json_data['values']:
print(item)
else:
print(f'HTTP Error: {response.status_code}')
```
@LIA.eval(`["main.py"]`, `none`, `python3 main.py`)

************************************************

{{3}}
************************************************

![](img/theend.png)

************************************************