codigo para un juego de ajedrez con dos participantes
def chess(player1, player2):
return player1 + " vs " + player1
chess("Lautaro", "Juan")
All generations.
def chess(player1, player2):
return player1 + " vs " + player1
chess("Lautaro", "Juan")
def drake_chess(p1, p2):
p1_score = 0
p2_score = 0
for i in range(4):
p1_win = randint(0,1)
if p1_win == 1:
p1_score += 1
print('Game {game}: {player1} wins!'.format(game=i, player1=p1))
else:
p2_score += 1
print('Game {game}: {player2} wins!'.format(game=i, player2=p2))
if p1_score > p2_score:
print('{player1} is the overall winner!'.format(player1=p1))
elif p2_score > p1_score:
print('{player2} is the overall winner!'.format(player2=p2))
else:
print('The series is tied!')
drake_chess('Bobby Fischer', 'Garry Kasparov')
<?php
function tablaAjedrez($ancho=8, $alto=8)
{
$tablero = "";
for ($x=1; $x<=$alto; $x++) {
for ($y=1; $y<=$ancho; $y++) {
$color = $x%2 == $y%2 ? "white" : "black";
$tablero .= "<div class=\"square $color\">$x,$y</div>";
}
}
echo "<div class=\"chessboard\">$tablero</div>";
}
tablaAjedrez(5,5);
?>
def tablero(filas, columnas, jugador1, jugador2):
print("\nBienvenido a Ajedrez")
for i in range(filas):
for j in range(columnas):
if (i+j) % 2 == 0:
print("| ", jugador1, " ", end = "")
else:
print("| ", jugador2, " ", end = "")
print("|")
print("\nFin del juego")
tablero(8, 8, "♜", "♞")
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
</style>
</head>
<body>
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
</body>
{!! Form::open(['route' => 'posts.store']) !!}
<div class="form-group">
{!! Form::label('title', 'Titulo:') !!}
{!! Form::text('title', null, ['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::submit('Create Post', ['class' => 'btn btn-primary']) !!}
</div>
{!! Form::close() !!}
<style>
table{
background-color: black;
margin: 5cm;
}
</style>
<?php
for($i=0;$i<=10;$i++){
for($j=0;$j<=10;$j++){
echo($i+$j);
}
}
?>
Generate
More than just a code generator. A tool that helps you with a wide range of tasks. All in one place.
Function from Description
Text Description to SQL Command
Translate Languages
Generate HTML from Description
Code to Explanation
Fix invalid Code
Get Test for Code
Class from Description
Regex from Description
Regex to Explanation
Git Command from Description
Linux Command
Function from Docstring
Add typing to code
Get Language from Code
Time complexity
CSS from Description
Meta Tags from Description
− sponsored −