Skip to content
View in the app

A better way to browse. Learn more.

GAMELIFE România

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

cReTzUUUU

Hall Of Fame
  • Joined

  • Last visited

Everything posted by cReTzUUUU

  1. Creați un buton care va duce utilizatorul în partea de sus a paginii atunci când faceți clic pe el."Scroll Back To Top Button" Pasul 1. Add HTML: Exemplu: <button onclick="topFunction()" id="myBtn" title="Go to top">Top</button> Pasul 2: Pasul 2. Add CSS: #myBtn { display: none; /* Hidden by default */ position: fixed; /* Fixed/sticky position */ bottom: 20px; /* Place the button at the bottom of the page */ right: 30px; /* Place the button 30px from the right */ z-index: 99; /* Make sure it does not overlap */ border: none; /* Remove borders */ outline: none; /* Remove outline */ background-color: red; /* Set a background color */ color: white; /* Text color */ cursor: pointer; /* Add a mouse pointer on hover */ padding: 15px; /* Some padding */ border-radius: 10px; /* Rounded corners */ font-size: 18px; /* Increase font size */ } #myBtn:hover { background-color: #555; /* Add a dark-grey background on hover */ } Pasul 3. Add JavaScript: //Get the button: mybutton = document.getElementById("myBtn"); // When the user scrolls down 20px from the top of the document, show the button window.onscroll = function() {scrollFunction()}; function scrollFunction() { if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { mybutton.style.display = "block"; } else { mybutton.style.display = "none"; } } // When the user clicks on the button, scroll to the top of the document function topFunction() { document.body.scrollTop = 0; // For Safari document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera }
  2. Demo: Script: <!DOCTYPE html> <html> <body> <p>Click on the "Choose File" button to upload a file:</p> <form action="/action_page.php"> <input type="file" id="myFile" name="filename"> <input type="submit"> </form> </body> </html>
  3. Script: <!DOCTYPE html> <html> <body> <p>Click the radio button to toggle between password visibility:</p> Password: <input type="password" value="FakePSW" id="myInput"><br><br> <input type="checkbox" onclick="myFunction()">Show Password <script> function myFunction() { var x = document.getElementById("myInput"); if (x.type === "password") { x.type = "text"; } else { x.type = "password"; } } </script> </body> </html>
  4. Bun venit !
  5. #include <iostream> using namespace std; int main() { int n,i,j,a[10][10],b[10][10],c[10][10]; cout<<"Introduceti gradul matricei:"; cin>>n; for(i=1;i<=n;i++){ for(j=1;j<=n;j++){ cout<<"A["<<i<<"]["<<j<<"]="; cin>>a[i][j]; }} for(i=1;i<=n;i++){ for(j=1;j<=n;j++){ cout<<"B["<<i<<"]["<<j<<"]="; cin>>b[i][j]; }} for(i=1;i<=n;i++){ for(j=1;j<=n;j++){ c[i][j]=a[i][j]+b[i][j]; }} for(i=1;i<=n;i++){ for(j=1;j<=n;j++) cout<<c[i][j]<<" "; cout<<endl; } return 0; }
  6. PREVIEW: HTML: <div class="container"> <form class="well form-horizontal" action=" " method="post" id="contact_form"> <fieldset> <!-- Form Name --> <legend><center><h2><b>Registration Form</b></h2></center></legend><br> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label">First Name</label> <div class="col-md-4 inputGroupContainer"> <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span> <input name="first_name" placeholder="First Name" class="form-control" type="text"> </div> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" >Last Name</label> <div class="col-md-4 inputGroupContainer"> <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span> <input name="last_name" placeholder="Last Name" class="form-control" type="text"> </div> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Department / Office</label> <div class="col-md-4 selectContainer"> <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-list"></i></span> <select name="department" class="form-control selectpicker"> <option value="">Select your Department/Office</option> <option>Department of Engineering</option> <option>Department of Agriculture</option> <option >Accounting Office</option> <option >Tresurer's Office</option> <option >MPDC</option> <option >MCTC</option> <option >MCR</option> <option >Mayor's Office</option> <option >Tourism Office</option> </select> </div> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label">Username</label> <div class="col-md-4 inputGroupContainer"> <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span> <input name="user_name" placeholder="Username" class="form-control" type="text"> </div> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" >Password</label> <div class="col-md-4 inputGroupContainer"> <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span> <input name="user_password" placeholder="Password" class="form-control" type="password"> </div> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" >Confirm Password</label> <div class="col-md-4 inputGroupContainer"> <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span> <input name="confirm_password" placeholder="Confirm Password" class="form-control" type="password"> </div> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label">E-Mail</label> <div class="col-md-4 inputGroupContainer"> <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span> <input name="email" placeholder="E-Mail Address" class="form-control" type="text"> </div> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label">Contact No.</label> <div class="col-md-4 inputGroupContainer"> <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-earphone"></i></span> <input name="contact_no" placeholder="(639)" class="form-control" type="text"> </div> </div> </div> <!-- Select Basic --> <!-- Success message --> <div class="alert alert-success" role="alert" id="success_message">Success <i class="glyphicon glyphicon-thumbs-up"></i> Success!.</div> <!-- Button --> <div class="form-group"> <label class="col-md-4 control-label"></label> <div class="col-md-4"><br> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<button type="submit" class="btn btn-warning" >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspSUBMIT <span class="glyphicon glyphicon-send"></span>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</button> </div> </div> </fieldset> </form> </div> </div><!-- /.container --> CSS: #success_message{ display: none;} JS: $(document).ready(function() { $('#contact_form').bootstrapValidator({ // To use feedback icons, ensure that you use Bootstrap v3.1.0 or later feedbackIcons: { valid: 'glyphicon glyphicon-ok', invalid: 'glyphicon glyphicon-remove', validating: 'glyphicon glyphicon-refresh' }, fields: { first_name: { validators: { stringLength: { min: 2, }, notEmpty: { message: 'Please enter your First Name' } } }, last_name: { validators: { stringLength: { min: 2, }, notEmpty: { message: 'Please enter your Last Name' } } }, user_name: { validators: { stringLength: { min: 8, }, notEmpty: { message: 'Please enter your Username' } } }, user_password: { validators: { stringLength: { min: 8, }, notEmpty: { message: 'Please enter your Password' } } }, confirm_password: { validators: { stringLength: { min: 8, }, notEmpty: { message: 'Please confirm your Password' } } }, email: { validators: { notEmpty: { message: 'Please enter your Email Address' }, emailAddress: { message: 'Please enter a valid Email Address' } } }, contact_no: { validators: { stringLength: { min: 12, max: 12, notEmpty: { message: 'Please enter your Contact No.' } } }, department: { validators: { notEmpty: { message: 'Please select your Department/Office' } } }, } } }) .on('success.form.bv', function(e) { $('#success_message').slideDown({ opacity: "show" }, "slow") // Do something ... $('#contact_form').data('bootstrapValidator').resetForm(); // Prevent form submission e.preventDefault(); // Get the form instance var $form = $(e.target); // Get the BootstrapValidator instance var bv = $form.data('bootstrapValidator'); // Use Ajax to submit form data $.post($form.attr('action'), $form.serialize(), function(result) { console.log(result); }, 'json'); }); });
  7. <!DOCTYPE html> <html> <head> <title></title> <style> html, body { height: 100%; margin: 0; } body { background: black; display: flex; align-items: center; justify-content: center; } canvas { border: 1px solid white; } </style> </head> <body> <canvas width="320" height="640" id="game"></canvas> <script> // https://tetris.fandom.com/wiki/Tetris_Guideline // get a random integer between the range of [min,max] // @see https://stackoverflow.com/a/1527820/2124254 function getRandomInt(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min + 1)) + min; } // generate a new tetromino sequence // @see https://tetris.fandom.com/wiki/Random_Generator function generateSequence() { const sequence = ['I', 'J', 'L', 'O', 'S', 'T', 'Z']; while (sequence.length) { const rand = getRandomInt(0, sequence.length - 1); const name = sequence.splice(rand, 1)[0]; tetrominoSequence.push(name); } } // get the next tetromino in the sequence function getNextTetromino() { if (tetrominoSequence.length === 0) { generateSequence(); } const name = tetrominoSequence.pop(); const matrix = tetrominos[name]; // I and O start centered, all others start in left-middle const col = playfield[0].length / 2 - Math.ceil(matrix[0].length / 2); // I starts on row 21 (-1), all others start on row 22 (-2) const row = name === 'I' ? -1 : -2; return { name: name, // name of the piece (L, O, etc.) matrix: matrix, // the current rotation matrix row: row, // current row (starts offscreen) col: col // current col }; } // rotate an NxN matrix 90deg // @see https://codereview.stackexchange.com/a/186834 function rotate(matrix) { const N = matrix.length - 1; const result = matrix.map((row, i) => row.map((val, j) => matrix[N - j][i]) ); return result; } // check to see if the new matrix/row/col is valid function isValidMove(matrix, cellRow, cellCol) { for (let row = 0; row < matrix.length; row++) { for (let col = 0; col < matrix[row].length; col++) { if (matrix[row][col] && ( // outside the game bounds cellCol + col < 0 || cellCol + col >= playfield[0].length || cellRow + row >= playfield.length || // collides with another piece playfield[cellRow + row][cellCol + col]) ) { return false; } } } return true; } // place the tetromino on the playfield function placeTetromino() { for (let row = 0; row < tetromino.matrix.length; row++) { for (let col = 0; col < tetromino.matrix[row].length; col++) { if (tetromino.matrix[row][col]) { // game over if piece has any part offscreen if (tetromino.row + row < 0) { return showGameOver(); } playfield[tetromino.row + row][tetromino.col + col] = tetromino.name; } } } // check for line clears starting from the bottom and working our way up for (let row = playfield.length - 1; row >= 0; ) { if (playfield[row].every(cell => !!cell)) { // drop every row above this one for (let r = row; r >= 0; r--) { for (let c = 0; c < playfield[r].length; c++) { playfield[r][c] = playfield[r-1][c]; } } } else { row--; } } tetromino = getNextTetromino(); } // show the game over screen function showGameOver() { cancelAnimationFrame(rAF); gameOver = true; context.fillStyle = 'black'; context.globalAlpha = 0.75; context.fillRect(0, canvas.height / 2 - 30, canvas.width, 60); context.globalAlpha = 1; context.fillStyle = 'white'; context.font = '36px monospace'; context.textAlign = 'center'; context.textBaseline = 'middle'; context.fillText('GAME OVER!', canvas.width / 2, canvas.height / 2); } const canvas = document.getElementById('game'); const context = canvas.getContext('2d'); const grid = 32; const tetrominoSequence = []; // keep track of what is in every cell of the game using a 2d array // tetris playfield is 10x20, with a few rows offscreen const playfield = []; // populate the empty state for (let row = -2; row < 20; row++) { playfield[row] = []; for (let col = 0; col < 10; col++) { playfield[row][col] = 0; } } // how to draw each tetromino // @see https://tetris.fandom.com/wiki/SRS const tetrominos = { 'I': [ [0,0,0,0], [1,1,1,1], [0,0,0,0], [0,0,0,0] ], 'J': [ [1,0,0], [1,1,1], [0,0,0], ], 'L': [ [0,0,1], [1,1,1], [0,0,0], ], 'O': [ [1,1], [1,1], ], 'S': [ [0,1,1], [1,1,0], [0,0,0], ], 'Z': [ [1,1,0], [0,1,1], [0,0,0], ], 'T': [ [0,1,0], [1,1,1], [0,0,0], ] }; // color of each tetromino const colors = { 'I': 'cyan', 'O': 'yellow', 'T': 'purple', 'S': 'green', 'Z': 'red', 'J': 'blue', 'L': 'orange' }; let count = 0; let tetromino = getNextTetromino(); let rAF = null; // keep track of the animation frame so we can cancel it let gameOver = false; // game loop function loop() { rAF = requestAnimationFrame(loop); context.clearRect(0,0,canvas.width,canvas.height); // draw the playfield for (let row = 0; row < 20; row++) { for (let col = 0; col < 10; col++) { if (playfield[row][col]) { const name = playfield[row][col]; context.fillStyle = colors[name]; // drawing 1 px smaller than the grid creates a grid effect context.fillRect(col * grid, row * grid, grid-1, grid-1); } } } // draw the active tetromino if (tetromino) { // tetromino falls every 35 frames if (++count > 35) { tetromino.row++; count = 0; // place piece if it runs into anything if (!isValidMove(tetromino.matrix, tetromino.row, tetromino.col)) { tetromino.row--; placeTetromino(); } } context.fillStyle = colors[tetromino.name]; for (let row = 0; row < tetromino.matrix.length; row++) { for (let col = 0; col < tetromino.matrix[row].length; col++) { if (tetromino.matrix[row][col]) { // drawing 1 px smaller than the grid creates a grid effect context.fillRect((tetromino.col + col) * grid, (tetromino.row + row) * grid, grid-1, grid-1); } } } } } // listen to keyboard events to move the active tetromino document.addEventListener('keydown', function(e) { if (gameOver) return; // left and right arrow keys (move) if (e.which === 37 || e.which === 39) { const col = e.which === 37 ? tetromino.col - 1 : tetromino.col + 1; if (isValidMove(tetromino.matrix, tetromino.row, col)) { tetromino.col = col; } } // up arrow key (rotate) if (e.which === 38) { const matrix = rotate(tetromino.matrix); if (isValidMove(matrix, tetromino.row, tetromino.col)) { tetromino.matrix = matrix; } } // down arrow key (drop) if(e.which === 40) { const row = tetromino.row + 1; if (!isValidMove(tetromino.matrix, row, tetromino.col)) { tetromino.row = row - 1; placeTetromino(); return; } tetromino.row = row; } }); // start the game rAF = requestAnimationFrame(loop); </script> </body> </html>
  8. Bomberman <!DOCTYPE html> <html> <head> <title></title> <style> html, body { height: 100%; margin: 0; } body { background: black; display: flex; align-items: center; justify-content: center; } canvas { background: forestgreen; } </style> </head> <body> <canvas width="960" height="832" id="game"></canvas> <script> const canvas = document.getElementById('game'); const context = canvas.getContext('2d'); const grid = 64; const numRows = 13; const numCols = 15; // create a new canvas and draw the soft wall image. then we can use this // canvas to draw the images later on const softWallCanvas = document.createElement('canvas'); const softWallCtx = softWallCanvas.getContext('2d'); softWallCanvas.width = softWallCanvas.height = grid; softWallCtx.fillStyle = 'black'; softWallCtx.fillRect(0, 0, grid, grid); softWallCtx.fillStyle = '#a9a9a9'; // 1st row brick softWallCtx.fillRect(1, 1, grid - 2, 20); // 2nd row bricks softWallCtx.fillRect(0, 23, 20, 18); softWallCtx.fillRect(22, 23, 42, 18); // 3rd row bricks softWallCtx.fillRect(0, 43, 42, 20); softWallCtx.fillRect(44, 43, 20, 20); // create a new canvas and draw the soft wall image. then we can use this // canvas to draw the images later on const wallCanvas = document.createElement('canvas'); const wallCtx = wallCanvas.getContext('2d'); wallCanvas.width = wallCanvas.height = grid; wallCtx.fillStyle = 'black'; wallCtx.fillRect(0, 0, grid, grid); wallCtx.fillStyle = 'white'; wallCtx.fillRect(0, 0, grid - 2, grid - 2); wallCtx.fillStyle = '#a9a9a9'; wallCtx.fillRect(2, 2, grid - 4, grid - 4); // create a mapping of object types const types = { wall: '▉', softWall: 1, bomb: 2 }; // keep track of all entities let entities = []; // keep track of what is in every cell of the game using a 2d array. the // template is used to note where walls are and where soft walls cannot spawn. // '▉' represents a wall // 'x' represents a cell that cannot have a soft wall (player start zone) let cells = []; const template = [ ['▉','▉','▉','▉','▉','▉','▉','▉','▉','▉','▉','▉','▉','▉','▉'], ['▉','x','x', , , , , , , , , ,'x','x','▉'], ['▉','x','▉', ,'▉', ,'▉', ,'▉', ,'▉', ,'▉','x','▉'], ['▉','x', , , , , , , , , , , ,'x','▉'], ['▉', ,'▉', ,'▉', ,'▉', ,'▉', ,'▉', ,'▉', ,'▉'], ['▉', , , , , , , , , , , , , ,'▉'], ['▉', ,'▉', ,'▉', ,'▉', ,'▉', ,'▉', ,'▉', ,'▉'], ['▉', , , , , , , , , , , , , ,'▉'], ['▉', ,'▉', ,'▉', ,'▉', ,'▉', ,'▉', ,'▉', ,'▉'], ['▉','x', , , , , , , , , , , ,'x','▉'], ['▉','x','▉', ,'▉', ,'▉', ,'▉', ,'▉', ,'▉','x','▉'], ['▉','x','x', , , , , , , , , ,'x','x','▉'], ['▉','▉','▉','▉','▉','▉','▉','▉','▉','▉','▉','▉','▉','▉','▉'] ]; // populate the level with walls and soft walls function generateLevel() { cells = []; for (let row = 0; row < numRows; row++) { cells[row] = []; for (let col = 0; col < numCols; col++) { // 90% chance cells will contain a soft wall if (!template[row][col] && Math.random() < 0.90) { cells[row][col] = types.softWall; } else if (template[row][col] === types.wall) { cells[row][col] = types.wall; } } } } // blow up a bomb and its surrounding tiles function blowUpBomb(bomb) { // bomb has already exploded so don't blow up again if (!bomb.alive) return; bomb.alive = false; // remove bomb from grid cells[bomb.row][bomb.col] = null; // explode bomb outward by size const dirs = [{ // up row: -1, col: 0 }, { // down row: 1, col: 0 }, { // left row: 0, col: -1 }, { // right row: 0, col: 1 }]; dirs.forEach((dir) => { for (let i = 0; i < bomb.size; i++) { const row = bomb.row + dir.row * i; const col = bomb.col + dir.col * i; const cell = cells[row][col]; // stop the explosion if it hit a wall if (cell === types.wall) { return; } // center of the explosion is the first iteration of the loop entities.push(new Explosion(row, col, dir, i === 0 ? true : false)); cells[row][col] = null; // bomb hit another bomb so blow that one up too if (cell === types.bomb) { // find the bomb that was hit by comparing positions const nextBomb = entities.find((entity) => { return ( entity.type === types.bomb && entity.row === row && entity.col === col ); }); blowUpBomb(nextBomb); } // stop the explosion if hit anything if (cell) { return; } } }); } // bomb constructor function function Bomb(row, col, size, owner) { this.row = row; this.col = col; this.radius = grid * 0.4; this.size = size; // the size of the explosion this.owner = owner; // which player placed this bomb this.alive = true; this.type = types.bomb; // bomb blows up after 3 seconds this.timer = 3000; // update the bomb each frame this.update = function(dt) { this.timer -= dt; // blow up bomb if timer is done if (this.timer <= 0) { return blowUpBomb(this); } // change the size of the bomb every half second. we can determine the size // by dividing by 500 (half a second) and taking the ceiling of the result. // then we can check if the result is even or odd and change the size const interval = Math.ceil(this.timer / 500); if (interval % 2 === 0) { this.radius = grid * 0.4; } else { this.radius = grid * 0.5; } }; // render the bomb each frame this.render = function() { const x = (this.col + 0.5) * grid; const y = (this.row + 0.5) * grid; // draw bomb context.fillStyle = 'black'; context.beginPath(); context.arc(x, y, this.radius, 0, 2 * Math.PI); context.fill(); // draw bomb fuse moving up and down with the bomb size const fuseY = (this.radius === grid * 0.5 ? grid * 0.15 : 0); context.strokeStyle = 'white'; context.lineWidth = 5; context.beginPath(); context.arc( (this.col + 0.75) * grid, (this.row + 0.25) * grid - fuseY, 10, Math.PI, -Math.PI / 2 ); context.stroke(); }; } // explosion constructor function function Explosion(row, col, dir, center) { this.row = row; this.col = col; this.dir = dir; this.alive = true; // show explosion for 0.3 seconds this.timer = 300; // update the explosion each frame this.update = function(dt) { this.timer -= dt; if (this.timer <=0) { this.alive = false; } }; // render the explosion each frame this.render = function() { const x = this.col * grid; const y = this.row * grid; const horizontal = this.dir.col; const vertical = this.dir.row; // create a fire effect by stacking red, orange, and yellow on top of // each other using progressively smaller rectangles context.fillStyle = '#D72B16'; // red context.fillRect(x, y, grid, grid); context.fillStyle = '#F39642'; // orange // determine how to draw based on if it's vertical or horizontal // center draws both ways if (center || horizontal) { context.fillRect(x, y + 6, grid, grid - 12); } if (center || vertical) { context.fillRect(x + 6, y, grid - 12, grid); } context.fillStyle = '#FFE5A8'; // yellow if (center || horizontal) { context.fillRect(x, y + 12, grid, grid - 24); } if (center || vertical) { context.fillRect(x + 12, y, grid - 24, grid); } }; } // player character (just a simple circle) const player = { row: 1, col: 1, numBombs: 1, bombSize: 3, radius: grid * 0.35, render() { const x = (this.col + 0.5) * grid; const y = (this.row + 0.5) * grid; context.save(); context.fillStyle = 'white'; context.beginPath(); context.arc(x, y, this.radius, 0, 2 * Math.PI); context.fill(); } } // game loop let last; let dt; function loop(timestamp) { requestAnimationFrame(loop); context.clearRect(0,0,canvas.width,canvas.height); // calculate the time difference since the last update. requestAnimationFrame // passes the current timestamp as a parameter to the loop if (!last) { last = timestamp; } dt = timestamp - last; last = timestamp; // update and render everything in the grid for (let row = 0; row < numRows; row++) { for (let col = 0; col < numCols; col++) { switch(cells[row][col]) { case types.wall: context.drawImage(wallCanvas, col * grid, row * grid); break; case types.softWall: context.drawImage(softWallCanvas, col * grid, row * grid); break; } } } // update and render all entities entities.forEach((entity) => { entity.update(dt); entity.render(); }); // remove dead entities entities = entities.filter((entity) => entity.alive); player.render(); } // listen to keyboard events to move the snake document.addEventListener('keydown', function(e) { let row = player.row; let col = player.col; // left arrow key if (e.which === 37) { col--; } // up arrow key else if (e.which === 38) { row--; } // right arrow key else if (e.which === 39) { col++; } // down arrow key else if (e.which === 40) { row++; } // space key (bomb) else if ( e.which === 32 && !cells[row][col] && // count the number of bombs the player has placed entities.filter((entity) => { return entity.type === types.bomb && entity.owner === player }).length < player.numBombs ) { // place bomb const bomb = new Bomb(row, col, player.bombSize, player); entities.push(bomb); cells[row][col] = types.bomb; } // don't move the player if something is already at that position if (!cells[row][col]) { player.row = row; player.col = col; } }); // start the game generateLevel(); requestAnimationFrame(loop); </script> </body> </html>
  9. /Sortarea prin interschimbare // se parcurge vectorul inversand continuturile elementelor alaturate care nu sunt crescatoare #include <iostream> using namespace std; int a[100], n, i,j ,k ,man, gasit ; int main() { cout<<"Dati dimensiunea tabloului n = "; cin>>n; for(i=0; i<n; i++) { cout<<"a["<<i<<"] = "; cin>>a[i]; } do { gasit=0; for(i=0; i<n-1; i++) if (a[i]>a[i+1]) { man=a[i]; a[i]=a[i+1]; a[i+1]=man; gasit=1; } } while (gasit); { cout<<"Tabloul ordonat crescator \n"; for(i=0; i<n; i++) cout<<a[i]<<" "; } }

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.