A_N_T_I_C_L_O_N
#1
Mantiqiy savolar yozamiz javob beramaiz
10 soat 46 daqiqa 6 soniyadan keyin yozdi:
Diqqat savol u yashash uchun uyidan vohli chiqib ketadi yasash uchun kopgina konsertlar beradi va ohirgi konserti fojiyali yakun topadi topganlar shaxsiy xabarga yozsin #1 deb
1 kun 10 soat 25 daqiqa 21 soniyadan keyin yozdi:
U savol emas lekin hamma unga javob beradi #2 deb yozila javobi
1 kun 10 soat 25 daqiqa 54 soniyadan keyin yozdi:
0
Kod · HTML299 qator
<!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="400" height="400" id="game"></canvas>

<script>

var canvas = document.getElementById('game');

var context = canvas.getContext('2d');

var grid = 16;

var count = 0;

  

var snake = {

  x: 160,

  y: 160,

  

  // snake velocity. moves one grid length every frame in either the x or y direction

  dx: grid,

  dy: 0,

  

  // keep track of all grids the snake body occupies

  cells: [],

  

  // length of the snake. grows when eating an apple

  maxCells: 4

};

var apple = {

  x: 320,

  y: 320

};

// get random whole numbers in a specific range

// @see https://stackoverflow.com/a/1527820/2124254

function getRandomInt(min, max) {

  return Math.floor(Math.random() * (max - min)) + min;

}

// game loop

function loop() {

  requestAnimationFrame(loop);

  // slow game loop to 15 fps instead of 60 (60/15 = 4)

  if (++count < 4) {

    return;

  }

  count = 0;

  context.clearRect(0,0,canvas.width,canvas.height);

  // move snake by it's velocity

  snake.x += snake.dx;

  snake.y += snake.dy;

  // wrap snake position horizontally on edge of screen

  if (snake.x < 0) {

    snake.x = canvas.width - grid;

  }

  else if (snake.x >= canvas.width) {

    snake.x = 0;

  }

  

  // wrap snake position vertically on edge of screen

  if (snake.y < 0) {

    snake.y = canvas.height - grid;

  }

  else if (snake.y >= canvas.height) {

    snake.y = 0;

  }

  // keep track of where snake has been. front of the array is always the head

  snake.cells.unshift({x: snake.x, y: snake.y});

  // remove cells as we move away from them

  if (snake.cells.length > snake.maxCells) {

    snake.cells.pop();

  }

  // draw apple

  context.fillStyle = 'red';

  context.fillRect(apple.x, apple.y, grid-1, grid-1);

  // draw snake one cell at a time

  context.fillStyle = 'green';

  snake.cells.forEach(function(cell, index) {

    

    // drawing 1 px smaller than the grid creates a grid effect in the snake body so you can see how long it is

    context.fillRect(cell.x, cell.y, grid-1, grid-1);  

    // snake ate apple

    if (cell.x === apple.x && cell.y === apple.y) {

      snake.maxCells++;

      // canvas is 400x400 which is 25x25 grids 

      apple.x = getRandomInt(0, 25) * grid;

      apple.y = getRandomInt(0, 25) * grid;

    }

    // check collision with all cells after this one (modified bubble sort)

    for (var i = index + 1; i < snake.cells.length; i++) {

      

      // snake occupies same space as a body part. reset game

      if (cell.x === snake.cells[i].x && cell.y === snake.cells[i].y) {

        snake.x = 160;

        snake.y = 160;

        snake.cells = [];

        snake.maxCells = 4;

        snake.dx = grid;

        snake.dy = 0;

        apple.x = getRandomInt(0, 25) * grid;

        apple.y = getRandomInt(0, 25) * grid;

      }

    }

  });

}

// listen to keyboard events to move the snake

document.addEventListener('keydown', function(e) {

  // prevent snake from backtracking on itself by checking that it's 

  // not already moving on the same axis (pressing left while moving

  // left won't do anything, and pressing right while moving left

  // shouldn't let you collide with your own body)

  

  // left arrow key

  if (e.which === 37 && snake.dx === 0) {

    snake.dx = -grid;

    snake.dy = 0;

  }

  // up arrow key

  else if (e.which === 38 && snake.dy === 0) {

    snake.dy = -grid;

    snake.dx = 0;

  }

  // right arrow key

  else if (e.which === 39 && snake.dx === 0) {

    snake.dx = grid;

    snake.dy = 0;

  }

  // down arrow key

  else if (e.which === 40 && snake.dy === 0) {

    snake.dy = grid;

    snake.dx = 0;

  }

});

// start the game

requestAnimationFrame(loop);

</script>

</body>

</html>
Tolik
#2
A_N_T_I_C_L_O_N, # A_N_T_I_C_L_O_N (03.01.2019 / 12:05)
Mantiqiy savolar yozamiz javob beramaiz
10 soat 46 daqiqa 6 soniyadan keyin yozdi:
Diqqat savol u yashash uchun uyidan vohli chiqib ketadi yasash uchun kopgina konsertlar beradi va ohirgi konserti
Bu kodni mantiqiy savollarga qanday aloqasi bor?
0
A_N_T_I_C_L_O_N
#3
Tolik, Yozilib ketdi
0
Nodirali
#4
Kecha ko'chada taksiga o'tirdim. Yana bir kishi kelsa ketamiz dedi. Xo'p dedim. Sal o'tib asablarim taranglashib, g'azabimni jilovlab mashinadan tushib keyingi taksiga 1-odam bo'lib mindim. Keyin qiziq boshlandi. 2ta taksist urushib ketdi. Urush sababchisi esa hotirjam mashinada odam kutib o'tiribdi ya'ni men.

Mashinadan tushishimga sabab nima deb o'ylaysiz?
0
AkCenT
#5
Tuvakda gul unga suv quysa nima bo'ladi
0
sobirjonovv
#6
Stakanga suv quyib undan keyin tuz solsa nima bo'ladi?
0
24
CHEfan
#7
AkCenT, Hamir.

P.S savolingiz noto'g'ri berilgan ekan.
0

#8
Mahmudjon_BEST, Buyam hamir buladi ?
0

#9
A_N_T_I_C_L_O_N, #2 ism
4 daqiqa 54 soniyadan keyin yozdi:
2ta ota va 2ta o'g'il baliq ovida har biri 2 tadan baliq tutishadi. Ular jami qancha baliq tutishgan?
0
AkCenT
#10
CHEfan, # CHEfan (27.06.2019 / 03:17)
AkCenT, Hamir.

P.S savolingiz noto'g'ri berilgan ekan.
Javobingiz to'g'ri mantiqiy ku shunga shu tarzda savol yozdim
0
ŝჩσჩĵฉჩσฑ
#11
CHEfan, # CHEfan (27.06.2019 / 03:19)
A_N_T_I_C_L_O_N, #2 ism
4 daqiqa 54 soniyadan keyin yozdi:
2ta ota va 2ta o'g'il baliq ovida har biri 2 tadan baliq tutishadi. Ular jami qancha baliq tutishgan?
Javob: 6ta baliq
1
24
CHEfan
#12
AkCenT, Ha to'g'ri ammo savolni to'g'ri varianti bunaqa edi.

Tog'ara (likopcha) suv solib undan keyin tuz solib aralashtirsa nima bo'ladi?
0
AkCenT
#13
CHEfan, # CHEfan (27.06.2019 / 10:28)
AkCenT, Ha to'g'ri ammo savolni to'g'ri varianti bunaqa edi.

Tog'ara (likopcha) suv solib undan keyin tuz solib aralashtirsa nima bo'ladi?
Unda savol anq böladyu
0
ŝჩσჩĵฉჩσฑ
#14
Dunyoda bir narsa borki, u bo'lmasa hech kim bir birini taniy olmaydi. Nima?
0
BILINGUAL
#15
wizard, # wizard (27.06.2019 / 15:32)
Dunyoda bir narsa borki, u bo'lmasa hech kim bir birini taniy olmaydi. Nima?
Yuz yoki ism yoki ko'z
0
Mentalist
#16
wizard, # wizard (27.06.2019 / 15:32)
Dunyoda bir narsa borki, u bo'lmasa hech kim bir birini taniy olmaydi. Nima?
Ism
0

#17
Savol:
u dunyodagi barcha tilda gaplasha oladi. Faqat bir tilda gaplasga olmaydi. Savol qaysi tilda va sabab
0
ŝჩσჩĵฉჩσฑ
#18
SupReMe_MaSTeR, Aks sado
0
Mentalist
#19
wizard, # wizard (27.06.2019 / 19:53)
SupReMe_MaSTeR, Aks sado
Savolni öqing: qaysi tilda va sabab
nima emas
0

#20
Mashinalar necha qismga bo'linadi
0