2 Replies - 1197 Views - Last Post: 23 November 2006 - 11:37 AM Rate Topic: -----

#1 steve22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 23-October 06

Design patterns how?

Post icon  Posted 21 November 2006 - 04:13 PM

Hi guys....


I wanna make this below coding into design patterns. but im not sure how its dun...Can sumone give me an example of how its dun with my coding plz.

Thanks
for (enter = human; enter < numberofplayers; 
enter++) {
switch (aileveltype[k++]) {
case 1:
chc = (int) (Math.random() * 5);
stk = 1 + (int) (Math.random() * cash[enter]);
System.out.println(player[enter] + " selected " + chc
	+ " with stakes " + stk);
	break;
case 2:
chc = (int) (Math.random() * 5);
stk = 1 + (int) (cash[enter] / 2);
System.out.println(player[enter] + " selected " + chc
+ " with stakes " + stk);
break;

case 3:
chc = (int) (Math.random() * 5);
stk = 1 + (int) (cash[enter] / 4);
System.out.println(player[enter] + " selected " + chc
+ " with stakes " + stk);
break;
			}
choices[enteramount] = chc;
	stakes[enteramount] = stk;
	cash[enteramount]-=stakes[enter];
		}

		System.out.println("Ready to race");
	}


Is This A Good Question/Topic? 0
  • +

Replies To: Design patterns how?

#2 salindor  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 46
  • View blog
  • Posts: 301
  • Joined: 10-November 06

Re: Design patterns how?

Posted 21 November 2006 - 05:03 PM

What kind of design pattern are you trying to get? There are several

This post has been edited by salindor: 21 November 2006 - 05:06 PM

Was This Post Helpful? 0
  • +
  • -

#3 steve22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 23-October 06

Re: Design patterns how?

Posted 23 November 2006 - 11:37 AM

Hi

salindor
i need to apply the
Strategy" pattern

but im not sure how to apply it. to my coding
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1