Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Corsi A - F > Fondamenti di architettura e programmazione > [Info Generale] Progetto LA DAMA
Pages (6): « 1 2 [3] 4 5 6 »   Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
Rifinitore
.illuminato.

User info:
Registered: Nov 2002
Posts: 189 (0.02 al dì)
Location: Pesaro/Milano
Corso: Laureato
Anno:
Time Online: 2 Days, 17:52:28 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Pezzo[][] scacchiera;
public void scacchiera()
{
Pezzo[][] scacchiera = new Pezzo[8][8];
}

__________________
Peppe
http://www.peppedotnet.it

26-01-2003 15:45
Click Here to See the Profile for Rifinitore Click here to Send Rifinitore a Private Message Find more posts by Rifinitore Add Rifinitore to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
^Angelus^
.illuminato.

User info:
Registered: Sep 2002
Posts: 163 (0.02 al dì)
Location: nelle vicinanze di Comelico beach
Corso: Informatica (ex Com Dig)
Anno: Bella domanda
Time Online: 3 Days, 21:34:49 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

si scusate, mi ero dimenticato i le quadre: prima bisogna indicarglielo così Pezzo [][]myArray;

__________________
Empty your mind, be formless, shapeless, like water. If you put water into a cup it became a cup, if you put water into a bottle it became a bottle, if you put into a teapot it became a teapot. Water can flow or can crush. Be water my friend.

Nessuna via come via. Nessun limite come limite

- Bruce Lee -

26-01-2003 17:00
Click Here to See the Profile for ^Angelus^ Click here to Send ^Angelus^ a Private Message Find more posts by ^Angelus^ Add ^Angelus^ to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
morf
e.Vanishing guy

User info:
Registered: Nov 2002
Posts: 1856 (0.22 al dì)
Location: Treviglio (BG)
Corso: TICO
Anno: primo
Time Online: 5 Days, 11:35:09: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by Rifinitore
Pezzo[][] scacchiera;
public void scacchiera()
{
Pezzo[][] scacchiera = new Pezzo[8][8];
}


allora :D ... prima di tutto, se questo è una vera parte del tuo codice, ti consiglio di cambiare il nome della variabile o del metodo ... lo stesso nome non crea problemi ma Mr. Malchiodi potrebbe storcere il naso.
poi ... è giusto che istanzi l'array bidimensionale con

Pezzo[][] scacchiera;

ma dopo, nel metodo, non c'è bisogno di riscrivere l'istanziazione, basta soltanto dargli il riferimento, cioè:

public void scacchiera()
{
scacchiera = new Pezzo[8][8];
}

fatto questo però, l'array è totalmente vuoto.
se infatti fai un doppio ciclo (un annidato all'altro), tipo (spero sia giusto :D:D):

for (i = 0; i<8; i++)
for (j = 0; j<8; j++)
System.out.println(scacchiera[i][j]);

dovresti vedere una bella fila di null
magari sono io scemetto e non ho capito che cmq da qualche parte hai riempito l'array ... se non l'hai fatto fallo :)

cmq l'unica cosa da dirti era appunto quella cosettina sull'inizializzazione, ma non è un errore ...

bho ... se ti dà quell'errore sui null è perchè forse non hai riempito l'array

__________________
mail, msn and steam account: morf@email.it
my blog: http://melien.blogspot.com
my shots: http://mr-anf.deviantart.com


" ... fear is how I fall ... "

26-01-2003 18:11
Click Here to See the Profile for morf Click here to Send morf a Private Message Visit morf's homepage! Find more posts by morf Add morf to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Rifinitore
.illuminato.

User info:
Registered: Nov 2002
Posts: 189 (0.02 al dì)
Location: Pesaro/Milano
Corso: Laureato
Anno:
Time Online: 2 Days, 17:52:28 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Ma con cosa lo riempo l'array ? E' un array di oggetti pezzo. Non potrò mettermi a riempire ogni elemento ?!
Io metto le 24 pedine e il resto ?

__________________
Peppe
http://www.peppedotnet.it

26-01-2003 20:41
Click Here to See the Profile for Rifinitore Click here to Send Rifinitore a Private Message Find more posts by Rifinitore Add Rifinitore to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
morf
e.Vanishing guy

User info:
Registered: Nov 2002
Posts: 1856 (0.22 al dì)
Location: Treviglio (BG)
Corso: TICO
Anno: primo
Time Online: 5 Days, 11:35:09: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

cioè creare l'array e riempire l'array sono due cose diverse.
a ogni indice dell'array metti un oggetto che ha un suo valore (differenziando cosi pedina e dama) e la sua posizione.
se l'array rimane vuoto la sua utilità non c'è :D
attenzione ad usare l'ereditarietà però ...

__________________
mail, msn and steam account: morf@email.it
my blog: http://melien.blogspot.com
my shots: http://mr-anf.deviantart.com


" ... fear is how I fall ... "

26-01-2003 21:05
Click Here to See the Profile for morf Click here to Send morf a Private Message Visit morf's homepage! Find more posts by morf Add morf to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Rifinitore
.illuminato.

User info:
Registered: Nov 2002
Posts: 189 (0.02 al dì)
Location: Pesaro/Milano
Corso: Laureato
Anno:
Time Online: 2 Days, 17:52:28 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

e per gli spazi vuoti ?

__________________
Peppe
http://www.peppedotnet.it

26-01-2003 21:17
Click Here to See the Profile for Rifinitore Click here to Send Rifinitore a Private Message Find more posts by Rifinitore Add Rifinitore to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
morf
e.Vanishing guy

User info:
Registered: Nov 2002
Posts: 1856 (0.22 al dì)
Location: Treviglio (BG)
Corso: TICO
Anno: primo
Time Online: 5 Days, 11:35:09: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

gli spazi vuoti non c'entrano, c'entrano con la classe Scacchiera
un array di 24 oggetti corrisponde a 12 pezzi bianchi e 12 neri
gli spazi vuoti non devono stare in questo array bensì nella gestione della scacchiera, no ?

__________________
mail, msn and steam account: morf@email.it
my blog: http://melien.blogspot.com
my shots: http://mr-anf.deviantart.com


" ... fear is how I fall ... "

26-01-2003 21:38
Click Here to See the Profile for morf Click here to Send morf a Private Message Visit morf's homepage! Find more posts by morf Add morf to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Rifinitore
.illuminato.

User info:
Registered: Nov 2002
Posts: 189 (0.02 al dì)
Location: Pesaro/Milano
Corso: Laureato
Anno:
Time Online: 2 Days, 17:52:28 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

giusto !
Ma allora questa array di 24 elementi non c'è bisogno di farlo bidimensionale !

__________________
Peppe
http://www.peppedotnet.it

Last edited by Rifinitore on 26-01-2003 at 21:56

26-01-2003 21:51
Click Here to See the Profile for Rifinitore Click here to Send Rifinitore a Private Message Find more posts by Rifinitore Add Rifinitore to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
morf
e.Vanishing guy

User info:
Registered: Nov 2002
Posts: 1856 (0.22 al dì)
Location: Treviglio (BG)
Corso: TICO
Anno: primo
Time Online: 5 Days, 11:35:09: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

effettivamente è vero
dopo riguardo il mio codice e vedo se l'ho fatto effettivamente bidimensionale
la cosa che poteva confondere era che, utilizzando coordinate x e y, veniva normale pensare ad array bidimensionali.
ma l'array bidimensionale va usato per la scacchiera e non per i pezzi :D

__________________
mail, msn and steam account: morf@email.it
my blog: http://melien.blogspot.com
my shots: http://mr-anf.deviantart.com


" ... fear is how I fall ... "

27-01-2003 08:47
Click Here to See the Profile for morf Click here to Send morf a Private Message Visit morf's homepage! Find more posts by morf Add morf to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
morf
e.Vanishing guy

User info:
Registered: Nov 2002
Posts: 1856 (0.22 al dì)
Location: Treviglio (BG)
Corso: TICO
Anno: primo
Time Online: 5 Days, 11:35:09: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

La professoressa Agostini, nella sezione calendario di webcen (http://webcen.usr.dsi.unimi.it/2002...calendario.html) ha scritto che gli argomenti del terzo compitino sono dalla lezione 22 alla lezione 28.
la lezione 28, nella seconda parte, tratta però della ricorsione, argomento che mi pare la stessa professoressa abbia a voce e poi nel riassunto del 22 escluso dagli argomenti del compitino.
conferme, smentite?

__________________
mail, msn and steam account: morf@email.it
my blog: http://melien.blogspot.com
my shots: http://mr-anf.deviantart.com


" ... fear is how I fall ... "

27-01-2003 09:57
Click Here to See the Profile for morf Click here to Send morf a Private Message Visit morf's homepage! Find more posts by morf Add morf to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Rifinitore
.illuminato.

User info:
Registered: Nov 2002
Posts: 189 (0.02 al dì)
Location: Pesaro/Milano
Corso: Laureato
Anno:
Time Online: 2 Days, 17:52:28 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Da come ha detto nell'incontro di mercoledì scorso gli argomenti sono questi :

1) passaggio di classi come parametri
2) ereditarietà
- uso di super()
- uso di this e this()
- overriding
3) gestione delle eccezioni
- intercettazione
- header di un metodo che non intercetta
4) gestione file
- uso file binari (read o write) con apertura
- uso file testuali (read o write) con apertua
- classi e file ( overloading metodi di write o read)
- classe StringTokenizer (per leggere un file testuale che ha una stringa e un numero)
- classe file

Io della ricorsione non ne ho sentito neanche parlare !

__________________
Peppe
http://www.peppedotnet.it

27-01-2003 10:25
Click Here to See the Profile for Rifinitore Click here to Send Rifinitore a Private Message Find more posts by Rifinitore Add Rifinitore to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
morf
e.Vanishing guy

User info:
Registered: Nov 2002
Posts: 1856 (0.22 al dì)
Location: Treviglio (BG)
Corso: TICO
Anno: primo
Time Online: 5 Days, 11:35:09: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

si si quell'elenco ce l'ho pure io scritto sui miei appunti :D
era solo per sapere la vostra opinione :)
ok, ho sentito altri e hanno confermato che la ricorsione è esclusa.

__________________
mail, msn and steam account: morf@email.it
my blog: http://melien.blogspot.com
my shots: http://mr-anf.deviantart.com


" ... fear is how I fall ... "

27-01-2003 11:08
Click Here to See the Profile for morf Click here to Send morf a Private Message Visit morf's homepage! Find more posts by morf Add morf to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Rifinitore
.illuminato.

User info:
Registered: Nov 2002
Posts: 189 (0.02 al dì)
Location: Pesaro/Milano
Corso: Laureato
Anno:
Time Online: 2 Days, 17:52:28 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Semmai riuscirò a scrivere l'array, come pensi di trattare le mosse morf ?

__________________
Peppe
http://www.peppedotnet.it

27-01-2003 21:14
Click Here to See the Profile for Rifinitore Click here to Send Rifinitore a Private Message Find more posts by Rifinitore Add Rifinitore to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
^Angelus^
.illuminato.

User info:
Registered: Sep 2002
Posts: 163 (0.02 al dì)
Location: nelle vicinanze di Comelico beach
Corso: Informatica (ex Com Dig)
Anno: Bella domanda
Time Online: 3 Days, 21:34:49 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

se si fa una matrice 8x8 un idea potrebbe essere metere una variabile di stato booleana, pezzoAttivo ad esempio, che è true se il pezzo è presente, e false se lo spazio è vuoto, poi per i movimenti basta cambiare i lo stato del pezzo.

okkio ad usare il polimorfismo. Per chi nn abbia ancora capito cosa sia, detto in poche parole:

alla variabile di tipo pezzo può essergli assegna una variabile di tipo pedina o di tipo dama in quanto pedina e dama sono figlie di pezzo. nn è vero l'incontrario. Quindi

Pezzo p = new Pezzo();
Pedina ped = new Pedina();
Dama dam = new Dama();

p = ped; // OK
p = dam; // Ok

ped = p; // KO
ped = dam; // KO pedina nn è padre di dama

segue questo ragionamente:
una pedina è un pezzo, ma un pezzo nn è necessariamente una pedina (infatti può essere anche una dama)

è possibile quindi fare così

Pezzo mat[][] = new Pedina[8][8];

__________________
Empty your mind, be formless, shapeless, like water. If you put water into a cup it became a cup, if you put water into a bottle it became a bottle, if you put into a teapot it became a teapot. Water can flow or can crush. Be water my friend.

Nessuna via come via. Nessun limite come limite

- Bruce Lee -

28-01-2003 08:22
Click Here to See the Profile for ^Angelus^ Click here to Send ^Angelus^ a Private Message Find more posts by ^Angelus^ Add ^Angelus^ to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
PuDDu
.mechanist.

User info:
Registered: Sep 2002
Posts: 183 (0.02 al dì)
Location: Dunwich, MA
Corso: Comunicazione Digitale
Anno: 0x03
Time Online: 3 Days, 18:49:12 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Ciao a tutti, anche io mi sto cimentando in questo progetto (non ce la farò mai... :( ). Grazie alle vostre risposte però mi sto facendo un'idea e mi siete molto utili.

Ho trovato una cosa che potrebbe fungere da cleanscreen ma non sembra funzionare: il comando \f che dovrebbe fare una nuova pagina, ma a me non funziona. Ne sapete qualcosa?

__________________
ÞµÐе
Fatti non foste a viver come bruti ma per seguir virtute e canoscenza
]=-----=[ ¿ Need Contact ? ]=------=[
]=-----=[ ~ ICQ ‡‡ E-mail ~ ]=------=[
]=-----=[ ¥ My DeviantArt ¥ ]=------=[

28-01-2003 09:04
Click Here to See the Profile for PuDDu Click here to Send PuDDu a Private Message Visit PuDDu's homepage! Find more posts by PuDDu Add PuDDu to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 18:44.    Post New Thread    Post A Reply
Pages (6): « 1 2 [3] 4 5 6 »   Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.412 seconds (73.34% PHP - 26.66% MySQL) con 24 query.