The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

[HP-Prime] Simple Game (Bugs)
Message #1 Posted by CompSystems on 1 Nov 2013, 1:19 a.m.

In spanish =(

EXPORT Deducir_Numero2()
// port (version 0.0.3) to HP-Prime by compSystems, source code original by PABLO. coder ZINJAI, PSEINT : http://pseint.sourceforge.net
begin
	print();
	print( "*** Ejecución Iniciada. ***");
	freeze; wait;
	local num_ingresado:=0;
	local total_intentos:=8;
	local num_secreto:= ( rand() mod 100 ) + 1;

print("Adivine el numero (de 1 a 100)"); print("Ingrese el # de intentos"); freeze; wait(2); if NOT(input(total_intentos,"Total de Intentos","Intentos=","Digite un # como total de intentos")) then kill; end; print(">"+total_intentos); local intentos:=total_intentos; print("Debug: "+num_secreto);

if NOT(input(num_ingresado,"Deducir_Numero","Num Ingresado=","Digite un #")) then kill; end; print(">"+num_ingresado); while num_secreto <> num_ingresado and intentos>1 do

if num_secreto>num_ingresado then print("Muy bajo"); else print("Muy alto"); end; intentos:=intentos-1; print("Le quedan "+intentos+" intento(s):"); freeze; wait; if NOT(input(num_ingresado,"Deducir_Numero","Num Ingresado=","Digite un #")) then kill; end; print(">"+num_ingresado); end;

if num_secreto <> num_ingresado then print("El numero era: "+num_secreto); else print("Exacto! Usted adivino en: "+ ((total_intentos+1)-intentos) +" intento(s.)"); end; print("*** Ejecución Finalizada. ***");

freeze; return "Done";

end;

tengo un problema con la siguiente sentencia :(

if not( input(num_ingresado,": num_ingresado")) then kill; end; // si usuario oprime cancel termina del programa pero no lo reconoce, donde estoy fallando?

realice el siguiente parche

if input(num_ingresado,": num_ingresado") then 0; else kill; end;

encontré otro problema y este si no puedo parchar, cada ves que se imprime con print() y si se llena la ventana o vista terminal la ULTIMA LINEA no se visualiza, :(

Edited: 1 Nov 2013, 1:09 p.m. after one or more responses were posted

      
Re: [HP-Prime] Simple Game (Bugs)
Message #2 Posted by Han on 1 Nov 2013, 10:18 a.m.,
in response to message #1 by CompSystems

Quote:
if not( input(num_ingresado,": num_ingresado")) then kill; end; // si usuario oprime cancel termina del programa pero no lo reconoce, donde estoy fallando?

not() - CAS command; NOT() - non-CAS command

if NOT(input(...)) then kill end;

Quote:
encontré otro problema y este si no puedo parchar, cada ves que se imprime con print() y si se llena la ventana o vista terminal la ultima linea no se visualiza, :(

It is printed but you must scroll the screen. This probably needs to be looked at, though, so that the scrolling is properly automated.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall