Created
October 31, 2012 10:09
-
-
Save lauralaurilauro/3986235 to your computer and use it in GitHub Desktop.
Pseudocodigo tres en raya
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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