Skip to content

Instantly share code, notes, and snippets.

@lauralaurilauro
Created October 31, 2012 10:09
Show Gist options
  • Save lauralaurilauro/3986235 to your computer and use it in GitHub Desktop.
Save lauralaurilauro/3986235 to your computer and use it in GitHub Desktop.
Pseudocodigo tres en raya
var a1 = [0,0,0]
var a2 = [0,0,0]
var a3 = [0,0,0]
var tablero = [a1,a2,a3]
var terminado = false;
tablero [0][1];
function comprobarTablero (pos) {
si tablero [pos] es false -> {
YA ESTA DICHA
pedirCasilla ();
}
si tablero [pos] es true ->
poner ficha
pedirCasilla ();
}
}
function hacerTresEnRaya (pos) {
si todas las casillas a1 = true -> {
TRES EN RAYA
terminado = true
}
si todas las casillas a2 = true -> {
TRES EN RAYA
terminado = true
}
si todas las casillas a3 = true -> {
TRES EN RAYA
terminado = true
}
si son distintas de true {
si TresEnRaya [pos] es false -> true
}
}
function pedirCasilla (pos) {
Imprime en pantalla ("pon la ficha en una casilla")
var c = casilla seleccionada;
comprobarTablero (c);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment