mardi 24 avril 2018

implementation of a table that crosses some results and makes operations

Hi there! It's the first time for me so I hope to do everything right. First of all, I explain the problem: I want to do an implementation of this table...

page from a famous gamebook called "Lone Wolf Volume 1" by Joe Dever. The page show "table of fight"

As you can see the page was write in Italian because I'm Italian. I hope I can still explain the problem with my poor English. I'm writing the program topo automate the fight in the book. Actually I writing a complete program of all the functions necessary for the book but this part is too hard.

The problem ~ with these data: ratio (Rapporto di Forza) and random number (Numero del Destino); I need to create a function which doing 2 operation when I cross the result. The operation modify life point of both enemy and Lone Wolf. By now I have found a long and boring solution (pseudo-code below):

which(ratio) {case per case : a lot of IF(random_number) {operations;} }

I'm sure there is a better solution! Can you help me? Thanks! PS: I'm new to coding, It's my first year at informatics university, please be kind with me and my awful English (I know). Bye.

Aucun commentaire:

Enregistrer un commentaire