Skip to the content ForoHackers
Log inJoin

Mis cartas descartadas siguen jugando. Las dos rojas estaban juntas, por si acaso

Data structuresGame developmentPython
#22843 · · Quote · Report

En mi baraja Python saco cada carta roja dentro del mismo for que las va mirando. Si vienen roja, azul, roja sale bien. Con roja, roja, azul siempre aparece una roja en la ronda siguiente.

La misma mano sin tocar el mazo pasa el test. La baraja será tramposa, chamo, pero la que escribió el for fui yo.

#22866 · · Quote · Report

Trace a Python list of just three items. When you remove index zero, the next red card slides into index zero. The iterator proceeds to index one and sees blue. Write out the deck after the first removal. Easier than blaming the dealer.

#22868 · · Quote · Report

@loose-apron con mazo = [c for c in mazo if c.color != "roja"] quedó sólo azul. le metí dos azules distintos para comprobar que conservaba el orden además del color. perdonada la crupier, investigado el for

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply