Cov txheej txheem:

Matrix Code - Visual Basic: 7 Kauj Ruam
Matrix Code - Visual Basic: 7 Kauj Ruam

Video: Matrix Code - Visual Basic: 7 Kauj Ruam

Video: Matrix Code - Visual Basic: 7 Kauj Ruam
Video: Matrices in C# 2024, Hlis ntuj nqeg
Anonim
Matrix Code - Visual Basic
Matrix Code - Visual Basic

Qhov tshiab thiab txhim kho Visual Basic code yuav tso saib "Matrix" zoo li cov nyhuv, nrog scrolling One's thiab Zero's. Tom qab ntawd nws txiav mus rau Matrix "Wake Up Neo" ntu, thiab tom qab ntawv txuas ntxiv mus. Kuv xav tias txoj kev uas kuv ua piv txwv ntawm cov kab ntawm Ib thiab Zero yog qhov zoo tshaj plaws ntawm cov cai. Kuv tham raws nraim qhov kuv tau ua tom qab. Qhov Qhia no yog teb rau Brennn10's "Zoo Siab Txais Tos rau Matrix hauv Kev Hais Kom Ua Kom Zoo" Qhia. Cov cai uas ua rau Cov Lus Qhia no tau pib ua ntej ntawm cov cai tshaj tawm hauv kev tawm lus los ntawm DarkJoker ntawm cov lus qhia saum toj no. tshaj tawm qhov kev daws teeb meem no.

Kauj ruam 1: Lob Kuv Cov Cai

Kuv tau txuas kuv tus lej hauv qab no. Txuag ob qho ntaub ntawv (startMatrix.itsabat thiab matrix.itsavbs) nyob rau hauv tib lub nplaub tshev ntawm koj lub tshuab, thiab tshem tawm "nws" ib feem ntawm lub npe ntawv, piv txwv li hloov npe cov ntaub ntawv los pibMatrix.bat thiab matrix.vbs. Cov ntaub ntawv puav thiab vbs cov ntaub ntawv tuaj yeem ua tiav, thiab yog li kuv tsis tuaj yeem tso lawv nrog cov txuas ntxiv ntawm no. Qhov no yog vim li cas koj yuav tsum txuag thiab hloov npe lawv hauv zos.

Kauj ruam 2: Ua tiav Txoj Cai

Yog tias koj xav khiav kuv tus lej, ua raws cov lus qhia hauv qab no. Yog tias koj tsis xav ua qee yam ntawm koj lub tshuab uas koj tsis paub dab tsi txog, koj ntse. Koj yuav tsum mus rau kauj ruam tom ntej, qhov twg kuv taug kev los ntawm txoj cai thiab qhia koj tias kuv tsis tau ua dab tsi phem. Txawm li cas los xij, yog tias koj tsuas yog xav mus rau nws (lossis koj nyob ntawm lwm tus neeg lub tshuab thiab tsis ua saib xyuas), ntawm no yog yuav ncaws tawm txoj cai li cas: Kauj Ruam 1: ob-nias rau ntawm "startMatrix.bat". Tus ntawd yog nws. Tam sim no mus rau qib tom ntej los nyeem txog qhov txias uas koj nyuam qhuav pom.

Kauj Ruam 3: Nkag Siab Txoj Cai, Ntu 1

Cia peb saib cov cai, pib txij thaum pib. Vam tias koj tuaj yeem kawm paub txaus txog VB los ntawm kuv tus lej uas koj yuav tawm mus thiab kawm paub yuav ua li cas tus lej hauv VB zoo dua kuv:) Yog li thawj yam ua ntej, peb muaj 2 cov ntaub ntawv: ib qho puav thiab ib daim ntawv vbs. Yog tias koj kho cov ntaub ntawv bat, koj yuav pom tias nws ua tiav vbs cov ntaub ntawv, tom qab teeb tsa lub qhov rais, cov ntawv xim thiab lub qhov rais npe. Wb txav mus rau qhov nthuav ntau yam hauv cov ntaub ntawv vbs. FYI, Kuv tsuas yog mus kov ntawm cov kab txaus nyiam tshaj plaws ntawm cov cai ntawm no.. Cov no yog cov lus pom, thiab TSIS YUAV TSHUAJ. Thawj ob peb kab ntawm matrix.vbs hais tias "Teeb kuv cov lus yuam kev mus rau qhov qhia tsis meej" tab sis tib lub sijhawm "Tsis txhob cia ib qho yuam kev uas kuv tau ua rau neeg tuag taus." Tsis muaj kev sib tham tiag tiag. Line 5: Peb cov lus tsis meej ntawm no teeb tsa txhua qhov kev hloov pauv uas peb yuav siv thoob plaws lub neej ntawm peb txoj haujlwm me. Peb tsis tas yuav tshaj tawm hom rau cov kev hloov pauv no, lossis thawj qhov txiaj ntsig rau lawv, zoo li peb yuav ua qee yam lus. VB yog "muaj zog" zoo li no. Line 12: objSysInfo cia peb sau qee cov ntaub ntawv ntawm cov kab ke uas peb tab tom khiav. Peb tsim cov khoom ntawm no, thiab ntawm Kab 13, objSysInfo. UserName rov qab lub npe ntawm tus neeg siv tam sim no uas tau ua tiav txoj cai no. Qhov no yuav siv tom qab los ntawm "Neo", yog li peb Tsab Ntawv tuaj yeem hais "Wake up, Martin …" yog tias nws tau khiav ntawm kuv lub tshuab, lossis "Wake up, Brennn10 …" yog tias nws tau ua haujlwm ntawm Brennn10 lub tshuab thiab yog uas yog nws lub npe siv. Ua Tus Txheej Txheem lub npe siv tso cai rau koj pov nws rau ntawm koj tus phooj ywg lub tshuab xauv thiab nws yuav rub nws lub npe cia, tsis tas yuav hloov tus lej. Let's move on.

Kauj Ruam 4: Nkag Siab Txoj Cai, Ntu 2

Kab 16: sub tos rau yog peb thawj subroutine. Ib subroutine tuaj yeem raug hu los ntawm qhov chaw sib txawv hauv txoj cai, yuav ua tus lej nyob hauv lub cev ntawm subroutine, thiab tom qab ntawd yuav rov qab tswj hwm txoj haujlwm rau tus lej hu. tos rau teeb tsa peb lub plhaub rau peb. Los ntawm kev ua qhov no hauv lub voj nrog "pw tsaug zog" hauv lub voj, peb tso cai ua kom lub plhaub ua kom tiav ua ntej tswj kev xa rov qab, uas yog qhov zoo tshaj plaws. Line 26: sub matrix yog peb lub subroutine thib ob, thiab siv sijhawm parameter hu ua "elements". Subroutine no luam tawm cov lej txias uas zoo li "poob", zoo li hauv yeeb yaj kiab. Kuv tau siv qee yam los tso cai ntawm no. Vam tias los ntawm kev piav qhia lawv koj yuav nkag siab qhov twg kuv tuaj ntawm no thiab tuaj yeem ua nws zoo dua I. Ua ntej, Kuv xav tias koj tsuas xav tau 5 kab ntawm tus lej, thiab qhov "ntsiab lus" tau faib los ntawm tus lej (5). Qhov no tau yooj yim los lees paub vim tias tom qab ntawd kuv tshaj tawm cov kev ntsuas dhau mus rau "matrix" kom tau 200 thiab 100 (nws tau hu ua ob zaug). Kuv kuj xav tias koj xav tau txhua 5 kab qhib los ntawm lub neej ntawd. Kuv xav tias nws zoo li OK, tab sis koj tuaj yeem hloov qee qhov ntawm no mus rau FALSE yog tias koj xav tau thawj kab ntawm cov lej kom zoo li tsis zoo li qhov seem ntawm kab yuav yog. OK, yog li peb muaj 5 kab, peb muaj 200 / 5 = 40 kab ntawm cov lej los tso saib (kabToWrite), thiab tag nrho peb kab ntawv tau qhib los ntawm lub neej ntawd. Line 41: peb nkag mus rau ob "rau" loops, thawj ntawm (Loop A) mus los ntawm peb kabToWrite thiab thib ob (Loop B) uas mus los ntawm cov kab. Hauv Loop B, peb Xaiv ntawm tus nqi ntawm lub voj sib txawv loopB, thiab nyob ntawm nws tus nqi peb ntsuas qhov Yog-Lwm nqe lus. Yog tias kab lus nug tau qhib ("TRUE", lossis "qhib rau"), peb yuav luam tawm, ntawm "wshshell. SendKeys", tus nqi ntawm Int (Round (rnd ()))), tom qab ntawv. Txwv tsis pub, peb yuav luam tawm tsuas yog ib lub tab, xws li kab lus zoo li tsis muaj dab tsi li. Dab tsi yog tus nqi ntawm Int (Hloov (rnd ()))? rnd () xa rov qab tus lej lej zauv nruab nrab ntawm 0.0 thiab 1.0, Hloov () yuav coj tus nqi ntawd thiab muab nws pauv mus rau tus lej suav ze tshaj, thiab Int () pov cov txiaj ntsig mus rau Integer. Cov kauj ruam kawg no tuaj yeem suav tias yog overkill, txij li Round () hu yuav tsum muab rau peb 0 lossis 1. Kuv tau ua nws tsuas yog vim tus cwj pwm. Qee lub sijhawm qee tus neeg yuav tsum tau hais rau kuv tias nws muaj kev nyab xeeb dua, thiab kuv pom tias tseem tsis tau hnov qab nws li. Mus rau Ntu 3 …

Kauj Ruam 5: Nkag Siab Txoj Cai, Ntu 3

Txuas ntxiv rau Matrix, ntawm no yog ob peb kab tom ntej ntawm VB… muab OFF 30 feem pua ntawm lub sijhawm. turnOffMax = 0.30 turnOnMax = 0.30Toggling txhua kem 30% ntawm lub sijhawm ua rau tus lej kab "poob" hauv kev zam zoo ib yam li lawv ua hauv yeeb yaj kiab. Tsis meej, tab sis kaw. 'Kab 1 flip-flop flipMe = rnd () Yog tias ((col1 = tig rau) thiab (flipMe <turnOffMax)) Tom qab ntawd col1 = tig mus rau lwm qhov Yog ((col1 = tau qhib) thiab (flipMe <turnOnMax)) saum toj no thaiv kev ua li cas peb txiav txim siab seb peb puas yuav tso tus lej hauv kab ntawv muab rau thaum lub sijhawm rov ua dua, rau kab tom ntej ntawm tus lej. Txoj cai nyeem "yog tias kem qhib, thiab tus lej tsis raug hu ua flipMe tsawg dua 30%, tua kab ntawv. Txwv tsis pub, yog tias kem tawm thiab flipMe tsawg dua 30%, qhib kab ntawv." up sub Matrix. Mus rau sub key…

Kauj Ruam 6: Sub Key ()

Txoj hauv kev tseem ceeb yog hauv qab no.sub qhov tseem ceeb (msg) 'ua luam tawm ntawm "matrix" cov lus, thiab tshem tawm lawv cov lus.sleep 1500length = len (msg) rau txoj haujlwm = 1 kom ntev wshshell. SendKeys nruab nrab (msg, txoj haujlwm, 1) wscript.sleep 250nextwscript.sleep 3000 rau txoj haujlwm = 1 kom ntev wshshell. SendKeys "{BACKSPACE}" wscript.sleep 75nextend subThis method prints out a string "msg". Nws yuav luam txhua yam koj hla nws. Txoj kev no yog hu ua tom qab ntawm tus lej. Qhov thawj rau lub voj luam tawm txhua tus cim hauv txoj hlua, ib zaug, thiab ncua rau 250 milliseconds nyob nruab nrab ntawm txhua tus cim. Peb mam li pw tsaug zog rau 3000 millis (3 vib nas this) thiab sau ib qho backspace rau txhua tus cim uas peb tau luam tawm yav dhau los, tsaug zog lub sijhawm no tsawg me ntsis. Qhov ntawd yog txhua yam rau nws. Nyob rau lub cev tseem ceeb ntawm txoj haujlwm, txhua yam los ua ke.

Kauj ruam 7: Qhov tseem ceeb

Kev ua tiav tseem ceeb ntawm txoj haujlwm hu rau waitFor thiab matrix (uas peb twb tau hais tseg lawm) los teeb tsa txhua yam thiab sau tawm 200 tus lej binary, kis thoob 5 kab. Lub npe ntawm cov neeg siv tam sim no tau rub thiab muab coj los luam tawm ua ib feem ntawm "sawv" ntu. Peb tom qab ntawd nkag mus rau FOR loop, uas peb paub tias peb yuav rov ua dua 4 zaug vim yog "1" Rau 4 "kev txwv. Peb mam li xaiv ntawm peb lub voj sib txawv (loopA), uas phim thawj CASE nqe lus thawj zaug dhau los, nqe lus CASE thib ob zaum thib ob los ntawm lub voj, thiab lwm yam. cov lus piav qhia peb xav luam tawm, thiab qhov tseem ceeb subroutine raug hu los ua qhov luam ntawv tiag. Muaj ntau qhov pom tseeb ntau txoj hauv kev los tsim lub voj no, thiab kuv yuav tso qhov ntawd los ua ib qho kev tawm dag zog rau tus nyeem ntawv. Thaum peb tawm ntawm FOR loop, peb tau rov hu lub matrix subroutine los luam tawm ntau tus lej. Raws li cov lus hais hauv txoj cai hais tias, koj tuaj yeem tso qhov kev hu zaum kawg rau matrix () hauv lub voj yog tias koj xav tau, lossis koj tsuas tuaj yeem hu nws nrog tus lej loj, thiab lwm yam Thaum kawg, peb hu rau txiav tawm () rho tawm txoj haujlwm kev ua tiav (ib txwm ua tau zoo: P). Yog tias Cov Lus Qhia no tau ua rau koj xav paub nrog VB, Google tuaj yeem muab ntau qhov peev txheej zoo los kawm paub ntau ntxiv txog nws ntau dua li kuv tuaj yeem qhia koj. Zoo siab coding! martin

Pom zoo: