From 639709d988a7d9b754b42cf81a84df46f7b3f3ec Mon Sep 17 00:00:00 2001 From: Allan Date: Wed, 28 Jun 2023 09:01:29 -0300 Subject: [PATCH 1/3] Vaga de estagio para front-end, frito em html,css e js puro --- .project | 11 -- README.md | 92 ---------- game.html | 29 ++++ jogo-oito/.classpath | 27 --- jogo-oito/.gitignore | 1 - jogo-oito/.project | 23 --- .../org.eclipse.core.resources.prefs | 2 - .../.settings/org.eclipse.jdt.core.prefs | 8 - .../.settings/org.eclipse.m2e.core.prefs | 4 - jogo-oito/pom.xml | 23 --- .../src/main/java/chat/gpt/JogoDosOito.java | 158 ------------------ script/gameHome.js | 48 ++++++ style/homePage.css | 78 +++++++++ 13 files changed, 155 insertions(+), 349 deletions(-) delete mode 100644 .project delete mode 100644 README.md create mode 100644 game.html delete mode 100644 jogo-oito/.classpath delete mode 100644 jogo-oito/.gitignore delete mode 100644 jogo-oito/.project delete mode 100644 jogo-oito/.settings/org.eclipse.core.resources.prefs delete mode 100644 jogo-oito/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jogo-oito/.settings/org.eclipse.m2e.core.prefs delete mode 100644 jogo-oito/pom.xml delete mode 100644 jogo-oito/src/main/java/chat/gpt/JogoDosOito.java create mode 100644 script/gameHome.js create mode 100644 style/homePage.css diff --git a/.project b/.project deleted file mode 100644 index 656b22a..0000000 --- a/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - senior-developer-challenge - - - - - - - - diff --git a/README.md b/README.md deleted file mode 100644 index 34c04c3..0000000 --- a/README.md +++ /dev/null @@ -1,92 +0,0 @@ -# [REMOTO] Desafio para vaga de desenvolvedor Sênior, Pleno e Estágio. - -![image](https://user-images.githubusercontent.com/5315184/228086966-4b4b41cc-276c-4d04-96b8-5d37317a89e8.png) - -A Bempaggo é uma empresa do setor de pagamentos. - -## Informações sobre a vaga: - --> Local de trabalho 100% REMOTO. - --> Vaga para trabalho remoto (Residir no Brasil por mais de 6 meses no ano). - --> R$ 16K (inicial) - Desenvolvedor Sênior. - --> R$ 7K (inicial) - Desenvolvedor Pleno. - --> R$ 2K (inicial) - Desenvolvedor Estágio. - --> + Benefícios. - - -## Principais tecnologias que utilizamos: - --> Banco de Dados (Postgresql e Mysql). - --> Backend -> Java (ORM, jakarta.ws.rs [jersey]), Rust. - --> Frontend -> JavaScript, TypeScript, Vue, CSS e HTML. - --> Testes automatizados-> unidade e aceitação (JUnit). - --> Github e AWS. - --> Desenvolvimento dirigido por testes (TDD), destacando a programação em par e assegurar primeiro. - - -## Requisito da vaga - --> Domínio do paradigma de programação orientada aos objetos (POO). - -## -# INSTRUÇÕES: - -## 1 - Crie um fork do projeto. -__https://github.com/bempaggo/developer-challenge__ - -## 2 - Melhore o nosso projeto inicial. - - -_Esperamos que você seja melhor que o ChatGPT._ - -_Valorizamos código com qualidade, ausência de dívidas técnicas..._ - -_Mostre para nós o teu potencial por meio do código._ - -_Aplicar programação orientada aos objetos é uma exigência para esta vaga._ - -_Precisamos jogar o jogo com mouse._ - - -## 3 - Faça um pull request ao nosso projeto. - -_Indique o nível da vaga na mensagem de pull request._ - -_Aceitamos apenas um pull request de cada usuário, então capriche._ - -## 4 - Aguarde uma revisão. - -_Caso rejeitado, apontaremos apenas um problema._ - -## 5 - O que é avaliado no desafio? - --> Avaliamos o domínio de Programação Orientada aos Objetos. - -### Dicas do avaliador: - --> A empresa utiliza essencialmente Java e TypeScript como linguagem. - --> Orienta-se utilização da linguagem que domine para resolver o desafio (especialmente se quiser concorrer à vaga de estágio. Eu não tenho preferência por linguagem). - --> Neste momento, a quantidade de tecnologias que têm contato/domine/goste é indiferente. - --> Disciplinas de: Matemática, Português, Inglês e Física são desejáveis. - --> Programação Orientada aos Objetos não se refere às tecnologias. - --> Caso utilize testes automatizados, a chance do candidato ter o _pull request_ aceito aumenta significativamente. - --> Respire. Leia atentamente a Seção 5. - - - diff --git a/game.html b/game.html new file mode 100644 index 0000000..756dfe8 --- /dev/null +++ b/game.html @@ -0,0 +1,29 @@ + + + + + + + + Document + + + +
+ + + + +
+
+
+

Jogo do oito

+ +
+ +
+ + + + + \ No newline at end of file diff --git a/jogo-oito/.classpath b/jogo-oito/.classpath deleted file mode 100644 index 1d97b2f..0000000 --- a/jogo-oito/.classpath +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jogo-oito/.gitignore b/jogo-oito/.gitignore deleted file mode 100644 index b83d222..0000000 --- a/jogo-oito/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target/ diff --git a/jogo-oito/.project b/jogo-oito/.project deleted file mode 100644 index 71ae64e..0000000 --- a/jogo-oito/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jogo-do-oito-do-estagiario-gpt - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/jogo-oito/.settings/org.eclipse.core.resources.prefs b/jogo-oito/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0..0000000 --- a/jogo-oito/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/jogo-oito/.settings/org.eclipse.jdt.core.prefs b/jogo-oito/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index bc0c2ff..0000000 --- a/jogo-oito/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=18 -org.eclipse.jdt.core.compiler.compliance=18 -org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=18 diff --git a/jogo-oito/.settings/org.eclipse.m2e.core.prefs b/jogo-oito/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f..0000000 --- a/jogo-oito/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/jogo-oito/pom.xml b/jogo-oito/pom.xml deleted file mode 100644 index ebc4845..0000000 --- a/jogo-oito/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - com.bempaggo.jogo - jogo-do-oito-do-estagiario-gpt - 0.0.1-SNAPSHOT - - UTF-8 - - - rest-unity-test - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.0 - - 18 - 18 - - - - - \ No newline at end of file diff --git a/jogo-oito/src/main/java/chat/gpt/JogoDosOito.java b/jogo-oito/src/main/java/chat/gpt/JogoDosOito.java deleted file mode 100644 index e51dd08..0000000 --- a/jogo-oito/src/main/java/chat/gpt/JogoDosOito.java +++ /dev/null @@ -1,158 +0,0 @@ -package chat.gpt; - -import java.awt.Font; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; - -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; - -public class JogoDosOito extends JFrame implements KeyListener { - - private int[][] tabuleiro = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 0 } }; - private JButton[][] botoes = new JButton[3][3]; - private JButton botaoReiniciar; - - public JogoDosOito() { - super("Jogo dos Oito"); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - setSize(300, 300); - setLayout(new GridLayout(4, 3)); - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 3; j++) { - JButton botao = new JButton(); - botao.setFont(new Font("Arial", Font.BOLD, 36)); - botoes[i][j] = botao; - add(botao); - } - } - - botaoReiniciar = new JButton("Reiniciar"); - botaoReiniciar.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - reiniciarJogo(); - } - }); - add(new JLabel("")); - add(botaoReiniciar); - add(new JLabel("")); - - addKeyListener(this); - setFocusable(true); - atualizarTabuleiro(); - setVisible(true); - } - - public void keyPressed(KeyEvent e) { - int keyCode = e.getKeyCode(); - switch (keyCode) { - case KeyEvent.VK_UP: - mover(1, 0); - break; - case KeyEvent.VK_DOWN: - mover(-1, 0); - break; - case KeyEvent.VK_LEFT: - mover(0, 1); - break; - case KeyEvent.VK_RIGHT: - mover(0, -1); - break; - } - } - - public void keyTyped(KeyEvent e) { - } - - public void keyReleased(KeyEvent e) { - } - - private void mover(int linha, int coluna) { - int linhaVazia = -1; - int colunaVazia = -1; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 3; j++) { - if (tabuleiro[i][j] == 0) { - linhaVazia = i; - colunaVazia = j; - } - } - } - int novaLinha = linhaVazia + linha; - int novaColuna = colunaVazia + coluna; - if (novaLinha < 0 || novaLinha > 2 || novaColuna < 0 || novaColuna > 2) { - // movimento inválido - return; - } - tabuleiro[linhaVazia][colunaVazia] = tabuleiro[novaLinha][novaColuna]; - tabuleiro[novaLinha][novaColuna] = 0; - atualizarTabuleiro(); - if (jogoConcluido()) { - JOptionPane.showMessageDialog(this, "Parabéns, você venceu!"); - reiniciarJogo(); - } - } - - public static void main(String[] args) { - new JogoDosOito(); - } - - private boolean jogoConcluido() { - int count = 1; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 3; j++) { - if (tabuleiro[i][j] != count % 9) { - return false; - } - count++; - } - } - return true; - } - - private boolean movimentarPeca(int linha, int coluna) { - if (linha > 0 && tabuleiro[linha - 1][coluna] == 0) { - tabuleiro[linha - 1][coluna] = tabuleiro[linha][coluna]; - tabuleiro[linha][coluna] = 0; - return true; - } else if (linha < 2 && tabuleiro[linha + 1][coluna] == 0) { - tabuleiro[linha + 1][coluna] = tabuleiro[linha][coluna]; - tabuleiro[linha][coluna] = 0; - return true; - } else if (coluna > 0 && tabuleiro[linha][coluna - 1] == 0) { - tabuleiro[linha][coluna - 1] = tabuleiro[linha][coluna]; - tabuleiro[linha][coluna] = 0; - return true; - } else if (coluna < 2 && tabuleiro[linha][coluna + 1] == 0) { - tabuleiro[linha][coluna + 1] = tabuleiro[linha][coluna]; - tabuleiro[linha][coluna] = 0; - return true; - } - return false; - } - - private void atualizarTabuleiro() { - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 3; j++) { - JButton botao = botoes[i][j]; - int valor = tabuleiro[i][j]; - if (valor == 0) { - botao.setText(""); - } else { - botao.setText(String.valueOf(valor)); - } - } - } - } - - private void reiniciarJogo() { - tabuleiro = new int[][] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 0 } }; - atualizarTabuleiro(); - } -} diff --git a/script/gameHome.js b/script/gameHome.js new file mode 100644 index 0000000..b8deedb --- /dev/null +++ b/script/gameHome.js @@ -0,0 +1,48 @@ +function JogoOito(){ + this.arrayButton = Array.from(document.querySelectorAll(".style-Button")) + this.idbuttonStart = document.getElementById("idbuttonStart") +} +JogoOito.prototype.start = function(){ + this.checkclick() +} +JogoOito.prototype.checkclick = function() { + document.addEventListener("click",(event)=>{ + const buttonClick = event.target + if(this.arrayButton.indexOf(buttonClick) !== -1) return this.swapList(buttonClick.textContent) + if(this.idbuttonStart === buttonClick) return this.shuffleArray() + }) +} +JogoOito.prototype.shuffleArray = function(){ + let newList = [0] + let count = 0 + while(newList.length !== 9){ + let valueNewRandom = this.randomNumber(9) + if(newList.indexOf(valueNewRandom) === -1){ + this.arrayButton[count].textContent = valueNewRandom + newList.push(valueNewRandom) + count += 1 + } + } + this.arrayButton[count].textContent = ` ` +} + +JogoOito.prototype.randomNumber = function(max){ + return Math.floor(Math.random() * max) +} + +JogoOito.prototype.swapList = function(numberMatrix){ + let buttonclickd = this.arrayButton.find((element)=> {return element.textContent === numberMatrix}) + let buttonVoid = this.arrayButton.find((element)=> {return element.textContent === ` `}) + let indexVoid = this.arrayButton.findIndex((element) => element.textContent === ` `) + let buttonInddex = this.arrayButton.findIndex((element) => element.textContent === numberMatrix) + + if(buttonInddex === (indexVoid-1) || buttonInddex === (indexVoid+1)){ + buttonVoid.textContent = numberMatrix + buttonclickd.textContent = ` ` + }else if(buttonInddex === (indexVoid+3) || buttonInddex === (indexVoid-3)){ + buttonVoid.textContent = numberMatrix + buttonclickd.textContent = ` ` + } +} +const jogoOito = new JogoOito() +jogoOito.start() diff --git a/style/homePage.css b/style/homePage.css new file mode 100644 index 0000000..ad9d5ac --- /dev/null +++ b/style/homePage.css @@ -0,0 +1,78 @@ +* { + background-color: rgb(0, 0, 48); + margin: 0; + padding: 0; + border: 0; + box-sizing: border-box; + font-family:'Courier New', Courier, monospace + +} +.container{ + width: 350px; + height: 100px; + margin-left: auto; + margin-right: auto; + background-color: white; + border-radius: 14px; + +} + +.title{ + margin:1% 15% ; + font-weight: 800; + background-color: white; + font-size: 32.5px; + + +} +.button-start{ + font-weight: 520; + + margin:2% 23.5% ; + font-size: 28px; + + color: white; + background-color: rgb(105, 0, 175); + padding: 2%; + border: 1px solid rgb(105, 0, 175) ; + border-radius: 14px; +} + +.button-start:hover{ + border: 1px solid black ; + background-color: rgb(95, 0, 158); + color:rgb(236, 236, 236) ; + + +} +.parent-buttons-style{ + margin-left: auto; + margin-right: auto; + margin-top: 2%; + text-align: center; + height: 300px; + width: 300px; + background-color: rgb(105, 0, 175); + border: 1px solid black; + display: flex; + flex-wrap: wrap; +} +.style-Button{ + font-size: 32px; + + font-weight: 700; + height: 88px; + flex-basis: 88px; + justify-content: space-between; + margin:auto; + border: 1px solid; + background-color: white; + + +} +.style-Button:hover { + background-color: rgb(105, 0, 175); + transition: 200ms; + color: white; + +} \ No newline at end of file From cceb4fbbd95012d03dcbc80d4d1821738853f009 Mon Sep 17 00:00:00 2001 From: Allan Fortes Barbosa <53353680+TDCAS@users.noreply.github.com> Date: Wed, 28 Jun 2023 14:25:24 -0300 Subject: [PATCH 2/3] Create README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..99d4d82 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# developer-challenge +Desafio para vaga de desenvovedor, estagiario front-end + +![image](https://github.com/TDCAS/developer-challenge/assets/53353680/7c443ef2-aecb-42a8-8dfe-3bba055a8e60) + From f09693fa0c1c10ab7111cc5ae7894ef0f44b9344 Mon Sep 17 00:00:00 2001 From: Allan Fortes Barbosa <53353680+TDCAS@users.noreply.github.com> Date: Wed, 28 Jun 2023 16:14:57 -0300 Subject: [PATCH 3/3] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 99d4d82..911df3b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # developer-challenge Desafio para vaga de desenvovedor, estagiario front-end +Essa é usando prototype com um objeto so, +(acho mais clean essa) + ![image](https://github.com/TDCAS/developer-challenge/assets/53353680/7c443ef2-aecb-42a8-8dfe-3bba055a8e60)