|
| [ASK] Soal algoritma . . . . | |
| | Pengirim | Message |
---|
Kuro Ethernite The Creator
Posts : 1631 Thanked : 24 Engine : RMVX Ace Skill : Masterful Type : Jack of All Trades
Trophies
Awards:
| Subyek: [ASK] Soal algoritma . . . . 2012-04-06, 14:59 | |
| To the point.... okay? - initialize:
oooooooooo oooooooooo oooooooooo ooooxooooo oooooooooo oooooooooo oooooooooo
diketahui : - Anda menggunakan pascal....
- koordinat x = [a,b]
- s = 3
Hasilnya pengen . . . . - straight:
ooooxooooo ooooxooooo ooooxooooo oxxxxxxxoo ooooxooooo ooooxooooo ooooxooooo
- diamond:
ooooxooooo oooxxxoooo ooxxxxxooo oxxxxxxxoo ooxxxxxooo oooxxxoooo ooooxooooo
- square:
oxxxxxxxoo oxxxxxxxoo oxxxxxxxoo oxxxxxxxoo oxxxxxxxoo oxxxxxxxoo oxxxxxxxoo
- diagonal:
oxoooooxoo ooxoooxooo oooxoxoooo ooooxooooo oooxoxoooo ooxoooxooo oxoooooxoo
Dan 1 lagi, circle.... The algorithm please? q lgi males2 ny mikir.... | |
| | | Aegis Legendary
Posts : 2152 Thanked : 56 Engine : Multi-Engine User Skill : Very Beginner Type : Artist
Trophies
Awards:
| Subyek: Re: [ASK] Soal algoritma . . . . 2012-04-06, 15:03 | |
| wah ini pasti buat tugas yah ? saya ga mau tertipu | |
| | | marjoni01 Senior
Posts : 971 Thanked : 5 Engine : RMVX Ace Skill : Intermediate Type : Developer
| Subyek: Re: [ASK] Soal algoritma . . . . 2012-04-06, 15:03 | |
| Jadi... Apa maksudnya ya? | |
| | | Mecha Byte Newbie
Posts : 36 Thanked : 0 Engine : RMXP Skill : Beginner Type : Scripter
| Subyek: Re: [ASK] Soal algoritma . . . . 2012-04-06, 18:08 | |
| Apa tipe struktur data yang ingin digunakan? Aku bantu kasih clue aja ya . Aku pakai bahasa C campur pseucode biar tidak panjang-panjang nulis keywordnya
Nih clue 1:
- Code:
-
bool Map[9][7];
Catatan: belum kutes, tapi harusnya sudah lumayan akurat
baru: yang prosedur tadi tidak jadi . tapi petunjuk pertama cukup pakai array 2 dimensio
wah lama banget responnya
ya udah, kukasih clue 2
- Code:
-
void Straight(int x, int y, int s) { for (int i=0; i < s; s++) { Map(x,y-i-1) = true Map(x,y+i+1) = true Map(x-i-1,y) = true Map(x+i+1,y) = true }
}
void Diamond(int x, int y, int s) {
int YStart = y-s
for (int i=0; i < s; s++) { Map(x,YStart +i) = true for (int j=0;j<i;j++) { Map(x,YStart +i) = true Map(x,YStart +i) = true } }
YStart = y+s
for (int i=0; i < s; s++) { Map(x,YStart -i) = true for (int j=0;j<i;j++) { Map(x-j,YStart -i) = true Map(x+j,YStart -i) = true } }
}
void Square(int x, int y, int s) { int XStart = x-s int YStart = y-s
for (int i=0; i < s*2+1; s++) { for (int j=0; j < s*2+1; j++) { Map(XStart +j,YStart +i) = true } }
void Diagonal(int x, int y, int s) {
for (int i=0; i < s; s++) { Map[x-1-i,y-1-i] = true; Map[x+1+i,y+1+i] = true; Map[x-1-i,y+1+i] = true; Map[x+1+i,y-1-i] = true; }
}
Atur sendiri konstrainnya Perlu algoritma draw mapnya? Tidak kan? Soalnya itu mudah banget Dan... belum dites, tapi akurasinya cukup untuk menyelesaikan permasalahan tadi
| |
| | | Kuro Ethernite The Creator
Posts : 1631 Thanked : 24 Engine : RMVX Ace Skill : Masterful Type : Jack of All Trades
Trophies
Awards:
| Subyek: Re: [ASK] Soal algoritma . . . . 2012-04-06, 19:49 | |
| thanx then.... q cuma lgi males2ny mikir panjang ~ lgian q cuma butuh "logika" biar dapet koordinatny doank ~ maybe a little fix? atau sdikit kompres? - Code:
-
void Straight(int x, int y, int s) { for (i=s*-1; i <= s; i++) { Map(x,y+i) = true Map(x+i,y) = true }
- Code:
-
void Square(int x, int y, int s) { for (i=s*-1; i <= s; i++) { Map(x,y+i) = true for (j=s*-1; j <= s; j++) { Map(x+j,y) = true } }
- Code:
-
void Diagonal(int x, int y, int s) { for (int i=s*-1; i < s; i++) { Map(x+i,y+i) = true Map(x-i,y-i) = true }
Well.... Tinggal soal Diamond (msih ragu) ama Circle . . . . BTW sebisa mungkin line ny jangan panjang2 . . . . | |
| | | Mecha Byte Newbie
Posts : 36 Thanked : 0 Engine : RMXP Skill : Beginner Type : Scripter
| Subyek: Re: [ASK] Soal algoritma . . . . 2012-04-06, 19:58 | |
| Akhirnya datang Yang diamond
- Code:
-
void Diamond(int x, int y, int s) {
// Membuat segitiga atas int YStart = y-s
for (int i=0; i < s; s++) { Map(x,YStart +i) = true for (int j=0;j<i;j++) { Map(x,YStart +i) = true Map(x,YStart +i) = true } }
// Membuat segitiga bawah YStart = y+s
for (int i=0; i < s; s++) { Map(x,YStart -i) = true for (int j=0;j<i;j++) { Map(x-j,YStart -i) = true Map(x+j,YStart -i) = true } }
}
Udah ditambahin komen biar lebih jelas . Soal Circle, bisa beri contohnya yang bagaimana? Soalnya ada yang 4 sudut, 8 sudut.
| |
| | | Kuro Ethernite The Creator
Posts : 1631 Thanked : 24 Engine : RMVX Ace Skill : Masterful Type : Jack of All Trades
Trophies
Awards:
| Subyek: Re: [ASK] Soal algoritma . . . . 2012-04-06, 20:51 | |
| *sigh* aq yakin banget, klo ada langkah yg lbih pendek daripada demikian wait.... - Code:
-
void Diamond(int x, int y, int s){ t == 0; for (i=s*-1; i <= s; s++) { Map(x,y+i) = true if (i >= 0){ t--; } else{ t++; } for (j=0; j < t; j++) { Map(x+j,y) = true Map(x-j,y) = true } }
Is this acceptable? Kyakny q cuma mampu tergerak untuk ngedit milik orang.... About circle.... Seperti halny mmbuat lingkaran.... tentunya trigonometri wajib masuk (sin? cos? tan?) | |
| | | Mecha Byte Newbie
Posts : 36 Thanked : 0 Engine : RMXP Skill : Beginner Type : Scripter
| Subyek: Re: [ASK] Soal algoritma . . . . 2012-04-06, 21:25 | |
| | |
| | | eve Loli Mecha Mesum Musume
Posts : 1620 Thanked : 30 Engine : Other Skill : Beginner Type : Writer
Trophies
Awards:
| Subyek: Re: [ASK] Soal algoritma . . . . 2012-04-07, 05:15 | |
| lingkaran? - Code:
-
begin writeln('ooooxxoooo'); writeln('ooxxooxxoo'); writeln('xoooooooox'); writeln('xoooooooox'); writeln('ooxxooxxoo'); writeln('ooooxxoooo'); end. gitu aja kok repot... *kabur yang jauh | |
| | | Kuro Ethernite The Creator
Posts : 1631 Thanked : 24 Engine : RMVX Ace Skill : Masterful Type : Jack of All Trades
Trophies
Awards:
| Subyek: Re: [ASK] Soal algoritma . . . . 2012-04-12, 20:31 | |
| WTF ?! oke . . . . Porget about teh circle . . . . Diketahui . . . . - initialize:
ooooooooooooo ooaoooooooooo ooooooooooooo ooooooooooaoo ooooooxoooooo ooooooooooooo oooaooooooooo ooooooooooooo oooooooooooao
- process:
ooooooooooooo ooxoooooooooo oooxooooooooo ooooxxooxxxoo ooooooxxooooo ooooxxoxooooo oooxooooxxooo ooooooooooxoo oooooooooooxo
- hasil:
ooooooooooooo ooxoooooooooo ooooooooooooo ooooooooooxoo ooooooooooooo ooooooooooooo oooxooooooooo ooooooooooooo oooooooooooxo a = berupa array yang berisi informasi nilai [x,y]Intinya, x bergerak lurus / linear menuju tiap a yang ada secara bersamaan ~ | |
| | | Sponsored content
| Subyek: Re: [ASK] Soal algoritma . . . . | |
| |
| | | | [ASK] Soal algoritma . . . . | |
|
Similar topics | |
|
| Permissions in this forum: | Anda tidak dapat menjawab topik
| |
| |
| Latest topics | » [Web Novel] Gloria Infidelis by LightNightKnight 2016-11-17, 21:27
» [Announcement] Forum baru untuk RMID by TheoAllen 2016-08-25, 16:39
» Where I'm Wrong ? by ReydVires 2016-07-24, 16:10
» flakeheartnet's Resources part III by flakeheartnet 2016-07-08, 14:30
» Keira's Art Warehouse by KeiraBlaze 2016-06-28, 19:27
» Theo Core Time System + Bingung by Lockin 2016-06-27, 16:24
» Error Script, Maybe ? by Lockin 2016-06-27, 16:20
» Nusaimoe @ RMID Lounge by Jihad Bagas 2016-06-21, 05:02
» Call Random Battle by Lockin 2016-06-15, 17:04
» Flakeheartnet Resources Part II [come back gift] by flakeheartnet 2016-06-07, 15:51
|
Statistics
|
Members: [ 4947 ]
Topics: [ 8258 ]
Posts: [ 112606 ]
Newest member: [ https://rmid.forumotion.net/u4968 ]
|
|
|
|