Showing posts with label Guessing game. Show all posts
Showing posts with label Guessing game. Show all posts

Tuesday, January 12, 2016

Limbajul PHP. Guessing game. Tablouri multidimensionale

Urmatorul enunt de pe www.programmr.com este o problema simpla cu sase scenarii posibile, raspunsurile de selectie fiind introduse de la tastatura.

Se cere sa se identifice prin doua interogari un obiect intr-o matrice 2 x 3 (screen-ul urmator).

Din pacate, softul de pe programmr.com valideaza si topica si compozitia stringului de iesire, dupa urmatorul pattern.

1) "alive" & "outside" sau "alive" & "inside":  Obviously the living thing on your mind is a ...

2) "not alive" & "outside" sau "not alive" & "inside" : Obviously the nonliving thing on your mind is a ...
3) ("alive" sau "not alive") && "both":   Obviously the nonliving thing inside/outside on your mind is a ...

Altminteri, problema e triviala iar varianta comoda este stocarea entitatilor living/not living etc intr-un tablou bidimensional cu cheile indicate mai jos.