Entrar
¿Nuevo usuario? Inscribirme
squeakRos
? ¿Ya estás suscrito? Entra a Yahoo!

Consejos

¿Sabías que...?
Podés cambiar el orden de los mensajes. Simplemente hacé clic en el enlace de columna fecha. Tus preferencias se guardarán, por lo tanto no necesitarás hacerlo otra vez cuando vuelvas a entrar.

Mensajes

  Mensajes Ayuda
Avanzado
[TEG] ...A Bridge Too Far (1977)   Lista de mensajes  
Responder | Reenviar Mensaje #1451 de 3477 |
http://www.imdb.com/title/tt0075784/

Es el sitio donde podran ver algo sobre esta película (Alguno la vio ?)

Les cuento que llegue al punto donde he resuelto los problemas que impedían
que se pueda empezar a jugar mal.

Así que espero que algunos se unan como mini equipo de apoyo a Luciano para
terminarlo , aprender y documentarlo.

Como la forma apropiada (según el Lic. Oca) de sacar todo es via fileOut de
un st y existiendo 60 de la vieja época y 11 cs del TEGWeb en proceso,
adjunto un Morphic-TEG.71.st.

Para referencia histórica e incluir en la documentación agrego los módulos
del programa original en Pascal, el 20 cuando ya empezaba a tener forma
(mucho sigue igual) y el 60 que como dije fue el último documentado para
hacer un TEG via Sockets , con varias imagenes e intercambiando objetos
completos via LAN.

La idea es llevarlo totalmente a Smalltalk, yo lo limpie algo, la
inicialización ahora está totalmente oculta , no se accede a ningún archivo
externo y solo funciona el juego en la imagen grande donde esta cargado y en
su propia imagen TEGWeb.image que solo será entregada a quienes se
comprometan a seguir mejorando el juego para que se pueda acceder desde un
navegador común (recomendamos Firefox) a una imagen que esté funcionando en
un server.

El directorio STEG con los dibujos y morphs que se usaron está en el ftp de
SqueakRos accesible con la imagen 3.7.2 y sus descendientes.

Pueden existir versiones STEG.zip desparramadas e incompletas por ahí.

Edgar



Sáb, 20 de May, 2006 8:34 pm

edgardec2001
Sin conexión Sin conexión
Enviar correo Enviar correo

Morph subclass: #DrawCard instanceVariableNames: 'nombre deQuienSoy numero'
classVariableNames: '' poolDictionaries: '' category: 'Morphic-TEG'!
!DrawCard methodsFor: 'initialization' stamp: 'edc 3/27/2006 07:41'!
dibujaUnaCarta: t1 | t2 t3 t4 t5 | self numero: t1. t4 _ #(Soldado1 Canon
Caballo ). t1 > 42 ifTrue: [t3 _ self top + 5. t4 do: [:t6 |
self addMorph: (DrawPicture new initializeWith: t6 escala: 0.7). self
submorphs first center: self center. self submorphs first top: t3. t3
_ t3 + 40]] ifFalse: [t5 _ t1 \\\ 3 + 1. self addMorphBack:
(DrawPicture new initializeWith: (t4 at: t5) valor: t1 pos:
self left + 20 @ self center y). t2 _ StringMorph contents: self nombre.
t2 center: self center. t2 top: self top + 8. self addMorphBack: t2]! !
!DrawCard methodsFor: 'initialization'! initialize super initialize. self
setProperty: #dragEnabled toValue: true. self extent: 80 @ 120. self color:
Color lightGray. self borderColor: Color black. self borderWidth: 2! !
!DrawCard methodsFor: 'initialization'! initializeOff self addMorph: (Form
fromFileNamed: 'TEGCarta.png') asMorph! ! !DrawCard methodsFor:
'initialization'! nombre: t1 limites: t2 | t3 t4 t5 | nombre _ t1. ejEnPais
_ 0. self vertices: t2 asArray color: Color white borderWidth: 2
borderColor: Color black. t4 _ self center. t5 _ Morph new. t5 bounds:
(Rectangle left: t4 x right: t4 x + 15 top: t4 y bottom: t4 y +
10). t5 color: Color white. self addMorph: t5. t3 _ TextMorph new. t3
autoFit: true. t3 string: ejEnPais asString fontName: #ComicBold size: 18
wrap: false. t3 contents: ejEnPais asString. t3 bounds: t5. t3 centered.
self addMorph: t3. t3 lock! ! !DrawCard methodsFor: 'access'! deQuienSoy ^
deQuienSoy! ! !DrawCard methodsFor: 'access'! deQuienSoy: t1 deQuienSoy _ t1!
! !DrawCard methodsFor: 'access'! nombre ^ nombre! ! !DrawCard methodsFor:
'access'! nombre: t1 nombre _ t1! ! !DrawCard methodsFor: 'access'! numero ^
numero! ! !DrawCard methodsFor: 'access'! numero: t1 numero _ t1! !
!DrawCard methodsFor: 'event handling'! click: t1 ^ self! ! !DrawCard
methodsFor: 'event handling'! doubleClick: t1 submorphs first ifNil: [^ 0].
submorphs first delete. self dibujaUnaCarta: numero! ! !DrawCard methodsFor:
'event handling'! handlesMouseDown: t1 ^ true! ! !DrawCard methodsFor: 'event
handling'! mouseDown: t1 t1 hand waitForClicksOrDrag: self event: t1. t1 hand
grabMorph: self! ! IconicButton subclass: #DrawPicture
instanceVariableNames: 'estado valor' classVariableNames: 'MisDibujos'
poolDictionaries: '' category: 'Morphic-TEG'! !DrawPicture methodsFor: 'as yet
unclassified'! estado ^ estado! ! !DrawPicture methodsFor: 'as yet
unclassified' stamp: 'edc 3/26/2006 09:22'! estado: t1 | t2 | estado := t1.
estado ifTrue: [t2 := submorphs first form. t2 mapColor: Color white to:
Color lightRed] ifFalse: [t2 := submorphs first form. t2 mapColor: Color
lightRed to: Color white]. ! ! !DrawPicture methodsFor: 'as yet unclassified'
stamp: 'edc 10/19/2004 08:29'! initializeWith: t1 self labelGraphic:
(MisDibujos at: t1).! ! !DrawPicture methodsFor: 'as yet unclassified' stamp:
'edc 10/19/2004 16:03'! initializeWith: t1 escala: t2 | t3 | t3 _ MisDibujos
at: t1. t3 _ t3 magnify: t3 boundingBox by: t2. self labelGraphic: t3. self
setSwitchState: false! ! !DrawPicture methodsFor: 'as yet unclassified' stamp:
'edc 10/19/2004 16:10'! initializeWith: t1 valor: t2 pos: t3 | t4 | valor _
t2. self estado: false. t4 _MisDibujos at: t1. self labelGraphic: t4. self
position: t3. self borderNormal! ! !DrawPicture methodsFor: 'as yet
unclassified' stamp: 'edc 3/24/2006 10:14'! initializeWith: t1 valor: t2 rect:
t3 | t4 | valor := t2. t4 := MisDibujos at: t1. self labelGraphic: t4.
self estado: false. self bounds: t3. self comeToFront! ! !DrawPicture
methodsFor: 'as yet unclassified'! mouseUp: t1 (self containsPoint: t1
cursorPoint) ifTrue: [self setSwitchState: estado = false. self
doButtonAction] ifFalse: [self setSwitchState: estado = true]! ! !DrawPicture
methodsFor: 'as yet unclassified' stamp: 'edc 3/14/2006 12:13'! setSwitchState:
t1 t1 ifTrue: [self borderColor: #inset. self estado: true] ifFalse:
[self borderColor: #raised. self estado: false]. ! ! !DrawPicture
methodsFor: 'as yet unclassified'! valor ^ valor! ! !DrawPicture methodsFor:
'as yet unclassified' stamp: 'edc 3/19/2006 08:22'! webClick: aPoint (self
containsPoint: aPoint ) ifTrue: [self setSwitchState: estado not].! ! "-- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! DrawPicture class
instanceVariableNames: ''! !DrawPicture class methodsFor: 'objects from disk'
stamp: 'edc 5/12/2006 07:59'! inicializarDibujos "DrawPicture inicializarDibujos
Este método se ejecuta una única vez, seleccionando previamente el directorio
donde están los dibujos" | dir oldFolder | oldFolder := FileDirectory default.
dir := UIManager default chooseDirectory. FileDirectory setDefaultDirectory: dir
pathName. MisDibujos _ Dictionary new. MisDibujos at: #Soldado1 put: (Form
fromFileNamed: 'Soldado1.gif'). MisDibujos at: #Soldado5 put: (Form
fromFileNamed: 'Soldado5.gif'). MisDibujos at: #Soldado10 put: (Form
fromFileNamed: 'Soldado10.gif'). MisDibujos at: #Soldado20 put: (Form
fromFileNamed: 'Soldado10.gif'). MisDibujos at: #Soldado50 put: (Form
fromFileNamed: 'Soldado50.gif'). MisDibujos at: #Ok put: (Form
fromFileNamed:'OK.gif'). MisDibujos at: #Cancel put: (Form fromFileNamed:
'Cancel.gif'). MisDibujos at: #Muerte put: (Form fromFileNamed: 'muerte.gif').
MisDibujos at: #Split put: (Form fromFileNamed: 'Split.gif'). MisDibujos at:
#Caballo put: (Form fromFileNamed: 'Caballo.gif'). MisDibujos at: #Canon put:
(Form fromFileNamed: 'Canon.gif'). MisDibujos at: #CardsDLOG put: (Form
fromFileNamed:'CardsDLOG.gif'). FileDirectory setDefaultDirectory: oldFolder
pathName. ! ! !DrawPicture class methodsFor: 'objects from disk' stamp: 'edc
5/6/2006 07:15'! misDibujos " DrawPicture misDibujos" ^MisDibujos ! !
HVTransientView subclass: #HVTEG instanceVariableNames: '' classVariableNames:
'' poolDictionaries: '' category: 'Morphic-TEG'! !HVTEG commentStamp:
'<historical>' prior: 0! HVTEG startDebugOn: 8000 HVTEG stop! !HVTEG
methodsFor: 'urls' stamp: 'edc 3/24/2006 08:03'! alaska ^self cualPais:
'Alaska'! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006 08:19'! aral ^self
cualPais: 'Aral'! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006 08:04'!
argentina ^self cualPais: 'Argentina' ! ! !HVTEG methodsFor: 'urls' stamp:
'edc 3/24/2006 10:05'! ataque self model ataque. ^ self redirectTo: #step! !
!HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006 09:27'! boton1 | losboton
miboton | losboton := self model botones. miboton := losboton at: 1. ^ self
switchButton: miboton! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006
09:27'! boton2 | losboton miboton | losboton := self model botones. miboton
:= losboton at: 2. ^ self switchButton: miboton! ! !HVTEG methodsFor: 'urls'
stamp: 'edc 3/24/2006 09:27'! boton3 | losboton miboton | losboton := self
model botones. miboton := losboton at: 3. ^ self switchButton: miboton! !
!HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006 09:27'! boton4 | losboton
miboton | losboton := self model botones. miboton := losboton at: 4. ^ self
switchButton: miboton! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006
09:27'! boton5 | losboton miboton | losboton := self model botones. miboton
:= losboton at: 5. ^ self switchButton: miboton! ! !HVTEG methodsFor: 'urls'
stamp: 'edc 3/24/2006 09:27'! boton6 | losboton miboton | losboton := self
model botones. miboton := losboton at: 6. ^ self switchButton: miboton! !
!HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006 09:27'! boton7 | losboton
miboton | losboton := self model botones. miboton := losboton at: 7. ^ self
switchButton: miboton! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006
09:27'! boton8 | losboton miboton | losboton := self model botones. miboton
:= losboton at: 8. ^ self switchButton: miboton! ! !HVTEG methodsFor: 'urls'
stamp: 'edc 3/24/2006 09:28'! boton9 | losboton miboton | losboton := self
model botones. miboton := losboton at: 9. ^ self switchButton: miboton! !
!HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006 08:04'! brasil ^self cualPais:
'Brasil'. ! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/26/2006 08:39'! britain
^self cualPais: 'Britain'.! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/26/2006
08:36'! california ^self cualPais: 'California'! ! !HVTEG methodsFor: 'urls'
stamp: 'edc 3/26/2006 08:36'! china ^self cualPais: 'China'! ! !HVTEG
methodsFor: 'urls' stamp: 'edc 3/24/2006 10:05'! continuar self model continue.
^ self redirectTo: #step! ! !HVTEG methodsFor: 'urls' stamp: 'edc 5/16/2006
15:09'! cualPais: aString | paises elPais | paises := self model
submorphsSatisfying: [:t7 | t7 isKindOf: PaisMorph]. elPais := paises
detect: [:p | p nombre = aString]. model lastMorph: elPais. elPais clickWeb.
self halt. (model statusFor: ModAuth user ) ifTrue: [^ self redirectTo:
#pause] ifFalse: [^ self redirectTo: #step]! ! !HVTEG methodsFor: 'urls'
stamp: 'edc 5/9/2006 06:33'! default | builder juega | builder := self
builder. juega := model addClient: ModAuth user. juega ifTrue: [builder :=
self builder. builder html: '<meta http-equiv="Refresh" content="15" >'.
builder html: '<img src="http://localhost:8000/screen">'. builder hr;
srcLink; end. ^ builder] ifFalse: [^ self redirectTo: #step]! ! !HVTEG
methodsFor: 'urls' stamp: 'edc 3/25/2006 18:00'! eastocean ^self cualPais:
'EastOcean'! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006 08:25'! egipto
^self cualPais: 'Egipto'! ! !HVTEG methodsFor: 'urls' stamp: 'edc 4/12/2006
10:47'! espania ^self cualPais: 'Espania'! ! !HVTEG methodsFor: 'urls' stamp:
'edc 3/24/2006 08:00'! etiopia ^self cualPais: 'Etiopía'! ! !HVTEG
methodsFor: 'urls' stamp: 'edc 3/30/2006 11:55'! finAtaque self model
fortificar. ^ self redirectTo: #step! ! !HVTEG methodsFor: 'urls' stamp: 'edc
3/30/2006 11:57'! finataque self model fortificar. ^ self redirectTo: #step! !
!HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006 08:05'! florida ^self cualPais:
'Florida'! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/27/2006 09:07'! fortificar
self model fortificar. ^ self redirectTo: #step! ! !HVTEG methodsFor: 'urls'
stamp: 'edc 3/24/2006 08:27'! france ^self cualPais: 'France'! ! !HVTEG
methodsFor: 'urls' stamp: 'edc 3/24/2006 08:06'! germany ^self cualPais:
'Germany'! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006 08:27'! gobi
^self cualPais: 'Gobi'! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006
08:06'! groenland ^self cualPais: 'Groenland'! ! !HVTEG methodsFor: 'urls'
stamp: 'edc 3/24/2006 08:27'! india ^self cualPais: 'India'! ! !HVTEG
methodsFor: 'urls' stamp: 'edc 3/24/2006 08:06'! island ^self cualPais:
'Island'! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006 08:28'! italia
^self cualPais: 'Italia'! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006
08:28'! japon ^self cualPais: 'Japón'! ! !HVTEG methodsFor: 'urls' stamp:
'edc 3/24/2006 08:28'! kamchatka ^self cualPais: 'Kamchatka'! ! !HVTEG
methodsFor: 'urls' stamp: 'edc 3/24/2006 08:29'! labrador ^self cualPais:
'Labrador'! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006 08:29'!
madagascar ^self cualPais: 'Madagascar'! ! !HVTEG methodsFor: 'urls' stamp:
'edc 3/24/2006 08:29'! malasia ^self cualPais: 'Malasia'! ! !HVTEG methodsFor:
'urls' stamp: 'edc 3/24/2006 08:06'! mexico ^self cualPais: 'Mexico'! ! !HVTEG
methodsFor: 'urls' stamp: 'edc 3/24/2006 08:30'! mongolia ^self cualPais:
'Mongolia'! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/30/2006 11:36'! newyork
^self cualPais: 'NewYork'! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/26/2006
08:20'! newzeland ^self cualPais: 'NewZeland'! ! !HVTEG methodsFor: 'urls'
stamp: 'edc 3/24/2006 08:07'! oregon ^self cualPais: 'Oregon'! ! !HVTEG
methodsFor: 'urls' stamp: 'edc 5/13/2006 06:56'! pause | status | status :=
TEGMain current statusFor: ModAuth user . status ifTrue:[^self
step ] ifFalse: [ ^ '<HTML> <HEAD> <TITLE>Squeak TEG</TITLE>
</HEAD> <meta http-equiv="Refresh" content="10" > <BODY> <br> <img
src="http://localhost:8000/screen"> <br> <h3>You are in pause now </h3>
</BODY> </HTML>']! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006 08:07'!
peru ^self cualPais: 'Peru'! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/23/2006
11:39'! refresh | builder | builder := self builder. model grabaFoto.
builder html: '<img src= "http://localhost:81/STEG/TEG.jpg" width="750"
height="490" border="0" '. ^ builder.! ! !HVTEG methodsFor: 'urls' stamp:
'edc 3/24/2006 08:30'! rusia ^self cualPais: 'Rusia'! ! !HVTEG methodsFor:
'urls' stamp: 'edc 3/24/2006 08:31'! sahara ^self cualPais: 'Sahara'! ! !HVTEG
methodsFor: 'urls' stamp: 'edc 3/24/2006 08:31'! scandinav ^self cualPais:
'Scandinav'! ! !HVTEG methodsFor: 'urls' stamp: 'edc 5/8/2006 10:42'! screen ^
TEGMain current grabaFoto! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006
08:31'! siberia ^self cualPais: 'Siberia'! ! !HVTEG methodsFor: 'urls' stamp:
'edc 5/9/2006 07:43'! step | builder button | builder := self builder.
builder postForm. builder html: '<img
src="http://localhost:8000/screen"usemap="#Map"> '. builder html: '<map
name="Map"> <area shape="poly"
coords="132,420,74,454,73,462,85,471,62,469,57,460,61,451,89,379,103,387,111,385\
,131,401" href="argentina"> <area shape="rect" coords= "102,454,147 ,468 "
href="ataque "> <area shape="rect" coords= "225,454,292 ,468 " href="finataque
"> <area shape="rect" coords= "367,454,431 ,468 " href="continuar "> <area
shape="rect" coords= "508,454,568 ,468 " href="fortificar "> <area shape="rect"
coords= "643,454,684 , 468" href="debug "> <area shape="rect" coords=
"200,420,240 , 440" href="boton1 "> <area shape="rect" coords= "245,420,285 ,
440" href="boton2 "> <area shape="rect" coords= "290,420,330 , 440" href="boton3
"> <area shape="rect" coords= "335,420,375 , 440" href="boton4 "> <area
shape="rect" coords= "380,420,420 , 440" href="boton5 "> <area shape="rect"
coords= "425,465,465 , 440" href="boton6 "> <area shape="rect" coords=
"470,420,510 , 440" href="boton7 "> <area shape="rect" coords= "515,420,555 ,
440" href="boton8 "> <area shape="rect" coords= "560,420,600 , 440" href="boton9
"> <area shape="poly" coords="69 ,316 ,97 ,324 ,99 ,332 ,100 ,340 ,111 ,351
,133 ,374 ,129 ,393 ,115 ,382 ,92 ,378 ,68 ,354 ,69 ,317" href="peru "> <area
shape="poly" coords="62 ,324 ,202 ,341 ,212 ,354 ,179 ,392 ,164 ,390 ,137 ,417
,135 ,396 ,139 ,375 ,115 ,350 ,101 ,333 ,120 ,320" href="brasil "> <area
shape="poly" coords=" 84 ,293 ,103 ,291 ,115 ,300 ,125 ,296 ,158 ,314 ,161 ,321
,124 ,318 ,105 ,325 ,72 ,313 ,80 ,299 ,85 ,292" href="venezuela "> <area
shape="poly" coords=" 50 ,228 ,78 ,226 ,97 ,241 ,97 ,255 ,112 ,260 ,111 ,275
,114 ,295 ,105 ,288 ,79 ,265 ,66 ,263 ,47 ,241 " href="mexico"> <area
shape="poly" coords=" 129 ,192 ,154 ,193 ,175 ,215 ,193 ,208 ,223 ,209 ,174 ,228
,144 ,237 ,149 ,257 ,140 ,256 ,125 ,246 ,100 ,245 " href="florida"> <area
shape="poly" coords=" 48 ,180 ,126 ,192 ,121 ,201 ,113 ,210 ,108 ,219 ,100 ,227
,95 ,237 ,77 ,224 ,50 ,225 ,40 ,215 ,41 ,197 " href="california"> <area
shape="poly" coords=" 58 ,139 ,123 ,143 ,120 ,189 ,49 ,177 ,47 ,173 ,44 ,163 ,53
,158 ,61 ,153 ,61 ,139 ,82 ,138 ,104 ,140 " href="oregon"> <area shape="poly"
coords=" 128 ,141 ,168 ,143 ,178 ,152 ,170 ,168 ,189 ,181 ,183 ,205 ,174 ,210
,158 ,190 ,125 ,187 ,125 ,168 ,125 ,151 " href="newyork"> <area shape="poly"
coords=" 204 ,153 ,213 ,153 ,218 ,164 ,229 ,161 ,235 ,170 ,251 ,173 ,252 ,179
,237 ,186 ,224 ,196 ,215 ,205 ,186 ,201 " href="labrador"> <area shape="poly"
coords=" 10 ,88 ,41 ,77 ,62 ,90 ,63 ,135 ,54 ,139 ,58 ,151 ,45 ,157 ,49 ,147 ,40
,131 ,18 ,136 ,15 ,115 " href="alaska"> <area shape="poly" coords=" 66 ,92
,93 ,92 ,131 ,106 ,161 ,111 ,184 ,99 ,205 ,115 ,187 ,137 ,66 ,136 ,65 ,118 ,64
,99 ,65 ,93 " href="yukon"> <area shape="poly" coords=" 293 ,56 ,314 ,76 ,284
,136 ,314 ,105 ,269 ,147 ,260 ,133 ,250 ,110 ,240 ,92 ,227 ,90 ,236 ,76 ,246 ,54
" href="groenland"> <area shape="poly" coords=" 268 ,159 ,274 ,156 ,279 ,155
,288 ,158 ,292 ,164 ,291 ,169 ,287 ,172 ,281 ,174 ,274 ,174 ,267 ,168 ,263 ,162
" href="island"> <area shape="poly" coords=" 300 ,164 ,314 ,157 ,329 ,157
,336 ,183 ,330 ,207 ,319 ,204 ,308 ,216 ,300 ,217 ,286 ,218 ,280 ,201 ,298 ,185
" href="scandinav"> <area shape="poly" coords=" 333 ,158 ,347 ,160 ,351 ,169
,389 ,147 ,393 ,177 ,389 ,207 ,367 ,225 ,359 ,267 ,315 ,249 ,313 ,232 ,321 ,222
" href="germany"> <area shape="poly" coords=" 291 ,230 ,309 ,230 ,312 ,239
,314 ,246 ,306 ,249 ,299 ,251 ,292 ,257 ,286 ,253 ,279 ,248 ,280 ,242 ,285 ,237
" href="france"> <area shape="poly" coords=" 278 ,235 ,273 ,241 ,266 ,238
,260 ,239 ,259 ,244 ,253 ,239 ,253 ,232 ,259 ,228 ,261 ,219 ,268 ,217 ,275 ,223
" href="britain"> <area shape="poly" coords=" 277 ,248 ,266 ,253 ,267 ,261
,249 ,262 ,245 ,267 ,254 ,281 ,265 ,279 ,272 ,268 ,288 ,268 ,294 ,260 ,285 ,254
" href="espania"> <area shape="poly" coords=" 292 ,268 ,295 ,263 ,300 ,255
,307 ,252 ,313 ,251 ,321 ,255 ,327 ,262 ,323 ,266 ,319 ,270 ,310 ,269 ,304 ,282
" href="italia"> <area shape="poly" coords=" 393 ,146 ,397 ,175 ,394 ,202
,408 ,203 ,428 ,210 ,441 ,222 ,447 ,228 ,453 ,221 ,446 ,154 ,431 ,103 ,415 ,134
" href="rusia"> <area shape="poly" coords=" 367 ,226 ,390 ,210 ,407 ,205 ,426
,212 ,440 ,225 ,443 ,236 ,426 ,249 ,423 ,265 ,403 ,271 ,386 ,268 ,365 ,268 "
href="mongolia"> <area shape="poly" coords=" 319 ,274 ,329 ,260 ,361 ,270
,371 ,282 ,393 ,301 ,368 ,311 ,341 ,293 ,339 ,281 ,334 ,275 ,327 ,275 ,323 ,273
" href="turquia"> <area shape="poly" coords=" 369 ,273 ,386 ,271 ,420 ,270
,439 ,268 ,452 ,271 ,454 ,276 ,452 ,282 ,435 ,308 ,429 ,310 ,420 ,299 ,388 ,289
" href="india"> <area shape="poly" coords=" 503 ,100 ,466 ,100 ,464 ,110 ,439
,113 ,444 ,137 ,448 ,169 ,454 ,222 ,462 ,225 ,471 ,220 ,484 ,190 ,482 ,156 "
href="gobi"> <area shape="poly" coords=" 533 ,96 ,508 ,100 ,496 ,126 ,484
,154 ,499 ,158 ,514 ,155 ,530 ,162 ,531 ,173 ,546 ,173 ,561 ,145 ,570 ,109 "
href="tamir"> <area shape="poly" coords=" 571 ,107 ,581 ,103 ,595 ,107 ,593
,124 ,586 ,152 ,575 ,167 ,572 ,195 ,562 ,199 ,554 ,179 ,549 ,173 ,557 ,160 "
href="kamchatka"> <area shape="poly" coords=" 486 ,158 ,502 ,162 ,514 ,157
,528 ,163 ,529 ,174 ,522 ,187 ,514 ,196 ,516 ,210 ,477 ,217 ,480 ,204 ,489 ,183
" href="siberia"> <area shape="poly" coords=" 435 ,247 ,451 ,228 ,464 ,227
,474 ,228 ,483 ,235 ,499 ,238 ,508 ,242 ,516 ,248 ,510 ,267 ,499 ,276 ,426 ,263
" href="china"> <area shape="poly" coords=" 515 ,212 ,484 ,217 ,478 ,222 ,479
,229 ,488 ,233 ,497 ,235 ,510 ,242 ,517 ,247 ,523 ,250 ,527 ,232 ,518 ,227 "
href="tsamir"> <area shape="poly" coords=" 531 ,177 ,542 ,175 ,549 ,177 ,545
,186 ,535 ,191 ,537 ,215 ,532 ,230 ,521 ,229 ,518 ,213 ,515 ,201 ,523 ,190 "
href="aral"> <area shape="poly" coords=" 555 ,215 ,566 ,214 ,568 ,219 ,563
,226 ,562 ,242 ,554 ,251 ,547 ,267 ,541 ,267 ,542 ,259 ,547 ,247 ,554 ,234 "
href="japon"> <area shape="poly" coords=" 455 ,271 ,473 ,271 ,485 ,277 ,495
,280 ,500 ,291 ,494 ,299 ,483 ,297 ,499 ,316 ,494 ,321 ,470 ,305 ,458 ,291 "
href="malasia"> <area shape="poly" coords=" 482 ,322 ,491 ,322 ,498 ,320 ,505
,318 ,511 ,315 ,517 ,325 ,526 ,329 ,528 ,338 ,518 ,341 ,510 ,345 ,490 ,347 "
href="sumatra"> <area shape="poly" coords=" 546 ,327 ,557 ,328 ,571 ,328 ,584
,333 ,586 ,344 ,572 ,344 ,562 ,341 ,555 ,340 ,545 ,339 ,538 ,335 ,541 ,328 "
href="newzeland"> <area shape="poly" coords=" 544 ,352 ,551 ,347 ,563 ,352
,572 ,352 ,589 ,360 ,589 ,376 ,586 ,390 ,571 ,395 ,541 ,391 ,537 ,379 ,541 ,373
" href="eastocean"> <area shape="poly" coords=" 515 ,362 ,528 ,351 ,540 ,354
,539 ,371 ,533 ,378 ,537 ,392 ,532 ,400 ,517 ,404 ,499 ,391 ,494 ,380 ,509 ,372
" href="westocean"> <area shape="poly" coords=" 239 ,286 ,287 ,285 ,280 ,295
,278 ,303 ,306 ,319 ,313 ,338 ,317 ,360 ,283 ,358 ,248 ,344 ,221 ,331 ,216 ,310
" href="sahara"> <area shape="poly" coords=" 291 ,290 ,332 ,290 ,349 ,303
,322 ,307 ,314 ,313 ,310 ,318 ,296 ,312 ,284 ,304 ,281 ,298 ,285 ,293 ,288 ,291
" href="egipto"> <area shape="poly" coords=" 325 ,360 ,315 ,337 ,312 ,326
,315 ,316 ,324 ,312 ,334 ,307 ,352 ,308 ,360 ,315 ,374 ,318 ,355 ,344 ,350 ,365
" href="etiopia"> <area shape="poly" coords=" 283 ,364 ,325 ,366 ,336 ,373
,351 ,368 ,344 ,384 ,336 ,400 ,320 ,410 ,303 ,409 ,292 ,393 ,293 ,381 ,281 ,375
" href="sudafrica"> <area shape="poly" coords=" 360 ,375 ,367 ,374 ,371 ,372
,379 ,378 ,371 ,386 ,368 ,395 ,370 ,406 ,363 ,411 ,352 ,410 ,350 ,401 ,355 ,385
" href="madagascar"> </map>'. self model puedeAtacar ifTrue: [button :=
builder br; submit: model lastMorph] ifFalse: [builder h3: model lastMorph
printString]. builder endForm. "Was the button pressed?" button ifNotNil:
[button ifPressed: [ model ataqueWeb. ^self step]]. builder hr;
srcLink; end. ^ builder! ! !HVTEG methodsFor: 'urls' stamp: 'edc 5/12/2006
08:57'! stop self class stop! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006
08:03'! sudafrica ^self cualPais: 'Sudafrica'! ! !HVTEG methodsFor: 'urls'
stamp: 'edc 3/24/2006 08:32'! sumatra ^self cualPais: 'Sumatra'! ! !HVTEG
methodsFor: 'urls' stamp: 'edc 3/24/2006 09:26'! switchButton: aButton
aButton setSwitchState: aButton estado not. model lastMorph: aButton. ^ self
redirectTo: #step! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/24/2006 08:32'!
tamir ^self cualPais: 'Tamir'! ! !HVTEG methodsFor: 'urls' stamp: 'edc
3/24/2006 08:32'! tsamir ^self cualPais: 'Tsamir'! ! !HVTEG methodsFor: 'urls'
stamp: 'edc 3/24/2006 08:32'! turquia ^self cualPais: 'Turquia'! ! !HVTEG
methodsFor: 'urls' stamp: 'edc 3/24/2006 08:07'! venezuela ^self cualPais:
'Venezuela'! ! !HVTEG methodsFor: 'urls' stamp: 'edc 3/25/2006 18:00'!
westocean ^self cualPais: 'WestOcean'! ! !HVTEG methodsFor: 'urls' stamp: 'edc
3/24/2006 08:08'! yukon ^self cualPais: 'Yukon'! ! "-- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- "! HVTEG class instanceVariableNames: 'maxClient
current'! !HVTEG class methodsFor: 'accessing' stamp: 'edc 3/20/2006 08:13'!
current ^ current! ! !HVTEG class methodsFor: 'accessing' stamp: 'edc 3/20/2006
08:13'! current: aString current:= aString! ! !HVTEG class methodsFor:
'accessing' stamp: 'edc 3/4/2006 10:50'! maxClient ^maxClient! ! !HVTEG class
methodsFor: 'start/stop' stamp: 'edc 5/9/2006 07:39'! createModel "This is
called automatically when the web application is started." ^TEGMain reset ! !
!HVTEG class methodsFor: 'start/stop' stamp: 'edc 3/3/2006 07:04'! rootView
"Return custom class for the root view."

^TEGServerRoot! ! Morph subclass: #InformaCartas instanceVariableNames:
'' classVariableNames: '' poolDictionaries: '' category: 'Morphic-TEG'!
!InformaCartas methodsFor: 'initialization' stamp: 'edc 3/24/2006 10:20'!
initialize: t1 | t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 | super initialize. self
bounds: (Rectangle left: 710 right: 748 top: 220 bottom: 460).
self color: Color white. self borderColor: Color black. self borderWidth: 2.
t2 := 6. t3 := (216 / t2) asInteger. t4 := 224. t5 := 224 + t3. t6 := 237.
t7 := 247. t3 := t3 + 3. 1 to: t2 do: [:t12 | t8 := Morph new. t8
bounds: (Rectangle left: 712 right: 748 top: t4 bottom:
t5). t8 color: (t1 at: t12) miColor. t8 borderColor: Color black. t8
borderWidth: 2. self addMorph: t8. (t1 at: t12) vive ifTrue: [t9 :=
Morph new. t9 bounds: (Rectangle left: 720 right: 738
top: t6 bottom: t7). t9 color: Color white. t9 borderColor:
Color black. t9 borderWidth: 2. self addMorph: t9. t10 :=
StringMorph contents: (t1 at: t12) misCartas size asString. t10 center: t9
center. self addMorph: t10] ifFalse: [t11 := DrawPicture new
initializeWith: #Muerte valor: 0 pos: t8 topLeft. self
addMorph: t11]. t4 := t4 + t3. t5 := t5 + t3. t6 := t6 + t3. t7 :=
t7 + t3]. ! ! !InformaCartas methodsFor: 'initialization' stamp: 'edc 3/24/2006
10:22'! initialize: t1 topRight: aPoint | t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 |
super initialize. self bounds: (Rectangle left: 710 right: 748
top: 220 bottom: 460). self color: Color white. self borderColor: Color
black. self borderWidth: 2. t2 := 6. t3 := (216 / t2) asInteger. t4 := 224.
t5 := 224 + t3. t6 := 237. t7 := 247. t3 := t3 + 3. 1 to: t2 do: [:t12 |
t8 := Morph new. t8 bounds: (Rectangle left: 712 right: 748
top: t4 bottom: t5). t8 color: (t1 at: t12) miColor. t8 borderColor:
Color black. t8 borderWidth: 2. self addMorph: t8. (t1 at: t12) vive
ifTrue: [t9 := Morph new. t9 bounds: (Rectangle left: 720
right: 738 top: t6 bottom: t7). t9 color: Color white.
t9 borderColor: Color black. t9 borderWidth: 2. self addMorph: t9.
t10 := StringMorph contents: (t1 at: t12) misCartas size asString. t10
center: t9 center. self addMorph: t10] ifFalse: [t11 := DrawPicture new
initializeWith: #Muerte valor: 0 pos: t8 topLeft. self
addMorph: t11]. t4 := t4 + t3. t5 := t5 + t3. t6 := t6 + t3. t7 :=
t7 + t3]. self topRight: aPoint! ! Object subclass: #Jugador
instanceVariableNames: 'vive esHumano misPaises misCartas miColor nombre status'
classVariableNames: '' poolDictionaries: '' category: 'Morphic-TEG'! !Jugador
methodsFor: 'accesing'! esHumano ^ esHumano! ! !Jugador methodsFor:
'accesing'! esHumano: t1 esHumano _ t1! ! !Jugador methodsFor: 'accesing'!
initialize vive _ true. esHumano _ false. misPaises _ OrderedCollection new.
misCartas _ OrderedCollection new! ! !Jugador methodsFor: 'accesing'! miColor
^ miColor! ! !Jugador methodsFor: 'accesing'! miColor: t1 miColor _ t1! !
!Jugador methodsFor: 'accesing'! misCartas ^ misCartas! ! !Jugador methodsFor:
'accesing'! misCartas: t1 misCartas add: t1! ! !Jugador methodsFor:
'accesing'! misPaises ^ misPaises! ! !Jugador methodsFor: 'accesing'!
misPaises: t1 misPaises add: t1! ! !Jugador methodsFor: 'accesing' stamp:
'edc 3/4/2006 11:04'! nombre ^ nombre! ! !Jugador methodsFor: 'accesing'
stamp: 'edc 3/4/2006 11:04'! nombre: t1 nombre _ t1! ! !Jugador methodsFor:
'accesing' stamp: 'edc 3/19/2006 09:52'! status ^ status! ! !Jugador
methodsFor: 'accesing' stamp: 'edc 3/19/2006 09:52'! status: t1 status _ t1! !
!Jugador methodsFor: 'accesing'! vive ^ vive! ! !Jugador methodsFor:
'accesing'! vive: t1 vive _ t1! ! !Jugador methodsFor: 'as yet
unclassified'! sortCartas | t1 | t1 _ SortedCollection new. t1 sortBlock:
[:t2 :t3 | t2 \\\ 3 < (t3 \\\ 3)]. misCartas do: [:t4 | t1 add: t4].
misCartas _ t1 asOrderedCollection! ! PolygonMorph subclass: #PaisMorph
instanceVariableNames: 'nombre ejEnPais deQuienSoy numero misLimites'
classVariableNames: '' poolDictionaries: '' category: 'Morphic-TEG'!
!PaisMorph methodsFor: 'initialization' stamp: 'edc 5/7/2006 11:21'! initialize
super initialize. misLimites _ SortedCollection new! ! !PaisMorph methodsFor:
'initialization'! nombre: t1 limites: t2 | t3 t4 t5 | nombre _ t1. ejEnPais
_ 0. self vertices: t2 asArray color: Color white borderWidth: 2
borderColor: Color black. t4 _ self center. t5 _ Morph new. t5 bounds:
(Rectangle left: t4 x right: t4 x + 15 top: t4 y bottom: t4 y +
10). t5 color: Color white. self addMorph: t5. t3 _ TextMorph new. t3
autoFit: true. t3 string: ejEnPais asString fontName: #ComicBold size: 18
wrap: false. t3 contents: ejEnPais asString. t3 bounds: t5. t3 centered.
self addMorph: t3. t3 lock! ! !PaisMorph methodsFor: 'event handling' stamp:
'edc 5/20/2006 10:06'! clickWeb | soldados | owner estado = 2 & (owner
playerTurn = deQuienSoy) not ifTrue: [owner puedeAtacar: ( misLimites
includes: owner paisAtacante numero). owner lastMorph: owner paisAtacante
nombre , ' Ataca ' , self nombre. ^ self]. owner playerTurn = deQuienSoy
ifFalse: [owner lastMorph: 'This country is of ' , (owner losJugadores at:
deQuienSoy) nombre. ^ self]. owner estado = #fortificar ifTrue:[owner
paisOrigen: self. ^ self ]. owner estado = 2 ifTrue: [self borderWidth:
4; borderColor: Color white. owner lastMorph: self nombre , ' ready to
Atack'. owner paisAtacante = self ifFalse: [ owner paisAtacante: self.
^ self]]. soldados := owner submorphsSatisfying: [:t7 | t7 isKindOf:
DrawPicture]. soldados do: [:s | s estado ifTrue: [ejEnPais := ejEnPais +
s valor. owner pone: owner pone - s valor. owner botones removeKey:
((owner botones) keyAtValue: s ifAbsent:[]). s delete]]. self mostrar.
owner pone = 0 ifTrue: [owner ronda <= 5 ifTrue: [owner continue]
ifFalse: [owner estado: 2]]! ! !PaisMorph methodsFor: 'event handling'!
firstClickTimedOut: t1 | t2 t3 | t2 _ owner rootForGrabOf: self. t2 ifNil:
[t3 _ self copy. self board owner owner addMorphFront: t3. self world
displayWorld. (Delay forMilliseconds: 750) wait. t3 delete] ifNotNil:
[t1 hand grabMorph: t2]! ! !PaisMorph methodsFor: 'event handling'!
handlesMouseDown: t1 ^ true! ! !PaisMorph methodsFor: 'event handling'!
mouseDown: t1 t1 hand waitForClicksOrDrag: self event: t1! ! !PaisMorph
methodsFor: 'event handling'! mouseEnter: t1 | t2 | t2 _ 'Soy ' , nombre
asString , ' y pertenezco a ' , deQuienSoy asString. self showBalloon: t2 hand:
t1 hand! ! !PaisMorph methodsFor: 'access'! add: t1 ejEnPais _ ejEnPais +
t1. self mostrar! ! !PaisMorph methodsFor: 'access' stamp: 'edc 5/7/2006
11:22'! click: t1 | t2 t3 | t2 := 'Soy ' , nombre asString , ' numero ' ,
numero asString , 'y pertenezco a ' , deQuienSoy asString. self showBalloon: t2
hand: t1 hand. t3 := 0. (owner permitido: numero) ifFalse: [^ false].
owner submorphs do: [:t4 | t4 class == DrawPicture ifTrue: [t3 := t3 + 1.
owner pone: owner pone - 1. t4 estado ifTrue: [ejEnPais := ejEnPais +
t4 valor. t3 := t3 - 1. t4 delete]]]. self mostrar. t3 = 1
ifTrue: [owner ronda <= 5 ifTrue: [owner continue] ifFalse: [owner
estado: 2]]! ! !PaisMorph methodsFor: 'access'! deQuienSoy ^ deQuienSoy! !
!PaisMorph methodsFor: 'access'! deQuienSoy: t1 deQuienSoy _ t1! ! !PaisMorph
methodsFor: 'access'! doubleClick: t1 1 to: 42 do: [:t2 | (owner submorphs
at: t2) color: Color white]. (owner submorphs at: numero) color: Color
green. misLimites do: [:t3 | (owner submorphs at: t3) color: Color red].
self borderWidth: 4; borderColor: Color red. ^ self numero! ! !PaisMorph
methodsFor: 'access'! ejercitos ^ ejEnPais! ! !PaisMorph methodsFor: 'access'!
ejercitos: t1 ejEnPais _ t1. self mostrar! ! !PaisMorph methodsFor:
'access'! misLimites ^ misLimites! ! !PaisMorph methodsFor: 'access'!
misLimites: t1 misLimites _ t1! ! !PaisMorph methodsFor: 'access' stamp: 'edc
3/25/2006 07:46'! mostrar | t4 t5 t3 | self submorphsDo: [:t1 | t1 delete].
t4 := self center. t5 := Morph new. t5 bounds: (Rectangle left: t4 x
right: t4 x + 15 top: t4 y bottom: t4 y + 10). t5 color: Color white.
self addMorph: t5. t3 := TextMorph new. t3 autoFit: true. t3 string:
ejEnPais asString fontName: #ComicBold size: 18 wrap: false. t3 contents:
ejEnPais asString. t3 bounds: t5. t3 centered. self addMorph: t3. t3 lock.
self submorphsDo:[:t1 | t1 center: self center].! ! !PaisMorph methodsFor:
'access'! noMostrar submorphs do: [:t1 | t1 delete]! ! !PaisMorph
methodsFor: 'access'! nombre ^ nombre! ! !PaisMorph methodsFor: 'access'!
numero ^ numero! ! !PaisMorph methodsFor: 'access'! numero: t1 numero _ t1!
! !PaisMorph methodsFor: 'access'! otroLimites: t1 misLimites _ misLimites
add: t1! ! !PaisMorph methodsFor: 'access'! redrawInColor: t1 self color: t1.
submorphs first contents: ejEnPais asString. submorphs do: [:t2 | t2 center:
self center]! ! !PaisMorph methodsFor: 'as yet unclassified' stamp: 'edc
3/24/2006 16:02'! normal self borderWidth: 2; borderColor: Color black! !
!PaisMorph methodsFor: 'as yet unclassified' stamp: 'edc 10/26/2004 08:18'!
reset self color: Color white. self deQuienSoy: 0. self ejercitos: 0.! !
Object subclass: #TEGConsole2 instanceVariableNames: '' classVariableNames: ''
poolDictionaries: '' category: 'Morphic-TEG'! "-- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- "! TEGConsole2 class instanceVariableNames: ''!
!TEGConsole2 class methodsFor: 'as yet unclassified' stamp: 'edc 5/5/2006
19:07'! default: aString | r m | m := StringMorph new contents: aString;
font: Preferences windowTitleFont emphasis: (Preferences windowTitleFont
isTTCFont ifTrue: [0] ifFalse: [1]). r := RectangleMorph new extent: m
fullBounds extent. r addMorph: m. ^r! ! BorderedMorph subclass: #TEGMain
instanceVariableNames: 'cartasOrden losJugadores puedeAtacar jugadoresVivos
cartel pone cambiosTotales playerTurn ronda limites done lim estado numCarta
mazo botones lastMorph maxClient paisAtacante paisOrigen paisDestino'
classVariableNames: '' poolDictionaries: '' category: 'Morphic-TEG'! !TEGMain
methodsFor: 'accessing' stamp: 'edc 3/14/2006 10:17'! botones ^botones! !
!TEGMain methodsFor: 'accessing' stamp: 'edc 3/27/2006 08:53'! botones: anObject
"Set the value of botones" botones := anObject! ! !TEGMain methodsFor:
'accessing'! cambiosTotales ^ cambiosTotales! ! !TEGMain methodsFor:
'accessing'! cambiosTotales: t1 cambiosTotales _ t1! ! !TEGMain methodsFor:
'accessing'! cartasOrden ^ cartasOrden! ! !TEGMain methodsFor: 'accessing'!
cartasOrden: t1 cartasOrden _ t1! ! !TEGMain methodsFor: 'accessing'! cartel
^ cartel! ! !TEGMain methodsFor: 'accessing' stamp: 'edc 4/12/2006 10:08'!
cartel: anObject cartel := anObject. "t2 beAllFont: (StrikeFont familyName:
#ComicBold size: 18)." anObject color: Color red. anObject extent: self
width - 30 @ 40. anObject center: self center. anObject top: self top + 10.
self addMorphBack: anObject! ! !TEGMain methodsFor: 'accessing'! done ^ done!
! !TEGMain methodsFor: 'accessing'! done: t1 done _ t1! ! !TEGMain
methodsFor: 'accessing'! estado ^ estado! ! !TEGMain methodsFor: 'accessing'
stamp: 'EDC 6/29/2002 10:30'! estado: aInteger estado _ aInteger! ! !TEGMain
methodsFor: 'accessing'! jugadoresVivos ^ jugadoresVivos! ! !TEGMain
methodsFor: 'accessing'! jugadoresVivos: t1 jugadoresVivos _ t1! ! !TEGMain
methodsFor: 'accessing' stamp: 'edc 3/24/2006 08:38'! lastMorph ^lastMorph ! !
!TEGMain methodsFor: 'accessing' stamp: 'edc 3/24/2006 08:38'! lastMorph: aMorph
lastMorph:= aMorph! ! !TEGMain methodsFor: 'accessing' stamp: 'edc 3/27/2006
08:53'! lim "Answer the value of lim" ^ lim! ! !TEGMain methodsFor:
'accessing' stamp: 'edc 3/27/2006 08:53'! lim: anObject "Set the value of lim"
lim := anObject! ! !TEGMain methodsFor: 'accessing'! limites ^ limites! !
!TEGMain methodsFor: 'accessing'! limites: t1 limites _ t1! ! !TEGMain
methodsFor: 'accessing'! losJugadores ^ losJugadores! ! !TEGMain methodsFor:
'accessing'! losJugadores: t1 losJugadores _ t1! ! !TEGMain methodsFor:
'accessing' stamp: 'edc 3/24/2006 08:39'! maxClient ^ maxClient! ! !TEGMain
methodsFor: 'accessing' stamp: 'edc 3/27/2006 08:53'! maxClient: anObject "Set
the value of maxClient" maxClient := anObject! ! !TEGMain methodsFor:
'accessing'! mazo ^ mazo! ! !TEGMain methodsFor: 'accessing'! mazo: t1 mazo
_ t1! ! !TEGMain methodsFor: 'accessing'! numCarta ^ numCarta! ! !TEGMain
methodsFor: 'accessing'! numCarta: t1 numCarta _ t1! ! !TEGMain methodsFor:
'accessing' stamp: 'edc 3/24/2006 11:06'! paisAtacante ^ paisAtacante! !
!TEGMain methodsFor: 'accessing' stamp: 'edc 3/24/2006 11:07'! paisAtacante: t1
paisAtacante := t1! ! !TEGMain methodsFor: 'accessing' stamp: 'edc 3/27/2006
08:53'! paisDestino "Answer the value of paisDestino" ^ paisDestino! !
!TEGMain methodsFor: 'accessing' stamp: 'edc 3/27/2006 09:05'! paisDestino:
anObject "Set the value of paisDestino" paisDestino := anObject. self
fortificarWeb! ! !TEGMain methodsFor: 'accessing' stamp: 'edc 3/27/2006 08:53'!
paisOrigen "Answer the value of paisOrigen" ^ paisOrigen! ! !TEGMain
methodsFor: 'accessing' stamp: 'edc 3/27/2006 09:34'! paisOrigen: anObject "Set
the value of paisOrigen" paisOrigen ifNotNil: [self paisDestino: anObject ]
ifNil:[paisOrigen := anObject. self lastMorph: ' Troops are living ', anObject
nombre]. ! ! !TEGMain methodsFor: 'accessing'! paises: t1 | t2 t3 | 1 to:
42 do: [:t4 | (submorphs at: t4) ejercitos: ((t1 at: t4) at: 1).
(submorphs at: t4) deQuienSoy: ((t1 at: t4) at: 2). t2 _ (submorphs
at: t4) deQuienSoy. t3 _ (losJugadores at: t2) miColor. (submorphs at: t4)
redrawInColor: t3]! ! !TEGMain methodsFor: 'accessing' stamp: 'edc 3/24/2006
10:56'! playerTurn ^ playerTurn! ! !TEGMain methodsFor: 'accessing'!
playerTurn: t1 playerTurn _ t1! ! !TEGMain methodsFor: 'accessing'! pone ^
pone! ! !TEGMain methodsFor: 'accessing'! pone: t1 pone _ t1! ! !TEGMain
methodsFor: 'accessing' stamp: 'edc 3/25/2006 07:14'! puedeAtacar ^
puedeAtacar! ! !TEGMain methodsFor: 'accessing' stamp: 'edc 3/25/2006 07:14'!
puedeAtacar: t1 puedeAtacar := t1! ! !TEGMain methodsFor: 'accessing'! ronda
^ ronda! ! !TEGMain methodsFor: 'accessing'! ronda: t1 ronda _ t1! !
!TEGMain methodsFor: 'as yet unclassified' stamp: 'EDC 6/27/2002 15:51'!
hacerListaPaises | misLimites listaLimpia | misLimites _ Set new. "Deseo la
lista total de los paises limitrofes a mis paises" (losJugadores at:
playerTurn) misPaises do: [:pais | limites do: [:each | (each includes:
pais) ifTrue: [misLimites add: each]]]. "Debo eliminar de la lista las
fronteras de paises que ambos me pertenezcan" listaLimpia _ misLimites copy.
misLimites do: [:frontera | (((losJugadores at: playerTurn) misPaises
includes: (frontera at: 1)) and: [(losJugadores at: playerTurn) misPaises
includes: (frontera at: 2)]) ifTrue: [listaLimpia remove: frontera]].
^listaLimpia! ! !TEGMain methodsFor: 'as yet unclassified' stamp: 'EDC
6/22/2002 11:01'! optimizarCambio | index tipo otroIndex temp | (losJugadores
at: playerTurn) misCartas do: [:pais | ((losJugadores at: playerTurn)
misPaises includes: pais) ifTrue: [index _ (losJugadores at: playerTurn)
misCartas indexOf: pais. tipo _ pais \\\ 3]]. otroIndex _ 0.
(losJugadores at: playerTurn) misCartas do: [:otraCarta | otroIndex _
otroIndex + 1. otraCarta \\\ 3 = tipo ifTrue: [temp _ (losJugadores at:
playerTurn) misCartas at: index. (losJugadores at: playerTurn) misCartas
at: index put: ((losJugadores at: playerTurn) misCartas at: otroIndex).
(losJugadores at: playerTurn) misCartas at: otroIndex put: temp. ^ true]]!
! !TEGMain methodsFor: 'debug and other' stamp: 'edc 10/19/2004 16:49'! debug
^self inspect. ! ! !TEGMain methodsFor: 'debug and other' stamp: 'edc
10/19/2004 16:49'! split self eligeEjercitos: pone jugador: playerTurn! !
!TEGMain methodsFor: 'event handling' stamp: 'EDC 5/17/2002 05:34'!
handlesMouseDown: evt "Prevent stray clicks from picking up the whole game in
MVC." ^ Smalltalk isMorphic not or: [evt yellowButtonPressed]! ! !TEGMain
methodsFor: 'event handling'! mouseDown: t1 | t2 | t1 yellowButtonPressed
ifFalse: [^ self]. t2 _ MenuMorph new defaultTarget: self. self
addMenuItemsTo: t2 hand: t1 hand. t2 popUpEvent: t1 in: self world! !
!TEGMain methodsFor: 'fileIn/out' stamp: 'EDC 6/23/2002 06:46'! grabaEstado |
outputStream | outputStream _ ReferenceStream fileNamed: 'estado.teg'.
outputStream nextPut: losJugadores. outputStream nextPut: cartasOrden.
outputStream nextPut: jugadoresVivos. outputStream nextPut: playerTurn.
outputStream nextPut: ronda. outputStream nextPut: numCarta. outputStream
nextPut: cambiosTotales. 1 to: 42 do: [:pais | outputStream nextPut:
(submorphs at: pais) ejercitos. outputStream nextPut: (submorphs at: pais)
deQuienSoy]. outputStream close! ! !TEGMain methodsFor: 'fileIn/out' stamp:
'edc 5/9/2006 06:34'! grabaFoto ^(Form fromDisplay: self bounds) ! !
!TEGMain methodsFor: 'fileIn/out'! leerEstado | t1 | t1 _ ReferenceStream
fileNamed: 'estado.teg'. losJugadores _ t1 next. cartasOrden _ t1 next.
jugadoresVivos _ t1 next. playerTurn _ t1 next. ronda _ t1 next. numCarta _
t1 next. cambiosTotales _ t1 next. 1 to: 42 do: [:t2 | (submorphs at:
t2) ejercitos: t1 next. (submorphs at: t2) deQuienSoy: t1 next]. t1
close. self miColor! ! !TEGMain methodsFor: 'game sequence' stamp: 'edc
10/19/2004 17:26'! armaBatallones | mitadChica s50 s20 s10 s5 s1 batallones |
batallones _ Array new: 5. mitadChica _ pone. s50 _ 0. s20 _ 0. s10 _ 0. s5
_ 0. s1 _ 0. s50 _ (mitadChica / 50) asInteger. mitadChica _ mitadChica \\\
50. s20 _ (mitadChica / 20) asInteger. mitadChica _ mitadChica \\\ 20. s10 _
(mitadChica / 10) asInteger. mitadChica _ mitadChica \\\ 10. mitadChica = 5
ifTrue: [s1 _ 5] ifFalse: [s5 _ (mitadChica / 5) asInteger. s1 _ mitadChica
\\\ 5]. pone <= 9 ifFalse: [[s50 + s20 + s10 + s5 + s1 <= 5] whileTrue:
[s10 > 0 ifTrue: [s10 _ s10 - 1. s5 _ s5 + 2] ifFalse: [s20 >
0 ifTrue: [s20 _ s20 - 1. s10 _ s10 + 2] ifFalse: [s50
> 0 ifTrue: [s50 _ s50 - 1. s20 _ s20 + 2. s10 _
s10 + 5] ifFalse: [s5 > 0 ifTrue: [s5 _ s5 - 1.
s1 _ s1 + 5]]]]]]. batallones at: 1 put: s1. batallones at: 2 put: s5.
batallones at: 3 put: s10. batallones at: 4 put: s20. batallones at: 5 put:
s50. ^ batallones! ! !TEGMain methodsFor: 'game sequence' stamp: 'edc
3/26/2006 09:04'! atacaMaquina | maxValue maxElement val reagrupa pasan
paisAcacado paisAcacante atacarA quedan listaLimpia paises | paises := self
submorphsSatisfying: [:t7 | t7 isKindOf: PaisMorph]. listaLimpia := self
hacerListaPaises: true. listaLimpia do: [:frontera | ((losJugadores at:
playerTurn) misPaises includes: (frontera at: 1)) ifTrue: [paisAcacante
:= paises detect: [:p | p numero = (frontera at: 1)].
paisAcacado := paises detect: [:p | p numero = (frontera at:
2)]] ifFalse: [paisAcacante := paises detect: [:p | p numero
= (frontera at: 2)]. paisAcacado := paises detect: [:p | p numero
= (frontera at: 1)]]. maxValue == nil ifTrue: ["first element"
maxValue _ paisAcacante ejercitos - paisAcacado ejercitos. maxElement :=
paisAcacante numero] ifFalse: [ val := paisAcacante ejercitos -
paisAcacado ejercitos. val > maxValue ifTrue: [maxElement :=
paisAcacante numero. atacarA := paisAcacado numero. maxValue :=
val]] ]. atacarA ifNil: [^ false]. paisAcacado := paises detect:
[:p | p numero = atacarA]. paisAcacante := paises detect: [:p
| p numero = maxElement]. reagrupa := self suerte: paisAcacante
contra: paisAcacado. reagrupa ifTrue: [pone > 2 ifTrue: [pasan := (pone -
2 / 2) asInteger. quedan := pone - pasan. paisAcacante add: quedan.
paisAcacado add: pasan. paisAcacado deQuienSoy: playerTurn. ^ true]
ifFalse: [^ false]] ifFalse: [^ false]! ! !TEGMain methodsFor: 'game
sequence' stamp: 'edc 3/27/2006 08:22'! ataque estado := 2. self lastMorph:
'Ready to attack !!!!' ! ! !TEGMain methodsFor: 'game sequence' stamp: 'edc
3/27/2006 07:57'! ataqueWeb | t5 paisAtacado paises aString | self
puedeAtacar: false. paises := self submorphsSatisfying: [:t7 | t7 isKindOf:
PaisMorph]. aString := (lastMorph findTokens: ' ') last. paisAtacado := paises
detect: [:p | p nombre = aString]. t5 := self guerraContra: paisAtacado. self
grabaFoto. t5 ifTrue: [self eligeEjercitos: pone jugador: playerTurn.
estado := 3. self lastMorph: 'You win, select more attack , or other
option'. ^true] ifFalse: [self lastMorph: 'You loose '. ^false] ! !
!TEGMain methodsFor: 'game sequence' stamp: 'edc 4/12/2006 10:36'! begin pone:=
5. self eligeEjercitos: 5 jugador: 1. ( cartel submorphs at: 1) color:
(losJugadores at: 1) miColor. ( cartel submorphs at: 1) contents: 'Ronda '
, 1 asString , ' Turno del jugador ' , (losJugadores at: 1) nombre. done:=
true. ! ! !TEGMain methodsFor: 'game sequence' stamp: 'edc 5/17/2006
07:32'! continue done := true. ! ! !TEGMain methodsFor: 'game sequence'!
continue: t1 t1 delete. estado _ 4! ! !TEGMain methodsFor: 'game sequence'
stamp: 'edc 10/19/2004 16:08'! dibuCartas: n hayCambio: aBoolean | cardDialog
laCarta loHizo rpos oK cartaNumero cancel | cardDialog _ DrawPicture new
initializeWith: #CardsDLOG. oK _ DrawPicture new initializeWith: #Ok
valor: 1 pos: 470 @ 327. oK target: self. oK actionSelector:
#cambiaCartas:. oK arguments: (Array with: cardDialog). cancel _ DrawPicture
new initializeWith: #Cancel valor: 1 pos: 470 @ 292 . cancel
target: self. cancel actionSelector: #continue:. cancel arguments: (Array
with: cardDialog). cardDialog position: 90 @ 90. cardDialog openInWorld. 1
to: n do: [:t10 | t10 caseOf: { [1] -> [rpos _ 110 @ 110]. [2] ->
[rpos _ 286 @ 110]. [3] -> [rpos _ 462 @ 110]. [4] -> [rpos _ 198 @
254]. [5] -> [rpos _ 374 @ 254]. [6] -> [rpos _ 110 @ 254]}
otherwise: [rpos _ 20 @ 20]. cartaNumero _ (losJugadores at: playerTurn)
misCartas at: t10. cartaNumero > 42 ifTrue: [laCarta _ DrawCard new
dibujaUnaCarta: cartaNumero] ifFalse: [laCarta _ mazo at: cartaNumero.
laCarta submorphs last noMostrar. laCarta submorphs last color: (submorphs
at: cartaNumero) color]. t10 <= 3 ifTrue: [aBoolean ifTrue:
[laCarta submorphs first estado: true]]. laCarta position: rpos.
cardDialog addMorphBack: laCarta]. cardDialog addMorphBack: oK. cardDialog
addMorphBack: cancel. cardDialog submorphsDo: [:m| m comeToFront]. self world
displayWorld. (losJugadores at: playerTurn) esHumano ifTrue: [aBoolean
ifTrue: [[estado = 4] whileFalse: [World doOneCycle]]. estado _ 1]
ifFalse: [3 timesRepeat: [(Delay forSeconds: 1) wait. "SampledSound
playSoundNamed: 'chirp'." aBoolean ifTrue: [self cambiaCartas:
cardDialog]. loHizo _ true. (Delay forSeconds: 3) wait.
cardDialog delete. ^ loHizo]]! ! !TEGMain methodsFor: 'game sequence'
stamp: 'edc 3/24/2006 16:11'! dibujaUnaCarta2: cardDialog | | cardDialog
topRight: self topRight + (-20 @ 55) asPoint. cardDialog openInWorld.
"cardDialog center: Display center. p := Player new. p costume: cardDialog. t
:= 1.0. p show. 1 to: 8 do: [:index | tiempo := 1600 - (100 * index).
(Delay forMilliseconds: tiempo) wait. "FMSound randomWeird1 play." p
setScaleFactor: t. p forward: 100 atRandom. p turn: 360 atRandom. self
world displayWorld. t := t - 0.125]. p erase"! ! !TEGMain methodsFor: 'game
sequence' stamp: 'edc 5/17/2006 07:41'! doCartel ( cartel submorphs at: 1)
color: (losJugadores at: playerTurn) miColor. ( cartel submorphs at: 1)
contents: 'Ronda ' , ronda asString , ' Turno del jugador ' , (losJugadores at:
playerTurn) nombre. ( cartel submorphs at: 1) center: cartel center.! !
!TEGMain methodsFor: 'game sequence' stamp: 'edc 3/26/2006 09:52'!
eligeEjercitos: aInteger jugador: j | s50 s20 s10 s5 s1 posIcon nEjRec
ejercitos batallones l r boton | l := self left + 155. r := self left + 195.
ejercitos := Array new: 9. nEjRec := Array new: 9. 1 to: 9 do: [:e |
ejercitos at: e put: (Rectangle left: l + (e * 45) right: r
+ (e * 45) top: self bottom - 70 bottom: self bottom - 50).
nEjRec at: e put: 0]. batallones := self armaBatallones. posIcon := 1. s1 :=
batallones at: 1. s5 := batallones at: 2. s10 := batallones at: 3. s20 :=
batallones at: 4. s50 := batallones at: 5. s1 > 0 ifTrue: [1 to: s1
do: [:i | boton := DrawPicture new. self addMorphBack: boton.
boton initializeWith: #Soldado1 valor: 1 rect: (ejercitos at:
i). posIcon := posIcon + 1. botones at: i put: boton. self
addMorphBack: boton. nEjRec at: i put: 1]]. s5 > 0 ifTrue: [posIcon
to: s5 + posIcon - 1 do: [:i | boton := DrawPicture new
initializeWith: #Soldado5 valor: 5 rect: (ejercitos at: i).
posIcon := posIcon + 1. botones at: i put: boton. self
addMorphBack: boton. nEjRec at: i put: 5]]. s10 > 0 ifTrue: [posIcon
to: s10 + posIcon - 1 do: [:i | boton := DrawPicture new
initializeWith: #Soldado10 valor: 10 rect: (ejercitos at: i).
posIcon := posIcon + 1. botones at: i put: boton. self
addMorphBack: boton. nEjRec at: i put: 10]]. s20 > 0 ifTrue: [posIcon
to: s20 + posIcon - 1 do: [:i | boton := DrawPicture new
initializeWith: #Soldado20 valor: 20 rect: (ejercitos at: i).
posIcon := posIcon + 1. botones at: i put: boton. self
addMorphBack: boton. nEjRec at: i put: 20]]. s50 > 0 ifTrue: [posIcon
to: s50 + posIcon - 1 do: [:i | boton := DrawPicture new
initializeWith: #Soldado50 valor: 50 rect: (ejercitos at: i).
posIcon := posIcon + 1. botones at: i put: boton. self
addMorphBack: boton. nEjRec at: i put: 50]]. (nEjRec at: 9) = 0
ifTrue: [boton := DrawPicture new. self addMorphBack: boton. boton
initializeWith: #Split valor: 0 rect: (ejercitos at: 9). boton
target: self; actionSelector: #split]! ! !TEGMain methodsFor: 'game
sequence' stamp: 'EDC 5/2/2002 10:56'! endGameFor: aInteger ^ self halt.! !
!TEGMain methodsFor: 'game sequence'! finAtaque done _ true. estado _ 3! !
!TEGMain methodsFor: 'game sequence' stamp: 'edc 3/26/2006 08:18'! finRonda
playerTurn = 6 ifTrue: [ronda := ronda + 1]! ! !TEGMain methodsFor: 'game
sequence' stamp: 'edc 3/27/2006 09:25'! fortificar estado _ #fortificar. self
lastMorph: 'Ready to reagruping !!!!' ! ! !TEGMain methodsFor: 'game
sequence' stamp: 'EDC 6/29/2002 10:19'! fortificarMaquina | misLimites enemigo
misPaises reagrupar n batallon | misLimites _ OrderedCollection new. misPaises
_ (losJugadores at: playerTurn) misPaises asSortedCollection. misPaises do:
[:pais | enemigo _ false. (submorphs at: pais) misLimites do: [:each
| (misPaises includes: each) ifFalse: [enemigo _ true]]. enemigo
ifFalse: [(submorphs at: pais) ejercitos even ifTrue: [reagrupar _
(submorphs at: pais) ejercitos - 2. (submorphs at: pais)
ejercitos: 2] ifFalse: [reagrupar _ (submorphs at: pais) ejercitos - 1.
(submorphs at: pais) ejercitos: 1]. n _ (submorphs at: pais)
misLimites size. batallon _ (reagrupar / n) asInteger. (submorphs at:
pais) misLimites do: [:index | (submorphs at: index) add:
batallon]]. ]! ! !TEGMain methodsFor: 'game sequence' stamp: 'edc 3/27/2006
09:41'! fortificarWeb lim _ Array new: 2. lim at: 1 put: paisOrigen numero.
lim at: 2 put: paisDestino numero. (limites includes: lim) ifFalse: [lim at:
1 put: paisDestino numero. lim at: 2 put: paisOrigen numero. (limites
includes: lim) ifFalse: [self lastMorph: 'No son limitrofes'. ^
false]]. pone _ paisOrigen ejercitos - 1. paisOrigen ejercitos: 1. self
eligeEjercitos: pone jugador: playerTurn. self paisOrigen: nil. self estado:
2. ^true ! ! !TEGMain methodsFor: 'game sequence' stamp: 'edc 3/24/2006
16:02'! guerraContra: paisAtacado | dadoAtaque dadoDefensa elColor | cartel
contents: paisAtacante nombre , ' Ataca a ' , paisAtacado nombre. [paisAtacante
ejercitos > 0 and: [paisAtacado ejercitos > 0]] whileTrue: [dadoAtaque := 0.
dadoDefensa := 0. [dadoAtaque = dadoDefensa] whileTrue: [dadoAtaque := 6
atRandom. dadoDefensa := 6 atRandom]. dadoAtaque > dadoDefensa
ifTrue: [paisAtacado ejercitos: paisAtacado ejercitos - 1] ifFalse:
[paisAtacante ejercitos: paisAtacante ejercitos - 1]]. paisAtacado ejercitos =
0 ifTrue: [elColor := (losJugadores at: playerTurn) miColor. paisAtacado
color: elColor. (losJugadores at: paisAtacado deQuienSoy) misPaises
remove: paisAtacado numero ifAbsent: []. paisAtacado deQuienSoy:
playerTurn. (losJugadores at: paisAtacado deQuienSoy) misPaises size = 0
ifTrue: [self muerte]. paisAtacado deQuienSoy: playerTurn. (losJugadores
at: playerTurn) misPaises: paisAtacado numero] ifFalse: [^ false].
paisAtacante ejercitos > 2 ifTrue: [paisAtacado ejercitos: 2. pone :=
paisAtacante ejercitos - 2. paisAtacante ejercitos: 0. paisAtacante
normal. ^ true]. pone := 0. ^ false! ! !TEGMain methodsFor: 'game
sequence'! leerCartas | t1 t2 | mazo _ OrderedCollection new. t1 _
ReferenceStream fileNamed: 'cartas37.teg'. 1 to: 42 do: [:t3 | t2 _ t1
next. (t2 submorphs at: 3) lock. mazo add: t2]. t1 close! ! !TEGMain
methodsFor: 'game sequence' stamp: 'edc 5/18/2006 11:49'! makeMove
[jugadoresVivos > 1] whileTrue: [submorphs do: [:t1 | t1 class ==
DrawPicture ifTrue: [t1 delete]]. (losJugadores at: playerTurn)
misPaises size = 0 ifTrue: [self muerte. self finRonda. playerTurn
_ playerTurn \\ 6 + 1] ifFalse: [self doCartel. done _ false.
estado _ 1. ronda caseOf: { [1] -> [pone _ 5]. [2] ->
[pone _ 4]. [3] -> [pone _ 3]. [4] -> [pone _ 1]. [5] -> [pone
_ 1]} otherwise: [pone _ self cuantosEjercitos]. ronda > 5
ifTrue: [submorphs last class == InformaCartas ifTrue: [submorphs last
delete] ifFalse: [self addMorphBack: (InformaCartas new
initialize: losJugadores)]]. (losJugadores at: playerTurn) misCartas size
>= 3 & (losJugadores at: playerTurn) esHumano ifTrue: [self verCartas].
(losJugadores at: playerTurn) esHumano ifTrue: [self eligeEjercitos: pone
jugador: playerTurn] ifFalse: [self maquinaPone]. [done]
whileFalse: [World doOneCycle]. ((losJugadores at: playerTurn) esHumano
and: [estado = 3]) ifTrue: [self obtenerCarta]. self finRonda.
playerTurn _ playerTurn \\ 6 + 1]]! ! !TEGMain methodsFor: 'game sequence'
stamp: 'edc 5/17/2006 07:09'! maquinaPone | i n pais gano paises numpais |
done := false. n := (losJugadores at: playerTurn) misPaises size. i := 1.
paises := self submorphsSatisfying: [:t7 | t7 isKindOf: PaisMorph]. [pone >
0] whileTrue: [numpais := (losJugadores at: playerTurn) misPaises at: i.
pais := paises detect: [:p | p numero = numpais]. pais add: 1. pone
:= pone - 1. i := i + 1. i > n ifTrue: [i := 1]]. ronda > 5
ifTrue: [gano := self atacaMaquina. gano ifTrue: [self obtenerCarta]].
self continue ! ! !TEGMain methodsFor: 'game sequence'! muerte
(losJugadores at: playerTurn) vive: false. jugadoresVivos _ jugadoresVivos -
1! ! !TEGMain methodsFor: 'game sequence'! obtenerCarta | t1 | numCarta < 45
ifTrue: [t1 _ cartasOrden at: numCarta. (losJugadores at: playerTurn)
misCartas: t1. t1 > 42 ifTrue: [self dibujaUnaCarta2: (DrawCard new
dibujaUnaCarta: t1)] ifFalse: [self dibujaUnaCarta2: (mazo at: t1)]].
numCarta _ numCarta + 1! ! !TEGMain methodsFor: 'game sequence' stamp: 'edc
11/11/2005 07:23'! permitido: t1 estado = 1 ifTrue: [((losJugadores at:
playerTurn) misPaises includes: t1) ifTrue: [^ true]]. estado = 2 | (estado
= 3) ifTrue: [lim ifNotNil: [(lim includes: t1) ifTrue: [^ true]]]. ^
false! ! !TEGMain methodsFor: 'game sequence' stamp: 'edc 5/5/2006 11:43'!
statusFor: aString ^(self losJugadores at: playerTurn ifAbsent: []) nombre =
aString. ! ! !TEGMain methodsFor: 'game sequence' stamp: 'edc 5/4/2006
17:01'! suerte: x contra: paisAcacado | dadoAtaque dadoDefensa elColor |
paisAtacante := x. ( cartel submorphs at: 1) contents: paisAtacante nombre ,
' Ataca a ' , paisAcacado nombre;color: (losJugadores at: playerTurn) miColor;
center: cartel center. [paisAtacante ejercitos > 0 and: [paisAcacado
ejercitos > 0]] whileTrue: [dadoAtaque := 0. dadoDefensa := 0.
[dadoAtaque = dadoDefensa] whileTrue: [dadoAtaque := 6 atRandom.
dadoDefensa := 6 atRandom]. dadoAtaque > dadoDefensa ifTrue: [paisAcacado
ejercitos: paisAcacado ejercitos - 1] ifFalse: [paisAtacante ejercitos:
paisAtacante ejercitos - 1]]. paisAcacado ejercitos = 0 ifTrue: [elColor :=
(losJugadores at: playerTurn) miColor. paisAcacado color: elColor.
(losJugadores at: paisAcacado deQuienSoy) misPaises remove: paisAcacado
numero ifAbsent: []. paisAcacado deQuienSoy: playerTurn. (losJugadores
at: paisAcacado deQuienSoy) misPaises size = 0 ifTrue: [self muerte].
paisAcacado deQuienSoy: playerTurn. (losJugadores at: playerTurn)
misPaises: paisAcacado numero] ifFalse: [^ false]. paisAtacante ejercitos > 2
ifTrue: [paisAcacado ejercitos: 2. pone := paisAtacante ejercitos - 2.
paisAtacante ejercitos: 0. ^ true]. pone := 0. ^ false. ! ! !TEGMain
methodsFor: 'game sequence' stamp: 'edc 10/19/2004 15:52'! verCartas | sold3
canon3 caba3 cambio soldado canon caballo resultado tipo laCarta | sold3 _ 0.
canon3 _ 0. caba3 _ 0. cambio _ 0. soldado _ 0. canon _ 0. caballo _ 0.
cambio _ 0. resultado _ false. 1 to: (losJugadores at: playerTurn) misCartas
size do: [:i | laCarta _ (losJugadores at: playerTurn) misCartas at: i.
laCarta >= 43 ifTrue: [cambio _ cambio + 1. ]. tipo _ ((losJugadores
at: playerTurn) misCartas at: i) \\\ 3. tipo caseOf: { [0] ->
[sold3 _ sold3 + 1. soldado = 0 ifTrue: [soldado _ i. cambio _
cambio + 1] ]. [1] -> [canon3 _ canon3 + 1. canon = 0
ifTrue: [canon _ i. cambio _ cambio + 1] ]. [2] -> [caba3
_ caba3 + 1. caballo = 0 ifTrue: [caballo _ i. cambio _ cambio
+ 1] ]} otherwise: [Transcript open]]. sold3 >= 3 | (canon3 >= 3) |
(caba3 >= 3) | (cambio >= 3) ifTrue: [resultado _ true]. (losJugadores at:
playerTurn) misCartas size > 3 ifTrue: [resultado ifTrue: [self
optimizarCambio]]. "Si tengo mas de tres cartas, debo determinar si alguna es
de mis paises y si la puedo cambiar" resultado ifTrue: [self dibuCartas:
(losJugadores at: playerTurn) misCartas size hayCambio: resultado]! ! !TEGMain
methodsFor: 'initialization' stamp: 'edc 5/16/2006 11:39'! addClient: aString
| nuevoJugador | maxClient = 0 ifTrue:[^true]. aString ifNil: [self halt].
self losJugadores at: aString ifAbsent: [nuevoJugador := self losJugadores
at: maxClient. nuevoJugador nombre: aString. nuevoJugador esHumano: true.
nuevoJugador status: #pause. self losJugadores at: aString put: nuevoJugador.
maxClient := maxClient - 1. ( cartel submorphs at: 1) color: nuevoJugador
miColor. ( cartel submorphs at: 1) contents: aString , ' quiere jugar '.
]. maxClient = 0 ifTrue:[ self makeMove. ^false]. ^false ! !
!TEGMain methodsFor: 'initialization' stamp: 'edc 3/26/2006 06:41'!
cuantosEjercitos | sumEj sudAmerica norteAmerica europa asia oceania africa
paises | sumEj := 0. sudAmerica := 0. norteAmerica := 0. europa := 0. asia
:= 0. oceania := 0. africa := 0. paises := self submorphsSatisfying: [:t7
| t7 isKindOf: PaisMorph]. paises do: [:e | e deQuienSoy = playerTurn
ifTrue: [sumEj := sumEj + 1. (e numero >= 1 and: [e numero <= 4])
ifTrue: [sudAmerica := sudAmerica + 1]. (e numero >= 5 and: [e
numero <= 12]) ifTrue: [norteAmerica := norteAmerica + 1]. (e numero
>= 13 and: [e numero <= 20]) ifTrue: [europa := europa + 1].
(e numero >= 21 and: [e numero <= 33]) ifTrue: [asia := asia + 1].
(e numero >= 34 and: [e numero <= 37]) ifTrue: [oceania := oceania
+ 1]. (e numero > 38 and: [e numero < 42]) ifTrue: [africa :=
africa + 1]]]. sumEj := 1 + (sumEj / 3) asInteger. (sudAmerica = 4 or:
[oceania = 4]) ifTrue: [sumEj := sumEj + 2]. (norteAmerica = 7 or: [europa
= 7]) ifTrue: [sumEj := sumEj + 5]. asia = 8 ifTrue: [sumEj := sumEj + 7].
africa = 5 ifTrue: [sumEj := sumEj + 3]. sumEj < 3 ifTrue: [sumEj := 3]. ^
sumEj! ! !TEGMain methodsFor: 'initialization' stamp: 'edc 10/8/2004 09:54'!
cuantosHumanos: aInteger 1 to: aInteger do: [:i| (losJugadores at: i)
esHumano: true ]. ! ! !TEGMain methodsFor: 'initialization' stamp: 'edc
5/6/2006 12:04'! distribuyePaises | randomNumber cantPaises ordendePaises
totalPaises cualPais paises elPais | paises := TEGMain current
submorphsSatisfying: [:t7 | t7 isKindOf: PaisMorph]. cantPaises _ 42 /
jugadoresVivos. ordendePaises _ OrderedCollection new. [ordendePaises size <
42] whileTrue: [(ordendePaises includes: (randomNumber _ 42 atRandom))
ifFalse: [ordendePaises add: randomNumber]]. totalPaises _ 1. 1 to:
jugadoresVivos do: [:elJugador | 1 to: cantPaises do: [:p |
cualPais _ ordendePaises at: totalPaises. elPais := paises detect: [:p2
| p2 numero = cualPais]. (losJugadores at: elJugador) misPaises:
cualPais. elPais deQuienSoy: elJugador;ejercitos: 0. totalPaises
_ totalPaises + 1]]! ! !TEGMain methodsFor: 'initialization'! elijeColor | t1
t2 t3 | t1 _ Array new: 16. t1 at: 1 put: (Color r: 1.0 g: 5000 /
65535 b: 5000 / 65535). t1 at: 2 put: (Color r: 1.0 g: 25000 /
65535 b: 5000 / 65535). t1 at: 3 put: (Color r: 1.0 g: 45000 /
65535 b: 5000 / 65535). t1 at: 4 put: (Color r: 65000 / 65535
g: 65000 / 65535 b: 25000 / 65535). t1 at: 5 put: (Color r: 65000 /
65535 g: 65000 / 65535 b: 500 / 65535). t1 at: 6 put: (Color r:
45000 / 65535 g: 45000 / 65535 b: 500 / 65535). t1 at: 7 put:
(Color r: 25000 / 65535 g: 25000 / 65535 b: 500 / 65535). t1 at:
8 put: (Color r: 5000 / 65535 g: 65535 / 65535 b: 20000 / 65535).
t1 at: 9 put: (Color r: 5000 / 65535 g: 65535 / 65535 b: 65535 /
65535). t1 at: 10 put: (Color r: 5000 / 65535 g: 45000 / 65535
b: 65535 / 65535). t1 at: 11 put: (Color r: 5000 / 65535 g: 25000 /
65535 b: 65535 / 65535). t1 at: 12 put: (Color r: 5000 / 65535
g: 5000 / 65535 b: 65535 / 65535). t1 at: 13 put: (Color r: 1.0
g: 5000 / 65535 b: 25000 / 65535). t1 at: 14 put: (Color r: 1.0
g: 5000 / 65535 b: 45000 / 65535). t1 at: 15 put: (Color r: 1.0
g: 5000 / 65535 b: 65000 / 65535). t1 at: 16 put: (Color r: 45000 /
65535 g: 5000 / 65535 b: 65535 / 65535). t2 _ AlignmentMorph newColumn.
t3 _ OrderedCollection new. 1 to: 16 do: [:t4 | t3 add: (SimpleButtonMorph
new label: 'Color '; color: (t1 at: t4); target: self;
actionSelector: #miColor:; arguments: (Array with: (t1 at:
t4)))]. t3 reverseDo: [:t5 | t2 addMorph: t5]. t2 position: 650 @ 30. self
addMorph: t2. cartel _ t2! ! !TEGMain methodsFor: 'initialization' stamp: 'edc
5/6/2006 07:34'! howManyPlayers maxClient := 0. [maxClient between: 1 and: 5]
whileFalse: [maxClient := (FillInTheBlank request: 'How many players 1 - 5')
asInteger]. self cuantosHumanos: maxClient. losJugadores := Dictionary new. 1
to: 6 do: [:t2 | losJugadores at: t2 put: Jugador new. (losJugadores
at: t2) nombre: 'maquina' , t2 asString]. jugadoresVivos := 6.! ! !TEGMain
methodsFor: 'initialization'! informaCartas self halt. self addMorphBack:
(InformaCartas new initialize: losJugadores)! ! !TEGMain methodsFor:
'initialization' stamp: 'edc 5/20/2006 16:05'! initialize4 self
howManyPlayers. botones := Dictionary new. self shuffleCards. self
distribuyePaises. self miColor. ronda := 1. estado := 1. numCarta := 1.
playerTurn := 1. cambiosTotales := 0. self puedeAtacar: false. done := false.
self suspendEventHandler! ! !TEGMain methodsFor: 'initialization'! leerArchivo
| t1 t2 | t2 _ String new. [miArchivo atEnd] whileFalse: [t1 _ miArchivo
next asCharacter. t1 asciiValue = 13 ifTrue: [^ t2]. t2 _ t2 , t1
asString]! ! !TEGMain methodsFor: 'initialization' stamp: 'edc 10/21/2004
12:11'! miColor | t1 t2 paises | t1 := Color wheel: 6 saturation: 0.7
brightness: 0.9. t2 := 1. t1 do: [:t3 | (losJugadores at: t2)
miColor: t3. t2 := t2 + 1]. paises := self submorphs select: [:p | p
isKindOf: PaisMorph] thenCollect:[ :any| any]. paises do: [:t4 | t4 color:
(losJugadores at: t4 deQuienSoy) miColor. t4 mostrar]! ! !TEGMain
methodsFor: 'initialization'! miColor: t1 1 to: 6 do: [:t2 | (losJugadores
at: t2) miColor ifNil: [(losJugadores at: t2) miColor: t1.
(losJugadores at: t2) misPaises do: [:t3 | (submorphs at: t3)
color: t1]. t2 = 6 ifTrue: [cartel delete. cartel _ TextMorph
borderedPrototype. cartel beAllFont: (StrikeFont familyName:
#ComicBold size: 18). cartel color: Color red. cartel newContents:
'SqueakRos fight the evil '. cartel extent: self width - 30 @ 40.
cartel center: self center. cartel top: self top + 10. self
addMorphBack: cartel. self startStepping. self makeMove]. ^
t2]]! ! !TEGMain methodsFor: 'initialization' stamp: 'edc 5/6/2006 07:32'!
shuffleCards | newCard | cartasOrden := OrderedCollection new. [cartasOrden
size < 44] whileTrue: [(cartasOrden includes: (newCard := 44 atRandom))
ifFalse: [cartasOrden add: newCard]].! ! !TEGMain methodsFor: 'initialization'
stamp: 'edc 5/8/2006 07:27'! verificarCambio: cardDialog | cambio soldado
canon caballo dibujo | soldado _ 0. canon _ 0. caballo _ 0. cambio _
cardDialog submorphs count: [:m | m class name = 'DrawCard' and: [m
submorphs first estado = true]]. cambio > 3 ifTrue: [ cartel string:
'Tramposo '. cartel center: cardDialog center. cardDialog addMorph:
cartel]. dibujo _ cardDialog submorphs select: [:m | m class name =
'DrawCard' and: [m submorphs first estado = true]] thenCollect: [:each
| each numero \\\ 3]. cambio _ 0. dibujo do: [:tipo | tipo caseOf: { [0]
-> [soldado = 0 ifTrue: [soldado _ 1. cambio _ cambio + 1]].
[1] -> [canon = 0 ifTrue: [canon _ 1. cambio _ cambio + 1]].
[2] -> [caballo = 0 ifTrue: [caballo _ 1. cambio _ cambio +
1]]} otherwise: [Transcript open]]. dibujo _ cardDialog submorphs
select: [:m | m class name = 'DrawCard' and: [m submorphs first estado =
true]] thenCollect: [:each | each numero >42 ifTrue: [cambio _ cambio + 1
]]. cambio = 3 ifTrue: [^ true] ifFalse: ["(StreamingMP3Sound onFileNamed:
NewFolder pathName , FileDirectory slash , 'tramposo.mp3') play." cartel
string: 'Tramposo '. cartel center: cardDialog center. cardDialog
addMorph: cartel. self halt]! ! !TEGMain methodsFor: 'menus'!
addCustomMenuItems: t1 hand: t2 super addCustomMenuItems: t1 hand: t2. t1
addLine. self addMenuItemsTo: t1 hand: t2! ! !TEGMain methodsFor: 'menus'!
addMenuItemsTo: t1 hand: t2 t1 add: 'new game' target: self action:
#newGame. t1 add: 'reset...' target: self action: #reset. t1 add:
'grabar estado' target: self action: #grabaEstado. t1 add: 'leer estado'
target: self action: #leerEstado. t1 add: 'debug' target: self action:
#debug! ! !TEGMain methodsFor: 'menus' stamp: 'EDC 6/26/2002 07:50'!
cambiaCartas: cardDialog | tengo cambios hagaCambio | estado _ 4. cambios _
#(4 6 8 10 12 15 ). (losJugadores at: playerTurn) esHumano ifTrue:
[hagaCambio _ self verificarCambio: cardDialog] ifFalse: [hagaCambio _ true].
cardDialog submorphs do: [:m | m class name = 'DrawCard' ifTrue: [m
submorphs first estado ifTrue: [tengo _ (losJugadores at: playerTurn)
misPaises includes: m numero. tengo ifTrue: [(submorphs at: m
numero) add: 2]. (losJugadores at: playerTurn) misCartas
remove: m numero ifAbsent: []]]]. cambiosTotales _ cambiosTotales +
1. cambiosTotales < 7 ifTrue: [pone _ pone + cambios at: cambiosTotales]
ifFalse: [pone _ pone + 15 + 5 * (cambiosTotales - 6)]. cardDialog delete. ! !
!TEGMain methodsFor: 'menus' stamp: 'EDC 6/27/2002 16:05'! hacerListaPaises:
aBoolean | misLimites listaLimpia | misLimites _ Set new. "Deseo la lista
total de los paises limitrofes a mis paises" (losJugadores at: playerTurn)
misPaises do: [:pais | limites do: [:each | (each includes: pais)
ifTrue: [misLimites add: each]]]. listaLimpia _ misLimites copy. aBoolean
ifTrue: [ "Debo eliminar de la lista las fronteras de paises que ambos me
pertenezcan" misLimites do: [:frontera | (((losJugadores at: playerTurn)
misPaises includes: (frontera at: 1)) and: [(losJugadores at:
playerTurn) misPaises includes: (frontera at: 2)]) ifTrue:
[listaLimpia remove: frontera]] ] ifFalse: [ "Debo eliminar de la lista las
fronteras de paises que ambos me pertenezcan" misLimites do: [:frontera |
(((losJugadores at: playerTurn) misPaises includes: (frontera at: 1))
and: [(losJugadores at: playerTurn) misPaises includes: (frontera at:
2)]) ifFalse: [listaLimpia remove: frontera]]]. . ^ listaLimpia ! ! "--
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! TEGMain class
instanceVariableNames: 'current zero'! !TEGMain class methodsFor: 'as yet
unclassified'! debug self maquinaPone! ! !TEGMain class methodsFor: 'as yet
unclassified'! makeRTS: t1 | t2 t3 | t1 delete. Preferences disable:
#cmdDotEnabled; disable: #cmdGesturesEnabled; disable: #cmdKeysInText;
enable: #noviceMode; disable: #warnIfNoSourcesFile; disable:
#warnIfNoChangesFile; enable: #eToyFriendly; disable:
#honorDesktopCmdKeys; enable: #appendToErrorLog; enable: #noDebugButton.
t2 _ FileDirectory localNameFor: Smalltalk imageName. t3 _ (t2 copyFrom: 1
to: (t2 findString: '.image')) , 'RTS.image'. Smalltalk
changeImageNameTo: (FileDirectory default fullNameFor: t3); closeSourceFiles;
openSourceFiles; snapshot: true andQuit: true! ! !TEGMain class methodsFor:
'as yet unclassified' stamp: 'edc 5/6/2006 08:34'! reset "For start the game
with all variables on intiial state. TEGMain reset" self current:self zero
openCenteredInWorld . self current initialize4. ^ self current! ! !TEGMain
class methodsFor: 'as yet unclassified' stamp: 'edc 5/7/2006 15:09'! zero ^zero
copy! ! !TEGMain class methodsFor: 'as yet unclassified' stamp: 'edc 5/6/2006
07:07'! zero: aMorph zero := aMorph! ! !TEGMain class methodsFor: 'instance
creation' stamp: 'edc 4/28/2006 07:37'! current ^current! ! !TEGMain class
methodsFor: 'instance creation' stamp: 'edc 4/28/2006 07:38'! current: anObject
current := anObject! ! HVRootView subclass: #TEGServerRoot
instanceVariableNames: '' classVariableNames: '' poolDictionaries: ''
category: 'Morphic-TEG'! !TEGServerRoot methodsFor: 'start/stop' stamp: 'edc
3/14/2006 08:47'! startOn: portNum mode: mode "Creates a new standalone http
service with this root view plugged in." | name ma authdb| Transcript clear.
name := viewClass ifNil: [self class name] ifNotNil: [viewClass name].
ma := ModuleAssembly core. coreMod := ma currentModule. ma logTo:
(KomLogger on: Transcript). authdb := KomAuthDb new. authdb addUser:
'edgar' withPassword: 'squeak'. authdb addUser: 'luciano' withPassword: 'teg'.
authdb addUser: 'ale' withPassword: 'srv'. authdb addUser: 'carla'
withPassword: 'utn'. authdb addUser: 'guest' withPassword: ''. ma
authenticate: authdb realm: 'TEG'. ma trackSessions. sessionMod := ma
currentModule. ma sessionTimeout: 1. alias = '' ifTrue: [ma addPlug:
[:request | self process: request]] ifFalse: [ma alias: alias to: [ma
addPlug: [:request | self process: request]]]. ^ (HttpService startOn: portNum
named: name) plug: ma rootModule; mode: mode! ! Object subclass: #TEGWeb
instanceVariableNames: 'ip' classVariableNames: '' poolDictionaries: ''
category: 'Morphic-TEG'! !TEGWeb commentStamp: '<historical>' prior: 0! TEGWeb
new TEGWeb stop! !TEGWeb methodsFor: 'as yet unclassified' stamp: 'edc
5/20/2006 10:22'! decide | method start status | start := TEGMain current
addClient: ModAuth user. start ifFalse: [^ self pause] ifTrue:
[ status := TEGMain current statusFor: ModAuth user .
status ifFalse: [^self pause] ifTrue: [method := HttpRequest
current url . method := method copyFrom:2 to:
method size. method = 'favicon.ico' ifFalse: [
method size = 0 ifFalse: [(self perform: method asSymbol) ]]]].
status := TEGMain current statusFor: ModAuth user . status
ifFalse: [^self pause] ifTrue:[^self step]! ! !TEGWeb methodsFor: 'as
yet unclassified' stamp: 'edc 5/20/2006 10:07'! initialize | ma authdb t3 |
Socket initializeNetwork. self ip: NetNameResolver localAddressString. TEGMain
reset. authdb := KomAuthDb new. authdb addUser: 'edgar' withPassword:
'squeak'. authdb addUser: 'luciano' withPassword: 'teg'. authdb addUser: 'ale'
withPassword: 'srv'. authdb addUser: 'carla' withPassword: 'utn'. authdb
addUser: 'guest' withPassword: ''. ma := ModuleAssembly core. ma
authenticate: authdb realm: 'TEG'. ma logTo: (KomLogger on: Transcript).
ma alias: '/teg' to: [ma addPlug: [:t2 | HttpResponse fromMIMEDocument:
TEGMain current grabaFoto asWebImage]]. ma addPlug: [:t2 | t2 fields size
= 0 ifFalse: [t3 := Point x: (t2 fields at: 'point.x') y:
(t2 fields at: 'point.y'). TEGMain current click: t3]. HttpResponse
fromString: self decide]. ^ (HttpService startOn: 8000 named: 'TEG') plug: ma
rootModule;setDebugMode! ! !TEGWeb methodsFor: 'as yet unclassified' stamp:
'edc 5/17/2006 06:54'! pause ^ '<HTML> <HEAD> <TITLE>Squeak TEG</TITLE>
</HEAD> <meta http-equiv="Refresh" content="10" > <BODY> <br> <img
src="http://',ip,':8000/teg"> <br> <h3>You are in pause now </h3> </BODY>
</HTML>'! ! !TEGWeb methodsFor: 'as yet unclassified' stamp: 'edc 5/17/2006
07:02'! step ^ '<HTML> <HEAD> <TITLE>TEGWeb</TITLE> </HEAD> <BODY> <form>
<img src="http://',ip,':8000/teg" usemap="#Map"> <map name="Map"> <area
shape="poly"
coords="132,420,74,454,73,462,85,471,62,469,57,460,61,451,89,379,103,387,111,385\
,131,401" href="argentina"> <area shape="rect" coords= "102,454,147 ,468 "
href="ataque "> <area shape="rect" coords= "225,454,292 ,468 " href="finataque
"> <area shape="rect" coords= "367,454,431 ,468 " href="continuar "> <area
shape="rect" coords= "508,454,568 ,468 " href="fortificar "> <area shape="rect"
coords= "643,454,684 , 468" href="debug "> <area shape="rect" coords=
"200,420,240 , 440" href="boton1 "> <area shape="rect" coords= "245,420,285 ,
440" href="boton2 "> <area shape="rect" coords= "290,420,330 , 440" href="boton3
"> <area shape="rect" coords= "335,420,375 , 440" href="boton4 "> <area
shape="rect" coords= "380,420,420 , 440" href="boton5 "> <area shape="rect"
coords= "425,465,465 , 440" href="boton6 "> <area shape="rect" coords=
"470,420,510 , 440" href="boton7 "> <area shape="rect" coords= "515,420,555 ,
440" href="boton8 "> <area shape="rect" coords= "560,420,600 , 440" href="boton9
"> <area shape="poly" coords="69 ,316 ,97 ,324 ,99 ,332 ,100 ,340 ,111 ,351
,133 ,374 ,129 ,393 ,115 ,382 ,92 ,378 ,68 ,354 ,69 ,317" href="peru "> <area
shape="poly" coords="62 ,324 ,202 ,341 ,212 ,354 ,179 ,392 ,164 ,390 ,137 ,417
,135 ,396 ,139 ,375 ,115 ,350 ,101 ,333 ,120 ,320" href="brasil "> <area
shape="poly" coords=" 84 ,293 ,103 ,291 ,115 ,300 ,125 ,296 ,158 ,314 ,161 ,321
,124 ,318 ,105 ,325 ,72 ,313 ,80 ,299 ,85 ,292" href="venezuela "> <area
shape="poly" coords=" 50 ,228 ,78 ,226 ,97 ,241 ,97 ,255 ,112 ,260 ,111 ,275
,114 ,295 ,105 ,288 ,79 ,265 ,66 ,263 ,47 ,241 " href="mexico"> <area
shape="poly" coords=" 129 ,192 ,154 ,193 ,175 ,215 ,193 ,208 ,223 ,209 ,174 ,228
,144 ,237 ,149 ,257 ,140 ,256 ,125 ,246 ,100 ,245 " href="florida"> <area
shape="poly" coords=" 48 ,180 ,126 ,192 ,121 ,201 ,113 ,210 ,108 ,219 ,100 ,227
,95 ,237 ,77 ,224 ,50 ,225 ,40 ,215 ,41 ,197 " href="california"> <area
shape="poly" coords=" 58 ,139 ,123 ,143 ,120 ,189 ,49 ,177 ,47 ,173 ,44 ,163 ,53
,158 ,61 ,153 ,61 ,139 ,82 ,138 ,104 ,140 " href="oregon"> <area shape="poly"
coords=" 128 ,141 ,168 ,143 ,178 ,152 ,170 ,168 ,189 ,181 ,183 ,205 ,174 ,210
,158 ,190 ,125 ,187 ,125 ,168 ,125 ,151 " href="newyork"> <area shape="poly"
coords=" 204 ,153 ,213 ,153 ,218 ,164 ,229 ,161 ,235 ,170 ,251 ,173 ,252 ,179
,237 ,186 ,224 ,196 ,215 ,205 ,186 ,201 " href="labrador"> <area shape="poly"
coords=" 10 ,88 ,41 ,77 ,62 ,90 ,63 ,135 ,54 ,139 ,58 ,151 ,45 ,157 ,49 ,147 ,40
,131 ,18 ,136 ,15 ,115 " href="alaska"> <area shape="poly" coords=" 66 ,92
,93 ,92 ,131 ,106 ,161 ,111 ,184 ,99 ,205 ,115 ,187 ,137 ,66 ,136 ,65 ,118 ,64
,99 ,65 ,93 " href="yukon"> <area shape="poly" coords=" 293 ,56 ,314 ,76 ,284
,136 ,314 ,105 ,269 ,147 ,260 ,133 ,250 ,110 ,240 ,92 ,227 ,90 ,236 ,76 ,246 ,54
" href="groenland"> <area shape="poly" coords=" 268 ,159 ,274 ,156 ,279 ,155
,288 ,158 ,292 ,164 ,291 ,169 ,287 ,172 ,281 ,174 ,274 ,174 ,267 ,168 ,263 ,162
" href="island"> <area shape="poly" coords=" 300 ,164 ,314 ,157 ,329 ,157
,336 ,183 ,330 ,207 ,319 ,204 ,308 ,216 ,300 ,217 ,286 ,218 ,280 ,201 ,298 ,185
" href="scandinav"> <area shape="poly" coords=" 333 ,158 ,347 ,160 ,351 ,169
,389 ,147 ,393 ,177 ,389 ,207 ,367 ,225 ,359 ,267 ,315 ,249 ,313 ,232 ,321 ,222
" href="germany"> <area shape="poly" coords=" 291 ,230 ,309 ,230 ,312 ,239
,314 ,246 ,306 ,249 ,299 ,251 ,292 ,257 ,286 ,253 ,279 ,248 ,280 ,242 ,285 ,237
" href="france"> <area shape="poly" coords=" 278 ,235 ,273 ,241 ,266 ,238
,260 ,239 ,259 ,244 ,253 ,239 ,253 ,232 ,259 ,228 ,261 ,219 ,268 ,217 ,275 ,223
" href="britain"> <area shape="poly" coords=" 277 ,248 ,266 ,253 ,267 ,261
,249 ,262 ,245 ,267 ,254 ,281 ,265 ,279 ,272 ,268 ,288 ,268 ,294 ,260 ,285 ,254
" href="espania"> <area shape="poly" coords=" 292 ,268 ,295 ,263 ,300 ,255
,307 ,252 ,313 ,251 ,321 ,255 ,327 ,262 ,323 ,266 ,319 ,270 ,310 ,269 ,304 ,282
" href="italia"> <area shape="poly" coords=" 393 ,146 ,397 ,175 ,394 ,202
,408 ,203 ,428 ,210 ,441 ,222 ,447 ,228 ,453 ,221 ,446 ,154 ,431 ,103 ,415 ,134
" href="rusia"> <area shape="poly" coords=" 367 ,226 ,390 ,210 ,407 ,205 ,426
,212 ,440 ,225 ,443 ,236 ,426 ,249 ,423 ,265 ,403 ,271 ,386 ,268 ,365 ,268 "
href="mongolia"> <area shape="poly" coords=" 319 ,274 ,329 ,260 ,361 ,270
,371 ,282 ,393 ,301 ,368 ,311 ,341 ,293 ,339 ,281 ,334 ,275 ,327 ,275 ,323 ,273
" href="turquia"> <area shape="poly" coords=" 369 ,273 ,386 ,271 ,420 ,270
,439 ,268 ,452 ,271 ,454 ,276 ,452 ,282 ,435 ,308 ,429 ,310 ,420 ,299 ,388 ,289
" href="india"> <area shape="poly" coords=" 503 ,100 ,466 ,100 ,464 ,110 ,439
,113 ,444 ,137 ,448 ,169 ,454 ,222 ,462 ,225 ,471 ,220 ,484 ,190 ,482 ,156 "
href="gobi"> <area shape="poly" coords=" 533 ,96 ,508 ,100 ,496 ,126 ,484
,154 ,499 ,158 ,514 ,155 ,530 ,162 ,531 ,173 ,546 ,173 ,561 ,145 ,570 ,109 "
href="tamir"> <area shape="poly" coords=" 571 ,107 ,581 ,103 ,595 ,107 ,593
,124 ,586 ,152 ,575 ,167 ,572 ,195 ,562 ,199 ,554 ,179 ,549 ,173 ,557 ,160 "
href="kamchatka"> <area shape="poly" coords=" 486 ,158 ,502 ,162 ,514 ,157
,528 ,163 ,529 ,174 ,522 ,187 ,514 ,196 ,516 ,210 ,477 ,217 ,480 ,204 ,489 ,183
" href="siberia"> <area shape="poly" coords=" 435 ,247 ,451 ,228 ,464 ,227
,474 ,228 ,483 ,235 ,499 ,238 ,508 ,242 ,516 ,248 ,510 ,267 ,499 ,276 ,426 ,263
" href="china"> <area shape="poly" coords=" 515 ,212 ,484 ,217 ,478 ,222 ,479
,229 ,488 ,233 ,497 ,235 ,510 ,242 ,517 ,247 ,523 ,250 ,527 ,232 ,518 ,227 "
href="tsamir"> <area shape="poly" coords=" 531 ,177 ,542 ,175 ,549 ,177 ,545
,186 ,535 ,191 ,537 ,215 ,532 ,230 ,521 ,229 ,518 ,213 ,515 ,201 ,523 ,190 "
href="aral"> <area shape="poly" coords=" 555 ,215 ,566 ,214 ,568 ,219 ,563
,226 ,562 ,242 ,554 ,251 ,547 ,267 ,541 ,267 ,542 ,259 ,547 ,247 ,554 ,234 "
href="japon"> <area shape="poly" coords=" 455 ,271 ,473 ,271 ,485 ,277 ,495
,280 ,500 ,291 ,494 ,299 ,483 ,297 ,499 ,316 ,494 ,321 ,470 ,305 ,458 ,291 "
href="malasia"> <area shape="poly" coords=" 482 ,322 ,491 ,322 ,498 ,320 ,505
,318 ,511 ,315 ,517 ,325 ,526 ,329 ,528 ,338 ,518 ,341 ,510 ,345 ,490 ,347 "
href="sumatra"> <area shape="poly" coords=" 546 ,327 ,557 ,328 ,571 ,328 ,584
,333 ,586 ,344 ,572 ,344 ,562 ,341 ,555 ,340 ,545 ,339 ,538 ,335 ,541 ,328 "
href="newzeland"> <area shape="poly" coords=" 544 ,352 ,551 ,347 ,563 ,352
,572 ,352 ,589 ,360 ,589 ,376 ,586 ,390 ,571 ,395 ,541 ,391 ,537 ,379 ,541 ,373
" href="eastocean"> <area shape="poly" coords=" 515 ,362 ,528 ,351 ,540 ,354
,539 ,371 ,533 ,378 ,537 ,392 ,532 ,400 ,517 ,404 ,499 ,391 ,494 ,380 ,509 ,372
" href="westocean"> <area shape="poly" coords=" 239 ,286 ,287 ,285 ,280 ,295
,278 ,303 ,306 ,319 ,313 ,338 ,317 ,360 ,283 ,358 ,248 ,344 ,221 ,331 ,216 ,310
" href="sahara"> <area shape="poly" coords=" 291 ,290 ,332 ,290 ,349 ,303
,322 ,307 ,314 ,313 ,310 ,318 ,296 ,312 ,284 ,304 ,281 ,298 ,285 ,293 ,288 ,291
" href="egipto"> <area shape="poly" coords=" 325 ,360 ,315 ,337 ,312 ,326
,315 ,316 ,324 ,312 ,334 ,307 ,352 ,308 ,360 ,315 ,374 ,318 ,355 ,344 ,350 ,365
" href="etiopia"> <area shape="poly" coords=" 283 ,364 ,325 ,366 ,336 ,373
,351 ,368 ,344 ,384 ,336 ,400 ,320 ,410 ,303 ,409 ,292 ,393 ,293 ,381 ,281 ,375
" href="sudafrica"> <area shape="poly" coords=" 360 ,375 ,367 ,374 ,371 ,372
,379 ,378 ,371 ,386 ,368 ,395 ,370 ,406 ,363 ,411 ,352 ,410 ,350 ,401 ,355 ,385
" href="madagascar"> </map> </form> </BODY> <h3><br> ', TEGMain current
lastMorph printString,'</br> </h3></HTML>'! ! !TEGWeb methodsFor: 'urls'
stamp: 'edc 3/24/2006 08:03'! alaska ^self cualPais: 'Alaska'! ! !TEGWeb
methodsFor: 'urls' stamp: 'edc 3/24/2006 08:19'! aral ^self cualPais: 'Aral'! !
!TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006 08:04'! argentina ^self
cualPais: 'Argentina' ! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006
10:05'! ataque TEGMain current ataque. ^ self redirectTo: #step! ! !TEGWeb
methodsFor: 'urls' stamp: 'edc 3/24/2006 09:27'! boton1 | losboton miboton |
losboton := TEGMain current botones. miboton := losboton at: 1. ^ self
switchButton: miboton! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006
09:27'! boton2 | losboton miboton | losboton := TEGMain current botones.
miboton := losboton at: 2. ^ self switchButton: miboton! ! !TEGWeb methodsFor:
'urls' stamp: 'edc 3/24/2006 09:27'! boton3 | losboton miboton | losboton :=
TEGMain current botones. miboton := losboton at: 3. ^ self switchButton:
miboton! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006 09:27'! boton4 |
losboton miboton | losboton := TEGMain current botones. miboton := losboton
at: 4. ^ self switchButton: miboton! ! !TEGWeb methodsFor: 'urls' stamp: 'edc
5/8/2006 09:05'! boton5 | losboton miboton | losboton := TEGMain current
botones. miboton := losboton at: 5. ^ self switchButton: miboton! ! !TEGWeb
methodsFor: 'urls' stamp: 'edc 3/24/2006 09:27'! boton6 | losboton miboton |
losboton := TEGMain current botones. miboton := losboton at: 6. ^ self
switchButton: miboton! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006
09:27'! boton7 | losboton miboton | losboton := TEGMain current botones.
miboton := losboton at: 7. ^ self switchButton: miboton! ! !TEGWeb methodsFor:
'urls' stamp: 'edc 3/24/2006 09:27'! boton8 | losboton miboton | losboton :=
TEGMain current botones. miboton := losboton at: 8. ^ self switchButton:
miboton! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006 09:28'! boton9 |
losboton miboton | losboton := TEGMain current botones. miboton := losboton
at: 9. ^ self switchButton: miboton! ! !TEGWeb methodsFor: 'urls' stamp: 'edc
3/24/2006 08:04'! brasil ^self cualPais: 'Brasil'. ! ! !TEGWeb methodsFor:
'urls' stamp: 'edc 3/26/2006 08:39'! britain ^self cualPais: 'Britain'.! !
!TEGWeb methodsFor: 'urls' stamp: 'edc 3/26/2006 08:36'! california ^self
cualPais: 'California'! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/26/2006
08:36'! china ^self cualPais: 'China'! ! !TEGWeb methodsFor: 'urls' stamp:
'edc 5/4/2006 17:24'! continuar TEGMain current continue. ^ self step! !
!TEGWeb methodsFor: 'urls' stamp: 'edc 5/16/2006 11:59'! cualPais: aString |
paises elPais | paises := TEGMain current submorphsSatisfying: [:t7 | t7
isKindOf: PaisMorph]. elPais := paises detect: [:p | p nombre = aString].
TEGMain current lastMorph: elPais. elPais clickWeb. TEGMain current pone = 0
ifTrue: [^ HttpResponse redirectTo: #pause] ifFalse: [^ HttpResponse
redirectTo: #step]! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 5/20/2006 16:10'!
debug self halt.! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/25/2006 18:00'!
eastocean ^self cualPais: 'EastOcean'! ! !TEGWeb methodsFor: 'urls' stamp:
'edc 3/24/2006 08:25'! egipto ^self cualPais: 'Egipto'! ! !TEGWeb methodsFor:
'urls' stamp: 'edc 5/20/2006 10:44'! espania ^self cualPais: 'Espa–a'! !
!TEGWeb methodsFor: 'urls' stamp: 'edc 5/20/2006 10:45'! etiopia ^self
cualPais: 'Etiop’a'! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/30/2006 11:55'!
finAtaque TEGMain current fortificar. ^ self redirectTo: #step! ! !TEGWeb
methodsFor: 'urls' stamp: 'edc 3/30/2006 11:57'! finataque TEGMain current
fortificar. ^ self redirectTo: #step! ! !TEGWeb methodsFor: 'urls' stamp: 'edc
3/24/2006 08:05'! florida ^self cualPais: 'Florida'! ! !TEGWeb methodsFor:
'urls' stamp: 'edc 3/27/2006 09:07'! fortificar TEGMain current fortificar. ^
self redirectTo: #step! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006
08:27'! france ^self cualPais: 'France'! ! !TEGWeb methodsFor: 'urls' stamp:
'edc 3/24/2006 08:06'! germany ^self cualPais: 'Germany'! ! !TEGWeb
methodsFor: 'urls' stamp: 'edc 3/24/2006 08:27'! gobi ^self cualPais: 'Gobi'! !
!TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006 08:06'! groenland ^self
cualPais: 'Groenland'! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006
08:27'! india ^self cualPais: 'India'! ! !TEGWeb methodsFor: 'urls' stamp:
'edc 3/24/2006 08:06'! island ^self cualPais: 'Island'! ! !TEGWeb methodsFor:
'urls' stamp: 'edc 3/24/2006 08:28'! italia ^self cualPais: 'Italia'! !
!TEGWeb methodsFor: 'urls' stamp: 'edc 5/20/2006 10:44'! japon ^self cualPais:
'Jap—n'! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006 08:28'! kamchatka
^self cualPais: 'Kamchatka'! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006
08:29'! labrador ^self cualPais: 'Labrador'! ! !TEGWeb methodsFor: 'urls'
stamp: 'edc 3/24/2006 08:29'! madagascar ^self cualPais: 'Madagascar'! !
!TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006 08:29'! malasia ^self
cualPais: 'Malasia'! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006 08:06'!
mexico ^self cualPais: 'Mexico'! ! !TEGWeb methodsFor: 'urls' stamp: 'edc
3/24/2006 08:30'! mongolia ^self cualPais: 'Mongolia'! ! !TEGWeb methodsFor:
'urls' stamp: 'edc 3/30/2006 11:36'! newyork ^self cualPais: 'NewYork'! !
!TEGWeb methodsFor: 'urls' stamp: 'edc 3/26/2006 08:20'! newzeland ^self
cualPais: 'NewZeland'! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006
08:07'! oregon ^self cualPais: 'Oregon'! ! !TEGWeb methodsFor: 'urls' stamp:
'edc 3/24/2006 08:07'! peru ^self cualPais: 'Peru'! ! !TEGWeb methodsFor:
'urls' stamp: 'edc 3/24/2006 08:30'! rusia ^self cualPais: 'Rusia'! ! !TEGWeb
methodsFor: 'urls' stamp: 'edc 3/24/2006 08:31'! sahara ^self cualPais:
'Sahara'! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006 08:31'! scandinav
^self cualPais: 'Scandinav'! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006
08:31'! siberia ^self cualPais: 'Siberia'! ! !TEGWeb methodsFor: 'urls' stamp:
'edc 3/24/2006 08:03'! sudafrica ^self cualPais: 'Sudafrica'! ! !TEGWeb
methodsFor: 'urls' stamp: 'edc 3/24/2006 08:32'! sumatra ^self cualPais:
'Sumatra'! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 5/6/2006 11:42'!
switchButton: aButton aButton setSwitchState: aButton estado not. TEGMain
current lastMorph: aButton. ! ! !TEGWeb methodsFor: 'urls' stamp: 'edc
3/24/2006 08:32'! tamir ^self cualPais: 'Tamir'! ! !TEGWeb methodsFor: 'urls'
stamp: 'edc 3/24/2006 08:32'! tsamir ^self cualPais: 'Tsamir'! ! !TEGWeb
methodsFor: 'urls' stamp: 'edc 3/24/2006 08:32'! turquia ^self cualPais:
'Turquia'! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/24/2006 08:07'! venezuela
^self cualPais: 'Venezuela'! ! !TEGWeb methodsFor: 'urls' stamp: 'edc 3/25/2006
18:00'! westocean ^self cualPais: 'WestOcean'! ! !TEGWeb methodsFor: 'urls'
stamp: 'edc 3/24/2006 08:08'! yukon ^self cualPais: 'Yukon'! ! !TEGWeb
methodsFor: 'accessing' stamp: 'edc 5/17/2006 06:52'! ip "Answer the value of
ip" ^ ip! ! !TEGWeb methodsFor: 'accessing' stamp: 'edc 5/17/2006 06:52'! ip:
anObject "Set the value of ip" ip := anObject! ! "-- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- "! TEGWeb class instanceVariableNames: ''! !TEGWeb
class methodsFor: 'start/stop' stamp: 'edc 5/5/2006 06:43'! stop
(ApplicationService serviceNamed: 'TEG') unregister.! !

program TEG1; var n, x, y, x1, y1: integer; MyWindow, WhichWindow:
WindowPtr; MyEvent: EventREcord; Done, bien: Boolean; donde: Point; f: text;
pais: RgnHandle; myColor: RGBColor; procedure dibupais; var donde:
point; procedure SetUpPen; var Pen: Cursor; I: Integer; P: Point;
begin for I := 0 to 15 do begin Pen.Data[I] := 256; Pen.Mask[I] :=
256 end; Pen.Data[8] := $ffff; Pen.Mask[8] := $ffff; P.H := 8;
P.V := 8; Pen.HotSpot := P; SetCursor(Pen); PenSize(1, 1) end;
begin SetUpDrawing; SetUpPen; N := 0; repeat if Button then begin
n := n + 1; GetMouse(donde); MoveTo(donde.h, donde.v); writeln(f,
donde.h, donde.v); while Button do begin GetMouse(donde);
LineTo(donde.h, donde.v); end end until n = 20 end; begin
reset(f, 'Coordenadas'); MyWindow := GetNewCWindow(128, nil, WindowPtr(-1));
SetPort(MyWindow); ShowWindow(MyWindow); with mycolor do begin red :=
65535; green := 5000; blue := 5000; end; rgbForeColor(MyColor); pais :=
NewRgn; OpenRgn; readln(f, x1, y1); MoveTo(x1, y1); while not eof(f) do
begin readln(f, x, y); LineTo(x, y); end; LineTo(x1, y1); CloseRgn(pais);
PaintRgn(pais) end. begin rewrite(f, 'Coordenadas'); dibupais; close(f) end.

unit estrategia; interface uses windows; var HLimites, manija1_recurso:
Handle; Done, fin: Boolean; r, quedan, turno, a, d: integer; procedure
leeraton; procedure maquina_pone (pone, j: integer); function cuantos_ejercitos:
integer; function limites (p1: integer; var comienza, p2: integer): boolean;
function suerte (a, d: integer): boolean; procedure muerte; function
Elige_ejercitos (cuantos, jugador, caso: integer; var ej_al_pais: integer):
boolean; function ver_cartas: boolean; implementation function ver_cartas;
var cambio, comodin, soldado, canon, caballo, i, c, c2, p, tipo: integer;
sold3, canon3, caba3: integer; si_cambio: boolean; begin sold3 := 0;
canon3 := 0; caba3 := 0; cambio := 0; soldado := 0; canon := 0;
caballo := 0; comodin := 0; cambio := 0; ver_cartas := false; for i := 1
to jugador[j].ncartas do begin if jugador[j].mis_cartas[i] >= 43 then
begin cambio := cambio + 1; comodin := i end; tipo :=
jugador[j].mis_cartas[i] mod 3; case tipo of 0: begin sold3 :=
sold3 + 1; if soldado = 0 then begin soldado := i; cambio
:= cambio + 1 end else if jugador[j].mis_cartas[i] in
jugador[j].mis_paises then begin c := jugador[j].mis_cartas[i];
jugador[j].mis_cartas[i] := jugador[j].mis_cartas[soldado];
jugador[j].mis_cartas[soldado] := c; end; end; 1: begin
canon3 := canon3 + 1; if canon = 0 then begin canon := i;
cambio := cambio + 1 end else if jugador[j].mis_cartas[i] in
jugador[j].mis_paises then begin c := jugador[j].mis_cartas[i];
jugador[j].mis_cartas[i] := jugador[j].mis_cartas[canon];
jugador[j].mis_cartas[canon] := c; end; end; 2: begin
caba3 := caba3 + 1; if caballo = 0 then begin caballo := i;
cambio := cambio + 1 end else if jugador[j].mis_cartas[i] in
jugador[j].mis_paises then begin c := jugador[j].mis_cartas[i];
jugador[j].mis_cartas[i] := jugador[j].mis_cartas[caballo];
jugador[j].mis_cartas[caballo] := c; end; end; end; end;
si_cambio := false; if cambio >= 3 then begin if sold3 = 3 then begin
c := jugador[j].ncartas; i := 1; repeat if jugador[j].mis_cartas[i]
mod 3 <> 0 then begin c2 := jugador[j].mis_cartas[i];
jugador[j].mis_cartas[i] := jugador[j].mis_cartas[c];
jugador[j].mis_cartas[c] := c2; c := c - 1; end; i := i + 1;
until i > c; end else if canon3 = 3 then begin c :=
jugador[j].ncartas; i := 1; repeat if jugador[j].mis_cartas[i] mod
3 <> 1 then begin c2 := jugador[j].mis_cartas[i];
jugador[j].mis_cartas[i] := jugador[j].mis_cartas[c];
jugador[j].mis_cartas[c] := c2; c := c - 1; end; i := i + 1;
until i > c; end else if caba3 = 3 then begin c :=
jugador[j].ncartas; i := 1; repeat if jugador[j].mis_cartas[i] mod
3 <> 2 then begin c2 := jugador[j].mis_cartas[i];
jugador[j].mis_cartas[i] := jugador[j].mis_cartas[c];
jugador[j].mis_cartas[c] := c2; c := c - 1; end; i := i + 1;
until i > c; end else if (soldado <> 0) and (canon <> 0) and (caballo <>
0) then begin p := 1; repeat c := 0; c2 :=
jugador[j].mis_cartas[p]; for i := p to jugador[j].ncartas do begin
if jugador[j].mis_cartas[i] > c2 then begin c2 :=
jugador[j].mis_cartas[i]; c := i end; end;
jugador[j].mis_cartas[c] := jugador[j].mis_cartas[p];
jugador[j].mis_cartas[p] := c2; p := p + 1; until p = 5; end;
dibu_cartas(jugador[j].ncartas, true, si_cambio); if si_cambio then for i
:= 1 to 3 do begin if jugador[j].mis_cartas[i] in jugador[j].mis_paises
then ej_en_pais[jugador[j].mis_cartas[i]] :=
ej_en_pais[jugador[j].mis_cartas[i]] + 2; jugador[j].mis_cartas[i] := 0
end; ver_cartas := true; jugador[j].ncartas := jugador[j].ncartas - 3;
for i := 1 to jugador[j].ncartas do begin if jugador[j].mis_cartas[i] = 0
then for c := i to 5 do if jugador[j].mis_cartas[c] <> 0 then
begin jugador[j].mis_cartas[i] := jugador[j].mis_cartas[c];
jugador[j].mis_cartas[c] := 0; i := i + 1; end; end; end; if
jugador[j].es_humano = 1 then dibu_cartas(jugador[j].ncartas, false,
si_cambio); end;{ver_cartas} procedure muerte; begin end;{muerte} procedure
leeraton; begin done := false; repeat if GetNextEvent(EveryEvent,
TheEvent) then if theEvent.what = mousedown then begin done :=
true; GetMouse(donde); end; until done; end;{leeraton} function
Elige_ejercitos; var e, pos_icon: integer; s1, s5, s10, s20, s50, ej_a_rep:
integer; elige_rec, elige_pais: boolean; n_ej_rec: array[1..9] of integer;
ejercitos: array[1..9] of Rect; rej: rect; begin if cuantos = 0 then
exit(Elige_ejercitos); for e := 1 to 9 do SetRect(ejercitos[e], 155 + e *
45, 420, 195 + e * 45, 460); ej_a_rep := cuantos; SetRect(rej, 195, 414,
630, 468); EraseREct(rej); s50 := 0; s20 := 0; s10 := 0; s5 := 0; s1
:= 0; pos_icon := 1; for e := 1 to 9 do n_ej_rec[e] := 0; s50 :=
cuantos div 50; cuantos := cuantos mod 50; s20 := cuantos div 20; cuantos
:= cuantos mod 20; s10 := cuantos div 10; cuantos := cuantos mod 10; if
cuantos <> 5 then begin s5 := cuantos div 5; s1 := cuantos mod 5; end
else s1 := 5; e := s50 + s20 + s10 + s5 + s1; if ((e >= 5) and (e <= 9))
or (cuantos <= 5) then repeat if s10 > 0 then begin s10 := s10 -
1; s5 := s5 + 2 end else if s20 > 0 then begin s20 := s20
- 1; s10 := s10 + 2 end else if s50 > 0 then begin s50 :=
s50 - 1; s20 := s20 + 2; s10 := s10 + 1; end else if s5 > 0
then begin s5 := s5 - 1; s1 := s1 + 5; end; e := s50 + s20
+ s10 + s5 + s1; until ((e >= 5) and (e <= 9)) or (ej_a_rep <= 5); if s1 >
0 then for pos_icon := 1 to s1 do begin DrawPicture(soldado1,
ejercitos[pos_icon]); n_ej_rec[pos_icon] := 1; end; e := pos_icon; if
s5 > 0 then for pos_icon := e to s5 + e - 1 do begin
DrawPicture(soldado5, ejercitos[pos_icon]); n_ej_rec[pos_icon] := 5; end;
e := pos_icon; if s10 > 0 then for pos_icon := e to s10 + e - 1 do begin
DrawPicture(soldado10, ejercitos[pos_icon]); n_ej_rec[pos_icon] := 10;
end; e := pos_icon; if s20 > 0 then for pos_icon := e to s20 + e - 1 do
begin DrawPicture(soldado20, ejercitos[pos_icon]); n_ej_rec[pos_icon] :=
20; end; e := pos_icon; if s50 > 0 then for pos_icon := e to s50 + e -
1 do begin DrawPicture(soldado50, ejercitos[pos_icon]);
n_ej_rec[pos_icon] := 50; end; ej_al_pais := 0; repeat leeraton; if
PtInRect(donde, carta) then exit(elige_ejercitos); e := 0; repeat
e := e + 1; elige_rec := PtInRect(donde, ejercitos[e]); until (e >
pos_icon) or (elige_rec); if (elige_rec) and (e < pos_icon) then begin
InvertRect(ejercitos[e]); ej_al_pais := ej_al_pais + n_ej_rec[e]; end;
case caso of 1: {inicio del juego} begin e := 0; repeat
e := e + 1; elige_pais := (PtInRgn(donde, Mi_region[e])) and
(de_quien_es_pais[e] = jugador); until (e = npaises) or (elige_pais);
end; 2: {ataques} begin e := 0; repeat e := e + 1;
elige_pais := (PtInRgn(donde, Mi_region[e])) and ((e = a) or (e = d));
until (e = npaises) or (elige_pais); end; end; if elige_pais then
begin RGBForeColor(negro); if ej_en_pais[e] < 99 then begin
ej_en_pais[e] := ej_en_pais[e] + ej_al_pais; escribe_Num_Ej(e) end;
end; until (elige_pais); Elige_ejercitos := elige_pais; EraseREct(rej);
end;{Elige_ejercitos} function suerte; var dado_a, dado_d, num_carta,
el_color: integer; begin while (ej_en_pais[a] > 1) and (ej_en_pais[d] > 0) do
begin repeat dado_a := 1 + abs(random) mod 5; dado_d := 1 +
abs(random) mod 5; until dado_a <> dado_d; if dado_a > dado_d then
ej_en_pais[d] := ej_en_pais[d] - 1 else ej_en_pais[a] := ej_en_pais[a] -
1; end; if ej_en_pais[d] = 0 then begin el_color :=
de_quien_es_pais[a]; RGBForeColor(jugador[el_color].mi_color);
PaintRgn(Mi_region[d]); EraseRect(rec_region[d]);
EraseRect(rec_region[a]); jugador[de_quien_es_pais[d]].mis_paises :=
jugador[de_quien_es_pais[d]].mis_paises - [d];
jugador[de_quien_es_pais[d]].total_paises :=
jugador[de_quien_es_pais[d]].total_paises - 1; if
jugador[de_quien_es_pais[d]].total_paises = 0 then muerte;
de_quien_es_pais[d] := j; jugador[j].total_paises := jugador[j].total_paises
+ 1; if ej_en_pais[a] > 2 then begin ej_en_pais[d] := 2;
escribe_Num_Ej(d); ej_en_pais[a] := ej_en_pais[a] - 2; end; pone :=
ej_en_pais[a]; ej_en_pais[a] := 0; jugador[j].ncartas :=
jugador[j].ncartas + 1; repeat num_carta := 1 + abs(random mod 44);
until cartas[num_carta] = false; jugador[j].mis_cartas[jugador[j].ncartas] :=
num_carta; cartas[num_carta] := true; suerte := true end else begin
suerte := false; escribe_Num_Ej(d); escribe_Num_Ej(a); end;
end;{suerte} function cuantos_ejercitos; var e, sum_ej: integer;
SudAmerica, NorteAmerica, Europa, Asia, Oceania, Africa: integer; begin
sum_ej := 0; SudAmerica := 0; NorteAmerica := 0; Europa := 0; Asia := 0;
Oceania := 0; Africa := 0; for e := 1 to npaises do begin if
de_quien_es_pais[e] = j then begin sum_ej := sum_ej + 1; case e of
1..4: SudAmerica := SudAmerica + 1; 5..12: NorteAmerica :=
NorteAmerica + 1; 13..20: Europa := Europa + 1; 21..33:
Asia := Asia + 1; 34..37: Oceania := Oceania + 1; 38..42:
Africa := Africa + 1 end; end end; sum_ej := 1 + sum_ej div 3; if
(SudAmerica = 4) or (Oceania = 4) then sum_ej := sum_ej + 2; if
(NorteAmerica = 7) or (Europa = 7) then sum_ej := sum_ej + 5; if Asia = 8
then sum_ej := sum_ej + 7; if Africa = 5 then sum_ej := sum_ej + 3; if
sum_ej < 3 then sum_ej := 3; cuantos_ejercitos := sum_ej
end;{cuantos_ejercitos} function limites; type aRecord = record
array_false: array[1..100] of Longint; end; aPtr = ^aRecord; aHdl =
^aPtr; var myHdl: aHdl; {No se declara el arreglo de enteros, se utiliza la
manija al registro} mem1, mem2, i, fin: integer; largo: Longint; si:
boolean; begin myHdl := Pointer(HLimites);{en manija recurso se encuentra la
direcci—n del recurso} {ahora myHdl apunta a los datos que apunta
manija2_recurso} i := comienza; fin := 0; si := false; repeat i := i
+ 1; largo := myHdl^^.array_false[i]; mem1 := largo div 65535; mem2 :=
BitAnd(largo, $0000ffff); if p2 <> 0 then si := ((p1 = mem1) and (p2 =
mem2)) or ((p2 = mem1) and (p1 = mem2)) else begin si := (p1 = mem1)
or (p1 = mem2); if si then if p1 = mem1 then p2 := mem2 else
p2 := mem1 end until (si) or (i = 100); limites := si; comienza := i
end;{limites} procedure maquina_pone; var i: integer; begin i := 0;
while (i < npaises) and (pone > 0) do begin i := i + 1; if i in
jugador[j].mis_paises then begin ej_en_pais[i] := ej_en_pais[i] + 1;
escribe_num_ej(i); pone := pone - 1 end; end; end;{procedure
maquina_pone;} end.

unit ataca; interface uses windows, estrategia; procedure ataca_maquina;
implementation procedure ataca_maquina; var a, d, e, pasan, p, menor:
integer; posible: boolean; paises_limite: array[1..8] of integer; begin
for p := 1 to 8 do paises_limite[p] := 0; for a := 1 to npaises do begin
if a in jugador[j].mis_paises then begin d := 0; p := 0; pasan :=
0; repeat p := p + 1; posible := limites(a, d, pasan); if
posible then begin paises_limite[p] := pasan; pasan := 0
end; until not posible; menor := ej_en_pais[a]; for e := 1 to p do
if (ej_en_pais[paises_limite[e]] < menor) and not (paises_limite[e] in
jugador[j].mis_paises) then begin menor :=
ej_en_pais[paises_limite[e]]; d := paises_limite[e] end; if (d <
npaises) and (d > 0) then if suerte(a, d) then begin if
ej_en_pais[a] > 0 then begin pasan := ej_en_pais[a] div 2;
ej_en_pais[a] := ej_en_pais[a] - pasan end; escribe_Num_Ej(d);
escribe_Num_Ej(a); exit(ataca_maquina); end; end; end;
end;{ataca_maquina} end.

unit Windows; interface const {menu stuff} AppleMenu = 256; FileMenu = 257;
EditMenu = 258; npaises = 42; npuntos = 11; Chk_On = 1; {used to
check on/off dialog items} Chk_Off = 0; Toggle = 2; type Pais = record
nombre: string[10]; punto: array[1..npuntos] of point; end; Tjugador =
record vive, es_humano, ncartas, total_paises, ncambios: integer;
mis_paises: set of 1..npaises; mis_cartas: array[1..5] of integer;
mi_color: RGBColor end; var i, j, pone, jugadores_vivos: integer; ch: char;
finished, existe: boolean; MyWindow: WindowPtr; negro: RGBColor; mi_pais:
array[1..npaises] of pais; soldado1, soldado5, soldado10, soldado20, soldado50,
Hventana: PicHandle; Hcanon, Hcaballo: PicHandle; theEvent: eventRecord;
donde: point; mi_region: array[1..npaises] of RgnHandle; myColor: array[1..16]
of RGBColor; cartas: array[1..44] of boolean; ej_en_pais, de_quien_es_pais:
array[1..npaises] of integer; jugador: array[1..6] of Tjugador; rec_region:
array[1..npaises] of REct; rventana, rcolor: rect; siga, forti, carta: rect;
procedure Dibu_cartas (n: integer; hay_cambio: boolean; var lo_hizo: boolean);
procedure redibuja; procedure Dibuja_region2 (r: integer; el_color: RGBcolor);
procedure escribe_Num_Ej (e: integer); procedure informa_cartas; procedure
ItemCheckMark (theDialog: DialogPtr; ItemNo, ChkMark: integer); procedure
HiliteItem (theDialog: DialogPtr; ItemNo, HiliteMode: integer); procedure
ProcessMenu_in (CodeWord: longint); procedure DealwthMouseDowns (Event:
EventRecord); procedure DealwthUpdates (Event: EventRecord); procedure
DealwthActivates (Event: EventRecord); procedure DealwthKeyDowns (Event:
EventRecord); procedure MainEventLoop; function FileRead: Boolean; function
FileWrite (pic: PicHandle): Boolean; implementation procedure escribe_Num_Ej;
begin RGBForeColor(negro); Moveto(rec_region[e].left - 35,
rec_region[e].bottom - 2); EraseRect(rec_region[e]);
writedraw(ej_en_pais[e]) end;{escribe_Num_Ej}
{-----------------------------------------------------------------------------}
procedure Dibuja_region2; var P, t, l, alto, ancho: integer; begin if not
existe then begin Mi_region[r] := NewRgn; OpenRgn;
MoveTo(mi_pais[r].punto[1].h, mi_pais[r].punto[1].v); for p := 2 to npuntos
do lineTo(mi_pais[r].punto[p].h, mi_pais[r].punto[p].v);
lineTo(mi_pais[r].punto[1].h, mi_pais[r].punto[1].v); CloseRgn(Mi_region[r]);
alto := Mi_region[r]^^.RgnBBox.top - Mi_region[r]^^.RgnBBox.bottom; T :=
Mi_region[r]^^.RgnBBox.top - alto div 2; ancho := Mi_region[r]^^.RgnBBox.left
- Mi_region[r]^^.RgnBBox.right; L := Mi_region[r]^^.RgnBBox.left - ancho div
2; SETRECT(rec_region[r], l, t, l + 15, t + 10); end;
RGBForeColor(el_color); PaintRgn(Mi_region[r]); RGBForeColor(negro);
PenSize(1, 1); FrameRgn(Mi_region[r]); end;{Dibuja_region2}
{-----------------------------------------------------------------------------}
procedure informa_cartas; var c, h, turno: integer; begin Setrect(rcolor,
10, 220, 48, 460); EraseRect(rcolor); h := 216 div jugadores_vivos;
Setrect(rcolor, 12, 224, 46, 224 + h); h := h + 3; if j <> 6 then turno
:= j + 1 else turno := 1; for c := 1 to jugadores_vivos do begin
RGBForeColor(jugador[turno].mi_color); PaintRect(rcolor);
InsetRect(rcolor, 8, h div 3); EraseRect(rcolor); Moveto(rcolor.left - 35,
rcolor.bottom - 2); RGBForeColor(negro);
writedraw(jugador[turno].ncartas); InsetRect(rcolor, -8, -h div 3);
OffsetREct(rcolor, 0, h); if turno < 6 then turno := turno + 1 else
turno := 1 end; end;{informa_cartas}
{-----------------------------------------------------------------------------}
procedure redibuja; var p, c, h: integer; begin Hventana :=
GetPicture(128); SetRect(rventana, 0, 40, 640, 480); DrawPicture(Hventana,
rventana); SetRect(rcolor, 75, 53, 232, 72); EraseRect(rcolor);
SetRect(siga, 377, 57, 437, 82); EraseRect(siga); SetRect(forti, 465, 57,
525, 82); EraseRect(forti); SetRect(carta, 553, 57, 613, 82);
EraseRect(carta); for p := 1 to npaises do begin c :=
de_quien_es_pais[p]; Dibuja_region2(p, jugador[c].mi_color);
escribe_Num_Ej(p); end; informa_cartas end;{redibuja} procedure
Dibu_cartas; function pos_carta (pos: integer): integer; begin case pos
of 4: pos_carta := 1; 6: pos_carta := 2; 8:
pos_carta := 3; 10: pos_carta := 4; 12: pos_carta := 5
end; end;{pos_carta} const Dcards = 260; var h, l, dh, dv, c,
ItemType, ItemHit, ItemNum, tipo_carta, el_color, c1, c2, temp: integer;
ItemRect, ItemBox, rd: Rect; ItemHdl: handle; CardDialog: DialogPtr;
findialog: boolean; CardRgn: RgnHandle; valor: longint; begin
findialog := false; GetPort(MyWindow); CardDialog := GetNewDialog(260, nil,
pointer(-1)); CardRgn := NewRgn; if jugador[j].es_humano = 0 then
MovePortTo(90, 90) else begin SetPort(CardDialog);
ShowWindow(CardDialog); end; ItemNum := 3; TextSize(9); TextFont(4);
for c := 1 to n do begin GetDItem(CardDialog, ItemNum, ItemType, ItemHdl,
ItemRect); RGBForeColor(negro); EraseRect(ItemRect); PenSize(2, 2);
FrameRect(ItemRect); l := (80 - StringWidth(mi_pais[c].nombre)) div 2;
Moveto(ItemRect.left + l, ItemRect.top + 18); SetRect(rd, ItemRect.left + 20,
ItemRect.bottom - 45, ItemRect.left + 60, ItemRect.bottom - 5);
DrawString(mi_pais[jugador[j].mis_cartas[c]].nombre); ItemNum := ItemNum + 2;
if jugador[j].mis_cartas[c] > npaises then begin DrawPicture(soldado1,
rd); OffsetRect(rd, 0, -35); DrawPicture(Hcanon, rd); OffsetRect(rd,
0, -35); DrawPicture(Hcaballo, rd); end else begin tipo_carta
:= jugador[j].mis_cartas[c] mod 3; case tipo_carta of 0:
DrawPicture(soldado1, rd); 1: DrawPicture(Hcanon, rd); 2:
DrawPicture(Hcaballo, rd); end;
CopyRgn(Mi_region[jugador[j].mis_cartas[c]], CardRgn); InsetRect(iTemrect,
6, 32); OffsetRect(iTemrect, 0, -6); MapRgn(CardRgn, CardRgn^^.rgnBBox,
ItemRect); el_color := de_quien_es_pais[jugador[j].mis_cartas[c]];
RGBForeColor(jugador[el_color].mi_color); PaintRgn(CardRgn); end;
{ItemNum := 2 * n;} {repeat} {ItemNum := ItemNum + 2;} {GetDItem(CardDialog,
ItemNum, ItemType, ItemHdl, ItemBox);} {HideControl(ControlHandle(ItemHdl))}
{until ItemNum = 20;} end; if jugador[j].es_humano = 0 then begin
delay(180, valor); for c := 1 to 3 do Sysbeep(10); MovePortTo(0, 0);
lo_hizo := true end else begin if hay_cambio then begin ItemNum
:= 0; repeat ItemNum := ItemNum + 2; GetDItem(CardDialog, ItemNum,
ItemType, ItemHdl, ItemBox); SetCtlValue(ControlHandle(ItemHdl), Chk_On);
until ItemNum = 8; end else begin ItemNum := 2; repeat
ItemNum := ItemNum + 2; GetDItem(CardDialog, ItemNum, ItemType, ItemHdl,
ItemBox); HideControl(ControlHandle(ItemHdl)) until ItemNum = 20;
GetDItem(CardDialog, 1, ItemType, ItemHdl, ItemBox);
HiliteControl(ControlHandle(ItemHdl), 255) end; c1 := 0; c2 := 0;
repeat ModalDialog(nil, ItemHit); case itemHit of 1: begin
findialog := true;{this is the OK item} lo_hizo := true end; 2:
begin findialog := true;{this is the cancel item} lo_hizo := false
end; 4, 6, 8, 10, 12: begin ItemCheckMark(CardDialog, itemHit,
Toggle); if c1 = 0 then c1 := pos_carta(itemHit) else
begin c2 := pos_carta(itemHit); temp := jugador[j].mis_cartas[c1];
jugador[j].mis_cartas[c1] := jugador[j].mis_cartas[c2];
jugador[j].mis_cartas[c2] := temp end; end; end; until
findialog; end; DisposDialog(CardDialog); ClosePort(CardDialog);
SetPort(MyWindow); redibuja; end;{Dibu_cartas}
{-----------------------------------------------------------------------------}
procedure Graba_recurso; var H: handle; thePtr: Ptr; begin {Luego de
cambiar los valores con esto se graba en el recurso} H :=
NEWHANDLE(SIZEOF(ej_en_pais)); thePtr := @ej_en_pais; h := Pointer(thePtr);
AddREsource(h, 'DATA', 1000, 'Ejercitos'); ChangedREsource(h);
WriteResource(h); end;{Graba_recurso}
{-----------------------------------------------------------------------------}
procedure HiliteItem; var ItemType: Integer; ItemBox: Rect; ItemHdl:
Handle; begin GetDItem(theDialog, ItemNo, ItemType, ItemHdl, ItemBox);
HiliteControl(ControlHandle(ItemHdl), HiliteMode); end;
{-----------------------------------------------------------------------------}
procedure ItemCheckMark; var ItemType: Integer; ItemBox: Rect; ItemHdl:
Handle; begin GetDItem(theDialog, ItemNo, ItemType, ItemHdl, ItemBox); if
ChkMark <> Toggle then SetCtlValue(ControlHandle(ItemHdl), ChkMark) else
begin ChkMark := GetCtlValue(ControlHandle(ItemHdl)); if ChkMark = Chk_Off
then SetCtlValue(ControlHandle(ItemHdl), Chk_On) else
SetCtlValue(ControlHandle(ItemHdl), Chk_Off); end; end;{ItemCheckMark}
{-------------------------------------------------------------------} procedure
ProcessMenu_in; var Menu_No: integer; {menu number that was selected}
Item_No: integer; {item in menu that was selected} NameHolder: Str255;
{name holder for desk accessory or font} DNA: integer; {OpenDA will
never return 0, so don't care} begin if CodeWord <> 0 then begin {go ahead
and process the command} Menu_No := HiWord(CodeWord); {get the Hi word
of...} Item_no := LoWord(CodeWord); {get the Lo word of...} case
Menu_No of AppleMenu: begin GetItem(GetMHandle(AppleMenu),
Item_No, NameHolder); DNA := OpenDeskAcc(NameHolder); end;
FileMenu: begin case Item_No of 1: Finished := True;
{quit} end; end; EditMenu: begin if not
SystemEdit(Item_no - 1) then {if not for a desk accessory} case Item_No of
1: begin end; {undo} { 2:
line divider} 3: begin end; {cut} 4:
begin end; {copy} 5: begin end;
{paste} 6: begin end; {clear} end;
end; end; HiliteMenu(0); {unhilite after processing menu}
end; end; {of ProcessMenu_in procedure}
{-------------------------------------------------------------------} {-----
These are procedures called from the main event loop -------} procedure
DealwthMouseDowns; var Location: integer; WindowPointedTo: WindowPtr;
MouseLoc: Point; WindoLoc: integer; begin MouseLoc := Event.Where;
WindoLoc := FindWindow(MouseLoc, WindowPointedTo); case WindoLoc of
inMenuBar: ProcessMenu_in(MenuSelect(MouseLoc)); inSysWindow:
SystemClick(Event, WindowPointedTo); inContent: if WindowPointedTo <>
FrontWindow then SelectWindow(WindowPointedTo) else begin {do
something} end; inGrow: ; inDrag: ; inGoAway:
end;{ of case} end;
{-----------------------------------------------------------------------------}
procedure DealwthKeyDowns; type Trick = record case boolean of true:
( l: longint ); false: ( chr3, chr2, chr1, chr0: char
) end; var CharCode: char; TrickVar: Trick; begin TrickVar.l :=
Event.message; CharCode := TrickVar.chr0; if BitAnd(Event.modifiers,
CmdKey) = CmdKey then begin {key board command - probably a menu
command} ProcessMenu_in(MenuKey(CharCode)); end else begin {regular
keyboard entry} Event.Message := BitAnd(TheEvent.Message, $FF + 0); Ch :=
Chr(TheEvent.Message); end; end;
{-----------------------------------------------------------------------------}
procedure DealwthActivates; var TargetWindow: WindowPtr; begin
TargetWindow := WindowPtr(Event.message); if Odd(Event.modifiers) then
begin {then the window is becoming active} SetPort(TargetWindow);
{and activate whatever else you need} {the scroll bars} {hilite
selected text} end else begin {deactivate whatever you need}
{deactivate the scroll bars} {UNhilite selected text} end; end;
{-----------------------------------------------------------------------------}
procedure DealwthUpdates; var UpDateWindow, TempPort: WindowPtr; begin
UpDateWindow := WindowPtr(Event.message); GetPort(TempPort);
{Save the current port} SetPort(UpDateWindow); {set the port to one in
Evt.msg} BeginUpDate(UpDateWindow); ClipRect(UpDateWindow^.portRect);
UpdtControl(UpDateWindow, UpDateWindow^.visRgn); (* or
EraseRect(UpDateWindow^.VisRgn^^.rgnBBox); *) EndUpDate(UpDateWindow);
SetPort(TempPort); {restore to the previous port} end;
{-----------------------------------------------------------------------------}
procedure MainEventLoop; var Event: EventRecord; ProcessIt: Boolean; begin
repeat ProcessIt := GetNextEvent(EveryEvent, Event); if ProcessIt then{is
true} {we'll ProcessIt} case Event.what of mouseDown:
DealwthMouseDowns(Event); KeyDown: DealwthKeyDowns(Event);
ActivateEvt: DealwthActivates(Event); UpDateEvt:
DealwthUpdates(Event); end;{of Case} until Finished; {terminate the
program} end; end.

Archivo adjunto
Morphic-TEG.020.st
Tipo:
application/applefile
IconicButton subclass: #DrawPicture instanceVariableNames: 'estado valor '
classVariableNames: '' poolDictionaries: '' category: 'Morphic-TEG'!
!DrawPicture methodsFor: 'as yet unclassified' stamp: 'EDC 4/22/2002 14:34'!
estado ^estado! ! !DrawPicture methodsFor: 'as yet unclassified' stamp: 'EDC
5/29/2002 18:04'! estado: aBoolean | f | estado _ aBoolean. estado ifTrue:
[f _ submorphs first form. "Modificaci—n sugerida por Diego Gomez Deck " f
mapColor: Color white to: Color lightRed] ifFalse: [f _ submorphs first form.
f mapColor: Color lightRed to: Color white. ]! ! !DrawPicture methodsFor:
'as yet unclassified' stamp: 'EDC 4/29/2002 08:48'! initializeWith: aString
valor: aInteger pos: aPoint | f | valor _ aInteger. self estado: false. f _
Form fromFileNamed: aString. self labelGraphic: f. self position: aPoint ! !
!DrawPicture methodsFor: 'as yet unclassified' stamp: 'EDC 4/29/2002 08:49'!
initializeWith: aString valor: aInteger rect: aRectangle | f | valor _
aInteger. self estado: false. f _ Form fromFileNamed: aString. self
labelGraphic: f. self bounds: aRectangle. ! ! !DrawPicture methodsFor: 'as
yet unclassified' stamp: 'EDC 4/22/2002 14:34'! mouseUp: evt (self
containsPoint: evt cursorPoint) ifTrue: ["toggle and do action" self
setSwitchState: estado = false. self doButtonAction] ifFalse: ["restore old
appearance" self setSwitchState: estado = true]! ! !DrawPicture methodsFor:
'as yet unclassified' stamp: 'EDC 4/22/2002 14:28'! setSwitchState: aBoolean
aBoolean ifTrue: [self borderColor: #inset. self estado: true] ifFalse:
[self borderColor: #raised. self estado: false]! ! !DrawPicture methodsFor:
'as yet unclassified' stamp: 'EDC 4/22/2002 16:02'! valor ^ valor! ! Object
subclass: #Jugador instanceVariableNames: 'vive esHumano nCartas totalPaises
ncambios misPaises misCartas miColor ' classVariableNames: ''
poolDictionaries: '' category: 'Morphic-TEG'! !Jugador methodsFor:
'initialization' stamp: 'EDC 5/18/2002 05:57'! initialize vive _ true.
esHumano _ false. nCartas _ 0. ncambios _ 0. misPaises _ OrderedCollection
new. misCartas _ OrderedCollection new. totalPaises _ 0! ! !Jugador
methodsFor: 'accesing' stamp: 'EDC 4/18/2002 11:02'! esHumano ^esHumano! !
!Jugador methodsFor: 'accesing' stamp: 'EDC 4/18/2002 11:02'! esHumano: aBoolean
esHumano _ aBoolean! ! !Jugador methodsFor: 'accesing' stamp: 'EDC 4/21/2002
07:29'! miColor ^ miColor! ! !Jugador methodsFor: 'accesing' stamp: 'EDC
4/21/2002 07:30'! miColor: aColor miColor _ aColor! ! !Jugador methodsFor:
'accesing' stamp: 'EDC 4/25/2002 09:03'! misCartas ^ misCartas! ! !Jugador
methodsFor: 'accesing' stamp: 'EDC 5/11/2002 16:25'! misCartas: aInteger
misCartas add: aInteger! ! !Jugador methodsFor: 'accesing' stamp: 'EDC
4/18/2002 15:15'! misPaises ^ misPaises! ! !Jugador methodsFor: 'accesing'
stamp: 'EDC 4/21/2002 09:44'! misPaises: aInteger misPaises add: aInteger! !
!Jugador methodsFor: 'accesing' stamp: 'EDC 4/25/2002 10:10'! nCartas ^
nCartas! ! !Jugador methodsFor: 'accesing' stamp: 'EDC 4/25/2002 10:10'!
nCartas: aInteger nCartas _ aInteger! ! !Jugador methodsFor: 'accesing'
stamp: 'EDC 4/18/2002 11:02'! totalPaises ^totalPaises! ! !Jugador methodsFor:
'accesing' stamp: 'EDC 4/18/2002 11:02'! totalPaises: aInteger totalPaises _
aInteger! ! !Jugador methodsFor: 'accesing' stamp: 'EDC 4/18/2002 11:02'! vive
^vive! ! !Jugador methodsFor: 'accesing' stamp: 'EDC 4/18/2002 11:02'! vive:
aBoolean vive _ aBoolean! ! PolygonMorph subclass: #PaisMorph
instanceVariableNames: 'nombre ejEnPais deQuienSoy instanciaTEG numero '
classVariableNames: '' poolDictionaries: '' category: 'Morphic-TEG'!
!PaisMorph methodsFor: 'as yet unclassified' stamp: 'EDC 4/22/2002 15:34'!
deQuienSoy ^ deQuienSoy! ! !PaisMorph methodsFor: 'as yet unclassified'
stamp: 'EDC 4/22/2002 15:35'! deQuienSoy: aInteger deQuienSoy _ aInteger! !
!PaisMorph methodsFor: 'as yet unclassified' stamp: 'EDC 4/22/2002 15:17'!
ejercitos ^ejEnPais! ! !PaisMorph methodsFor: 'as yet unclassified' stamp:
'EDC 4/24/2002 10:57'! ejercitos: aInteger ejEnPais _ aInteger. (submorphs
at: 1) contents: ejEnPais asString; center: self center.! ! !PaisMorph
methodsFor: 'as yet unclassified' stamp: 'EDC 4/28/2002 17:03'! nombre ^nombre!
! !PaisMorph methodsFor: 'as yet unclassified' stamp: 'EDC 5/9/2002 10:31'!
numero ^numero! ! !PaisMorph methodsFor: 'as yet unclassified' stamp: 'EDC
5/9/2002 10:31'! numero: aInteger numero _ aInteger. ! ! !PaisMorph
methodsFor: 'initialization' stamp: 'EDC 5/29/2002 18:03'! initialize
instanciaTEG _ ActiveWorld submorphs detect: [:m | m class == 'TEGMain'].
"Modificaci—n sugerida por Diego Gomez Deck " super initialize! ! !PaisMorph
methodsFor: 'initialization' stamp: 'EDC 5/13/2002 09:40'! nombre: aString
limites: limites | info centro r | nombre _ aString. ejEnPais _ 0. self
vertices: limites asArray color: Color white borderWidth: 2
borderColor: Color black. centro _ self center. r _ Morph new. r bounds:
(Rectangle left: centro x right: centro x + 15 top: centro y
bottom: centro y + 10). r color: Color white. self addMorph: r. info _
TextMorph new. info autoFit: true. info string: ejEnPais asString
fontName: #ComicBold size: 18 wrap: false. info contents: ejEnPais
asString. info bounds: r. info centered. self addMorph: info. info lock.
self openInWorld! ! !PaisMorph methodsFor: 'event handling' stamp: 'EDC
5/29/2002 18:00'! click: evt | texto quedan | texto _ 'Soy ' , nombre
asString , ' numero ',numero asString, 'y pertenezco a ' , deQuienSoy asString.
self showBalloon: texto hand: evt hand. quedan _ 0. (instanciaTEG permitido:
numero) ifFalse: [^ false]. instanciaTEG submorphs do: [:m | m class name =
'DrawPicture' ifTrue: [quedan _ quedan + 1. m estado ifTrue:
[ejEnPais _ ejEnPais + m valor. quedan _ quedan - 1. instanciaTEG
ponerEjercitos: m valor enPais: self numero. m delete]]]. (submorphs at:
1) contents: ejEnPais asString. submorphs do: [:m | m center: self center].
quedan = 0 ifTrue: [Utilities informUserDuring:[:bar| #(three two one )
do:[:info| bar value: info. (Delay forSeconds: 1) wait]]]! ! !PaisMorph
methodsFor: 'event handling' stamp: 'EDC 5/9/2002 14:48'! doubleClick: evt
self borderWidth: 4 ; borderColor: Color red. ^ self numero! ! !PaisMorph
methodsFor: 'event handling' stamp: 'EDC 4/18/2002 09:18'! firstClickTimedOut:
evt | root popUp | root _ owner rootForGrabOf: self. root == nil
ifTrue: ["Display hidden card in front" popUp _ self copy. self board
owner owner addMorphFront: popUp. self world displayWorld. (Delay
forMilliseconds: 750) wait. popUp delete] ifFalse: [evt hand grabMorph:
root]! ! !PaisMorph methodsFor: 'event handling' stamp: 'EDC 4/18/2002 09:12'!
handlesMouseDown: evt ^ true! ! !PaisMorph methodsFor: 'event handling'
stamp: 'EDC 4/18/2002 09:38'! mouseDown: evt "Do nothing upon mouse-down
except inform the hand to watch for a double-click; wait until an ensuing
click:, doubleClick:, or drag: message gets dispatched" evt hand
waitForClicksOrDrag: self event: evt! ! !PaisMorph methodsFor: 'event handling'
stamp: 'EDC 4/24/2002 06:23'! mouseEnter: evt | texto | texto _ 'Soy ' ,
nombre asString , ' y pertenezco a ' , deQuienSoy asString. self showBalloon:
texto hand: evt hand. ! ! TrashCanMorph subclass: #SmartTrashCanMorph
instanceVariableNames: '' classVariableNames: '' poolDictionaries: ''
category: 'Morphic-TEG'! !SmartTrashCanMorph methodsFor: 'as yet unclassified'
stamp: 'EDC 4/4/2002 16:03'! acceptDroppingMorph: aMorph event: evt | miMundo
| Preferences soundsEnabled ifTrue: [Preferences preserveTrash ifTrue:
[self class playDeleteSound] ifFalse: [self playSoundNamed: 'scratch']].
evt hand visible: true. self state: #off. aMorph delete. aMorph == Utilities
scrapsBook ifFalse: [Utilities addToTrash: aMorph]. miMundo _ self owner .
miMundo submorphs copy do: [:m | m class name = aMorph class name ifTrue:
[m delete]]! ! !SmartTrashCanMorph methodsFor: 'initialization' stamp: 'EDC
3/11/2002 05:35'! initialize "Initialize the receiver's graphics, name, and
balloon-help" super initialize. self image: TrashPicOn; offImage: TrashPic;
pressedImage: TrashPicOn. self setNameTo: 'Trash'. self setBalloonText: 'Para
eliminar todos los objetos de una misma clase, arrastre uno de ellos dentro del
tacho'! ! BorderedMorph subclass: #TEGMain instanceVariableNames: 'miArchivo
cartas cartasOrden losJugadores deQuienEsPais ejEnPais jugadoresVivos miRegion
cartel pone oldFolder newFolder cambiosTotales playerTurn ronda limites done lim
estado numCarta ' classVariableNames: '' poolDictionaries: '' category:
'Morphic-TEG'! !TEGMain methodsFor: 'menus' stamp: 'EDC 5/17/2002 05:32'!
addCustomMenuItems: aCustomMenu hand: aHandMorph "Include our modest command
set in the ctrl-menu" super addCustomMenuItems: aCustomMenu hand: aHandMorph.
aCustomMenu addLine. self addMenuItemsTo: aCustomMenu hand: aHandMorph! !
!TEGMain methodsFor: 'menus' stamp: 'EDC 5/17/2002 05:55'! addMenuItemsTo: aMenu
hand: aHandMorph aMenu add: 'new game' target: self action: #newGame.
aMenu add: 'reset...' target: self action: #reset. aMenu add: 'grabar
estado' target: self action: #grabaEstado. aMenu add: 'leer estado'
target: self action: #leerEstado. aMenu add: 'debug' target: self
action: #debug! ! !TEGMain methodsFor: 'menus' stamp: 'EDC 5/29/2002 10:37'!
atacaMaquina | misLimites maxValue maxElement val reagrupa pasan paisAcacado
paisAcacante atacarA quedan listaLimpia | misLimites _ Set new. "Deseo la
lista total de los paises limitrofes a mis paises" (losJugadores at:
playerTurn) misPaises do: [:pais | limites do: [:each | (each includes:
pais) ifTrue: [misLimites add: each]]]. "Debo eliminar de la lista las
fronteras de paises que ambos me pertenezcan" listaLimpia _ misLimites copy.
misLimites do: [:frontera | (((losJugadores at: playerTurn) misPaises
includes: (frontera at: 1)) and: [(losJugadores at: playerTurn) misPaises
includes: (frontera at: 2)]) ifTrue: [listaLimpia remove: frontera]].
listaLimpia do: [:frontera | ((losJugadores at: playerTurn) misPaises
includes: (frontera at: 1)) ifTrue: [paisAcacante _ frontera at: 1.
paisAcacado _ frontera at: 2] ifFalse: [paisAcacante _ frontera at: 2.
paisAcacado _ frontera at: 1]. maxValue == nil ifTrue: ["first element"
maxValue _ (ejEnPais at: paisAcacante) - (ejEnPais at: paisAcacado).
maxElement _ paisAcacante] ifFalse: [(val _ (ejEnPais at: paisAcacante)
- (ejEnPais at: paisAcacado)) > maxValue ifTrue: [maxElement _
paisAcacante. atacarA _ paisAcacado. maxValue _ val]]]. atacarA
ifNil: [^ false]. paisAcacado _ atacarA. paisAcacante _ maxElement. reagrupa
_ self suerte: paisAcacante contra: paisAcacado. reagrupa ifTrue: [pone > 2
ifTrue: [pasan _ (pone - 2 / 2) asInteger. quedan _ pone - pasan.
ejEnPais at: paisAcacante put: quedan. (miRegion at: paisAcacante)
ejercitos: quedan. ejEnPais at: paisAcacado put: pasan. (miRegion at:
paisAcacado) ejercitos: pasan. (miRegion at: paisAcacado)
deQuienSoy: playerTurn. ^ true]] ifFalse: [self halt. ^ false]! !
!TEGMain methodsFor: 'menus' stamp: 'EDC 5/17/2002 05:34'! handlesMouseDown: evt
"Prevent stray clicks from picking up the whole game in MVC." ^ Smalltalk
isMorphic not or: [evt yellowButtonPressed]! ! !TEGMain methodsFor: 'menus'
stamp: 'EDC 5/28/2002 09:06'! maquinaPone | i n pais gano | n _ (losJugadores
at: playerTurn) misPaises size. i _ 1. [pone > 0] whileTrue: [pais _
(losJugadores at: playerTurn) misPaises at: i. ejEnPais at: pais put:
(ejEnPais at: pais) + 1. (miRegion at: pais) ejercitos: (ejEnPais
at: pais). pone _ pone - 1. i _ i + 1. i > n ifTrue: [i _ 1]].
(Delay forSeconds: 1) wait. ronda > 5 ifTrue: [gano _ self atacaMaquina.
gano ifTrue: [self obtenerCarta]]. self continue! ! !TEGMain methodsFor:
'menus' stamp: 'EDC 5/17/2002 05:32'! mouseDown: evt | menu | evt
yellowButtonPressed ifFalse: [^ self]. menu _ MenuMorph new defaultTarget:
self. self addMenuItemsTo: menu hand: evt hand. menu popUpEvent: evt in: self
world! ! !TEGMain methodsFor: 'menus' stamp: 'EDC 5/28/2002 08:31'!
obtenerCarta (losJugadores at: playerTurn) nCartas: (losJugadores at:
playerTurn) nCartas + 1. (losJugadores at: playerTurn) misCartas:
(cartasOrden at: numCarta). numCarta _ numCarta + 1. cartas at: numCarta put:
true! ! !TEGMain methodsFor: 'menus' stamp: 'EDC 5/17/2002 05:35'! reset
"Reset the board, choosing anew how many teams." | nPlayers nHumans | nPlayers
_ (SelectionMenu selections: (1 to: 6)) startUpWithCaption: 'How many
players?'. nPlayers ifNil: [nPlayers _ 2]. nHumans _ (SelectionMenu
selections: (0 to: nPlayers)) startUpWithCaption: 'How many humans?'.
nHumans ifNil: [nHumans _ 1]. self teams: (#(#(1) #(2 5) #(2 4 6) #(1 2 4
5) #(1 2 3 4 6) #(1 2 3 4 5 6) ) at: nPlayers) autoPlay: ((1 to: nPlayers)
collect: [:i | i > nHumans])! ! !TEGMain methodsFor: 'menus' stamp: 'EDC
5/29/2002 10:31'! suerte: paisAtacante contra: paisAcacado "self
soundEffects." | dadoAtaque dadoDefensa elColor | cartel string: (miRegion at:
paisAtacante) nombre , ' Ataca a ' , (miRegion at: paisAcacado) nombre. cartel
center: self center. cartel top: self top + 10. cartel color: (losJugadores
at: playerTurn) miColor. self world displayWorld. (Delay forSeconds: 5) wait.
[(ejEnPais at: paisAtacante) > 0 and: [(ejEnPais at: paisAcacado) > 0]]
whileTrue: [dadoAtaque _ 0. dadoDefensa _ 0. [dadoAtaque = dadoDefensa]
whileTrue: [dadoAtaque _ 6 atRandom. dadoDefensa _ 6 atRandom].
dadoAtaque > dadoDefensa ifTrue: [ejEnPais at: paisAcacado put: (ejEnPais
at: paisAcacado) - 1] ifFalse: [ejEnPais at: paisAtacante put:
(ejEnPais at: paisAtacante) - 1]]. (ejEnPais at: paisAcacado) = 0
ifTrue: [ elColor _ (losJugadores at: playerTurn) miColor. (miRegion at:
paisAcacado) color: elColor. (losJugadores at: (deQuienEsPais at:
paisAcacado)) totalPaises: (losJugadores at: (deQuienEsPais at:
paisAcacado)) totalPaises - 1. (losJugadores at: (deQuienEsPais at:
paisAcacado)) misPaises remove: paisAcacado ifAbsent: [].
(losJugadores at: (deQuienEsPais at: paisAcacado)) totalPaises = 0
ifTrue: [self muerte]. deQuienEsPais at: paisAcacado put: playerTurn.
(losJugadores at: playerTurn) misPaises: paisAcacado. (losJugadores at:
playerTurn) totalPaises: (losJugadores at: playerTurn) totalPaises + 1.
(ejEnPais at: paisAtacante) > 2 ifTrue: [ejEnPais at: paisAcacado put:
2. (miRegion at: paisAcacado) ejercitos: 2. (miRegion at:
paisAcacado) deQuienSoy: playerTurn. ejEnPais at: paisAtacante put:
(ejEnPais at: paisAtacante) - 2. pone _ ejEnPais at: paisAtacante.
ejEnPais at: paisAcacado put: 0. (miRegion at: paisAtacante)
ejercitos: 0. (miRegion at: paisAtacante) deQuienSoy: playerTurn.
^ true] ifFalse: [self halt. (miRegion at: paisAcacado)
ejercitos: (ejEnPais at: paisAcacado). (miRegion at: paisAtacante)
ejercitos: (ejEnPais at: paisAtacante). ^ false]]! ! !TEGMain methodsFor:
'initialization' stamp: 'EDC 4/30/2002 09:50'! cambiaCartas: cardDialog |
tengo index cambios | cambios _ #(4 6 8 10 12 15 ). cardDialog submorphs do:
[:m | m class name = 'DrawPicture' ifTrue: [m estado ifTrue: [tengo _
(losJugadores at: turno) misPaises includes: m valor. tengo
ifTrue: [ejEnPais at: m valor put: (ejEnPais at: m valor) + 2.
(miRegion at: m valor) ejercitos: (ejEnPais at: m valor).
index _ (losJugadores at: turno) misCartas asOrderedCollection find: m valor.
(losJugadores at: turno) misCartas at: index put: nil]]]]. self halt.
cambiosTotales _ cambiosTotales + 1! ! !TEGMain methodsFor: 'initialization'
stamp: 'EDC 4/30/2002 14:49'! cuantosEjercitos | sumEj sudAmerica norteAmerica
europa asia oceania africa | sumEj _ 0. sudAmerica _ 0. norteAmerica _ 0.
europa _ 0. asia _ 0. oceania _ 0. africa _ 0. 1 to: 42 do: [:e |
(deQuienEsPais at: e) = turno ifTrue: [sumEj _ sumEj + 1. (e > 1
and: [e < 4]) ifTrue: [sudAmerica _ sudAmerica + 1]. (e > 5
and: [e < 12]) ifTrue: [norteAmerica _ norteAmerica + 1]. (e > 13
and: [e < 20]) ifTrue: [europa _ europa + 1]. (e > 21 and: [e
< 33]) ifTrue: [asia _ asia + 1]. (e > 34 and: [e < 37])
ifTrue: [oceania _ oceania + 1]. (e > 38 and: [e < 42])
ifTrue: [africa _ africa + 1]]]. sumEj _ 1 + (sumEj / 3) asInteger.
(sudAmerica = 4 or: [oceania = 4]) ifTrue: [sumEj _ sumEj + 2].
(norteAmerica = 7 or: [europa = 7]) ifTrue: [sumEj _ sumEj + 5]. asia = 8
ifTrue: [sumEj _ sumEj + 7]. africa = 5 ifTrue: [sumEj _ sumEj + 3]. sumEj <
3 ifTrue: [sumEj _ 3]. ^ sumEj! ! !TEGMain methodsFor: 'initialization'
stamp: 'EDC 4/29/2002 17:56'! dibuCartas: n hayCambio: aBoolean | cardDialog f
rblanco r laCarta s rd tipoCarta paisCarta insetRect loHizo rpos oK |
cardDialog _ (Form fromFileNamed: 'CardsDLOG.gif') asMorph. oK _ DrawPicture
new initializeWith: 'OK.gif' valor: 1 rect: (463@327
corner: 535@358). oK target: self. oK actionSelector: #cambiaCartas: . oK
arguments: (Array with: cardDialog). cardDialog position: 90 @ 90. cardDialog
addMorph: oK. f _ Rectangle left: 8 right: 88 top: 8 bottom:
128. 1 to: n do: [:c | rblanco _ Morph new. rblanco color: Color
lightYellow. rblanco borderColor: Color black. rblanco bounds: f. c = 1
ifTrue: [rblanco position: 112@110. rpos_ 130@185]. c = 2 ifTrue: [rblanco
position: 286@110. rpos_ 286+18@185]. c = 3 ifTrue: [rblanco position:
462@..._ 462+18@185]. r _ rblanco bounds. cardDialog addMorph: rblanco.
laCarta _ (losJugadores at: turno) misCartas at: c. . ((losJugadores
at: turno) misCartas at: c) > 42 ifTrue: [cardDialog DrawPicture new
initializeWith: 'Soldado1.gif' valor: 1 pos: rpos. r _ rd
translateBy: 0 @ 35. cardDialog DrawPicture new initializeWith:
'Canon.gif' valor: 1 pos: rpos. rd _ r translateBy: 0 @ 35.
cardDialog DrawPicture new initializeWith: 'Caballo.gif' valor:
1 pos: rpos.] ifFalse: [paisCarta _ (miRegion at: laCarta) copy.
paisCarta color: (losJugadores at: turno) miColor. paisCarta center: r
center. insetRect _ r withWidth: r width - 6. insetRect _ insetRect
withHeight: insetRect height - 40. paisCarta bounds: insetRect. paisCarta
center: r center. cardDialog addMorph: paisCarta. tipoCarta _ laCarta \\\ 3.
tipoCarta caseOf: { [0] -> [cardDialog addMorph: (DrawPicture new
initializeWith: 'Soldado1.gif' valor: laCarta pos: rpos)].
[1] -> [cardDialog addMorph: (DrawPicture new initializeWith:
'Canon.gif' valor: laCarta pos: rpos)]. [2] ->
[cardDialog addMorph: (DrawPicture new initializeWith: 'Caballo.gif'
valor: laCarta pos: rpos)]} otherwise: [Transcript open]].
s _ StringMorph contents: (miRegion at: laCarta) nombre. s center:
rblanco center. s top: rblanco top + 8.. cardDialog addMorph: s. ].
cardDialog openInWorld. (losJugadores at: turno) esHumano ifTrue: [aBoolean
ifTrue: []] ifFalse: [3 timesRepeat: [(Delay forSeconds: 1) wait.
SampledSound playSoundNamed: 'chirp']. loHizo _ true. (Delay forSeconds: 3)
wait. continue _ cardDialog. ^loHizo]. ! ! !TEGMain methodsFor:
'initialization' stamp: 'EDC 4/21/2002 09:24'! dibujaRegion2: aInteger color:
aColor (miRegion at: aInteger) color: aColor ! ! !TEGMain methodsFor:
'initialization' stamp: 'EDC 5/6/2002 08:44'! distribuyePaises |
paisesPorJugador randomNumber cantPaises ordendePaises totalPaises cualPais |
paisesPorJugador _ #(0 0 0 0 0 0 ). cantPaises _ 42 / jugadoresVivos.
ordendePaises _ OrderedCollection new. [ordendePaises size < 42 ] whileTrue:
[(ordendePaises includes: (randomNumber _ 42 atRandom)) ifFalse:
[ordendePaises add: randomNumber]]. totalPaises _ 1. 1 to: jugadoresVivos do:
[: elJugador | 1 to: cantPaises do: [:p| cualPais _ (ordendePaises at:
totalPaises). (losJugadores at: elJugador) misPaises: cualPais.
deQuienEsPais at: cualPais put: elJugador. totalPaises _ totalPaises + 1].
(losJugadores at: elJugador) totalPaises: cantPaises. ]. ! ! !TEGMain
methodsFor: 'initialization' stamp: 'EDC 5/23/2002 06:11'! eligeEjercitos:
aInteger jugador: j | ejArep s50 s20 s10 s5 s1 posIcon cuantos numeroEjercitos
nEjRec ejercitos | cuantos _ aInteger. ejercitos _ Array new: 9. nEjRec _
Array new: 9. 1 to: 9 do: [:e | ejercitos at: e put: (Rectangle
left: 155 + (e * 45) right: 195 + (e * 45) top: 420 bottom:
460). nEjRec at: e put: 0]. ejArep _ cuantos. s50 _ 0. s20 _ 0. s10 _ 0.
s5 _ 0. s1 _ 0. posIcon _ 0. s50 _ (cuantos / 50) asInteger. cuantos _
cuantos \\\ 50. s20 _ (cuantos / 20) asInteger. cuantos _ cuantos \\\ 20. s10
_ (cuantos / 10) asInteger. cuantos _ cuantos \\\ 10. cuantos = 5 ifTrue:
[s1 _ 5] ifFalse: [s5 _ cuantos / 5. s1 _ cuantos \\\ 5]. numeroEjercitos
_ s50 + s20 + s10 + s5 + s1. self ifcomplicado. s1 > 0 ifTrue: [1 to: s1
do: [:i | posIcon _ posIcon + 1. self addMorph: (DrawPicture
new initializeWith: 'Soldado1.gif' valor: 1 rect:
(ejercitos at: i)). nEjRec at: i put: 1]]. numeroEjercitos _ posIcon. s5
> 0 ifTrue: [posIcon to: s5 + numeroEjercitos - 1 do: [:i |
posIcon _ posIcon + 1. self addMorph: (DrawPicture new
initializeWith: 'Soldado5.gif' valor: 5 rect: (ejercitos at:
i)). nEjRec at: i put: 5]]. numeroEjercitos _ posIcon. s10 > 0 ifTrue:
[posIcon to: s10 + numeroEjercitos - 1 do: [:i | posIcon _ posIcon
+ 1. self addMorph: (DrawPicture new initializeWith:
'Soldado10.gif' valor: 10 rect: (ejercitos at: i)). nEjRec
at: i put: 10]]. numeroEjercitos _ posIcon. s20 > 0 ifTrue: [posIcon to:
s20 + numeroEjercitos - 1 do: [:i | posIcon _ posIcon + 1. self
addMorph: (DrawPicture new initializeWith: 'Soldado20.gif'
valor: 20 rect: (ejercitos at: i)). nEjRec at: i put: 20]].
numeroEjercitos _ posIcon. s50 > 0 ifTrue: [posIcon to: s50 +
numeroEjercitos - 1 do: [:i | posIcon _ posIcon + 1. self
addMorph: (DrawPicture new initializeWith: 'Soldado50.gif'
valor: 50 rect: (ejercitos at: i)). nEjRec at: i put: 50]]. ! !
!TEGMain methodsFor: 'initialization' stamp: 'EDC 5/29/2002 11:07'! elijeColor
| colores frame buttons | colores _ Array new: 16. colores at: 1 put:
(Color r: 1.0 g: 5000 / 65535 b: 5000 / 65535). colores at: 2
put: (Color r: 1.0 g: 25000 / 65535 b: 5000 / 65535). colores at:
3 put: (Color r: 1.0 g: 45000 / 65535 b: 5000 / 65535). colores
at: 4 put: (Color r: 65000 / 65535 g: 65000 / 65535 b: 25000 /
65535). colores at: 5 put: (Color r: 65000 / 65535 g: 65000 / 65535
b: 500 / 65535). colores at: 6 put: (Color r: 45000 / 65535 g:
45000 / 65535 b: 500 / 65535). colores at: 7 put: (Color r: 25000 /
65535 g: 25000 / 65535 b: 500 / 65535). colores at: 8 put: (Color
r: 5000 / 65535 g: 65535 / 65535 b: 20000 / 65535). colores at: 9
put: (Color r: 5000 / 65535 g: 65535 / 65535 b: 65535 / 65535).
colores at: 10 put: (Color r: 5000 / 65535 g: 45000 / 65535 b:
65535 / 65535). colores at: 11 put: (Color r: 5000 / 65535 g: 25000
/ 65535 b: 65535 / 65535). colores at: 12 put: (Color r: 5000 /
65535 g: 5000 / 65535 b: 65535 / 65535). colores at: 13 put: (Color
r: 1.0 g: 5000 / 65535 b: 25000 / 65535). colores at: 14 put:
(Color r: 1.0 g: 5000 / 65535 b: 45000 / 65535). colores at: 15
put: (Color r: 1.0 g: 5000 / 65535 b: 65000 / 65535). colores at:
16 put: (Color r: 45000 / 65535 g: 5000 / 65535 b: 65535 / 65535).
frame _ AlignmentMorph newColumn. buttons _ OrderedCollection new. 1 to: 16
do: [:c | buttons add: (SimpleButtonMorph new label: 'Color '; color:
(colores at: c); target: self; actionSelector: #miColor:;
arguments: (Array with: (colores at: c)))]. buttons reverseDo: [:each
| frame addMorph: each]. frame position: 650 @ 30. self addMorph: frame.
cartel _ frame! ! !TEGMain methodsFor: 'initialization' stamp: 'EDC 4/22/2002
08:55'! ifcomplicado ^self ! ! !TEGMain methodsFor: 'initialization' stamp:
'EDC 5/2/2002 16:51'! informaCartas | rcolor rblanco h arriba abajo arribaB
abajoB s | rcolor _ Morph new. rcolor bounds: (Rectangle left: 710
right: 748 top: 220 bottom: 460). rcolor color: Color white. rcolor
borderColor: Color black. rcolor borderWidth: 2. self addMorph: rcolor . h _
(216 / jugadoresVivos) asInteger. arriba _ 224. abajo _ 224 + h. arribaB _
237. abajoB _ 247. h _ h + 3. 1 to: jugadoresVivos do: [:c | rcolor _
Morph new. rcolor bounds: (Rectangle left: 712 right: 748
top: arriba bottom: abajo). rcolor color: (losJugadores at: c) miColor.
rcolor borderColor: Color black. rcolor borderWidth: 2. self addMorph:
rcolor . rblanco _ Morph new. rblanco bounds: (Rectangle left:
720 right: 738 top: arribaB bottom: abajoB). rblanco color:
Color white. rblanco borderColor: Color black. rblanco borderWidth: 2.
self addMorph: rblanco . s _ StringMorph contents: (losJugadores at: c)
nCartas asString. s center: rblanco center. self addMorph: s . arriba
_ arriba + h. abajo _ abajo + h. arribaB _ arribaB + h. abajoB _ abajoB
+ h]! ! !TEGMain methodsFor: 'initialization' stamp: 'EDC 5/29/2002 11:05'!
initialize | punto nombre frontera pais boton seguir fortificar carta
randomNumber | self setFolder. "soundTrack _ StreamingMP3Sound onFileNamed:
newFolder pathName , FileDirectory slash , 'combat.mp3'. SoundPlayer
stopReverb. soundTrack volume: 1.0. soundTrack repeat: false. soundTrack
resumePlaying." super initialize. self extent: 750 @ 490. self color: Color
paleBlue. self borderWidth: 2. self position: 18 @ 0. self toggleStickiness.
self openInWorld. miArchivo _ FileStream readOnlyFileNamed: 'PRUEBA'. cartas _
OrderedCollection new. 44 timesRepeat: [cartas add: false]. cartasOrden _
OrderedCollection new. [cartasOrden size < 44] whileTrue: [(cartasOrden
includes: (randomNumber _ 44 atRandom)) ifFalse: [cartasOrden add:
randomNumber]]. losJugadores _ Array new: 6. deQuienEsPais _ Array new: 42.
ejEnPais _ Array new: 42. 1 to: 6 do: [:i | losJugadores at: i put: Jugador
new initialize]. (losJugadores at: 1) esHumano: true. jugadoresVivos _ 6.
self distribuyePaises. miRegion _ Array new: 42. 1 to: 42 do: [:p |
ejEnPais at: p put: 1. nombre _ String new. nombre _ self leerArchivo.
frontera _ OrderedCollection new. punto _ Point readFromString: self
leerArchivo. frontera add: punto. 10 timesRepeat: [punto _ Point
readFromString: self leerArchivo. frontera add: punto]. pais _ PaisMorph
new. pais nombre: nombre limites: frontera. pais deQuienSoy:
(deQuienEsPais at: p). pais numero: p. miRegion at: p put: pais. self
addMorph: pais]. limites _ #(#(1 2) #(1 3) #(2 3) #(2 4) #(3 2) #(3 4) #(3 38)
#(4 3) #(4 5) #(5 6) #(5 7) #(6 5) #(6 7) #(6 9) #(7 8) #(7 9) #(8 9) #(8 11)
#(8 12) #(9 10) #(9 12) #(10 13) #(11 27) #(12 13) #(13 14) #(14 15) #(14 18)
#(15 16) #(15 18) #(15 19) #(16 17) #(16 20) #(16 20) #(16 21) #(16 22) #(16 23)
#(17 19) #(18 19) #(19 38) #(20 16) #(20 23) #(20 38) #(20 39) #(21 25) #(22 23)
#(22 24) #(22 29) #(23 24) #(23 39) #(23 40) #(24 33) #(25 21) #(25 29) #(29 33)
#(33 29) #(38 39) #(38 40) #(38 41) #(40 41) #(20 23) #(19 20) #(39 40) #(25 26)
#(26 27) #(31 32) #(27 32) #(30 32) #(29 30) #(34 35) #(37 35) #(35 36) #(37 11)
#(11 12) #(40 42) #(42 41) #(34 37) #(36 37) #(33 34) #(24 29) #(28 30) #(25 30)
#(18 17) #(18 19) ). cambiosTotales _ 0. boton _ SimpleButtonMorph new label:
'Ataque'; target: self; actionSelector: #ataque; position: 150 @
450. self addMorph: boton. seguir _ SimpleButtonMorph new label: 'Continuar';
target: self; actionSelector: nil; position: 375 @ 450. self
addMorph: seguir. fortificar _ SimpleButtonMorph new label: 'Fortificar';
target: self; actionSelector: #fortificar; position: 465 @ 450. self
addMorph: fortificar. carta _ SimpleButtonMorph new label: 'Carta';
target: self; actionSelector: #obtenerCarta; position: 550 @ 450.
self addMorph: carta. carta _ SimpleButtonMorph new label: 'DEBUG';
target: self; actionSelector: #debug; position: 650 @ 450. self
addMorph: carta. self elijeColor. ronda _ 1. estado _ 1. numCarta _ 1. done
_ true. playerTurn _ 1! ! !TEGMain methodsFor: 'initialization' stamp: 'EDC
4/18/2002 09:51'! leerArchivo "devuelve un fileStream para usar en el proyecto"
| lee cadena | cadena _ String new. [miArchivo atEnd] whileFalse: [lee _
miArchivo next asCharacter. lee asciiValue = 13 ifTrue: [^ cadena]
ifFalse: [cadena _ cadena , lee asString]]! ! !TEGMain methodsFor:
'initialization' stamp: 'EDC 5/29/2002 11:09'! miColor: aColor |
totalJugadores | totalJugadores _ 1. [totalJugadores <= 6] whileTrue:
[(losJugadores at: totalJugadores) miColor ifNil: [(losJugadores at:
totalJugadores) miColor: aColor. (losJugadores at: totalJugadores)
misPaises do: [:pais | self dibujaRegion2: pais color: aColor].
totalJugadores = 6 ifTrue: [cartel delete.cartel _ TTSampleStringMorph new
initializeToStandAlone. cartel string: 'SqueakRos fight the evil '.
cartel center: self center. cartel top: self top + 10. self
addMorph: cartel. self startStepping. self makeMove]. ^
totalJugadores]. totalJugadores _ totalJugadores + 1]! ! !TEGMain
methodsFor: 'initialization' stamp: 'EDC 4/21/2002 10:10'! redibuja | rcolor
siga forti carta c aColor | rcolor _ Morph new. rcolor bounds: (Rectangle
left: 75 right: 232 top: 53 bottom: 72). rcolor color: Color white.
rcolor borderColor: Color black. rcolor borderWidth: 2. rcolor openInWorld.
siga _ Morph new. siga bounds: (Rectangle left: 377 right: 437
top: 57 bottom: 82). siga color: Color white. siga borderColor: Color
black. siga borderWidth: 2. siga openInWorld. forti _ Morph new. forti
bounds: (Rectangle left: 465 right: 525 top: 57 bottom: 82).
forti color: Color white. forti borderColor: Color black. forti borderWidth:
2. forti openInWorld. carta _ Morph new. carta bounds: (Rectangle left:
553 right: 613 top: 57 bottom: 82). carta color: Color white.
carta borderColor: Color black. carta borderWidth: 2. carta openInWorld. self
halt. 1 to: 42 do: [:p | c _ deQuienEsPais at: p. aColor _
(losJugadores at: c) miColor. self dibujaRegion2: p color: aColor]! !
!TEGMain methodsFor: 'initialization' stamp: 'EDC 5/29/2002 09:46'! repeat | c
i2 c2 | c _ (losJugadores at: playerTurn) nCartas. i2 _ 1. [i2 > c]
whileFalse: [((losJugadores at: playerTurn) misCartas at: i2) \\\ 3 = 0
ifFalse: [c2 _ (losJugadores at: playerTurn) misCartas at: i2.
((losJugadores at: playerTurn) misCartas at: i2) put: ((losJugadores at:
playerTurn) misCartas at: c). ((losJugadores at: playerTurn) misCartas at:
c) put: c2. c _ c - 1]. i2 _ i2 + 1]! ! !TEGMain methodsFor:
'initialization' stamp: 'EDC 5/29/2002 09:48'! verCartas | sold3 canon3 caba3
cambio soldado canon caballo comodin resultado tipo laCarta siCambio | sold3 _
0. canon3 _ 0. caba3 _ 0. cambio _ 0. soldado _ 0. canon _ 0. caballo _ 0.
comodin _ 0. cambio _ 0. resultado _ false. 1 to: (losJugadores at:
playerTurn) nCartas do: [:i | laCarta _ (losJugadores at: playerTurn)
misCartas at: i. laCarta >= 43 ifTrue: [cambio _ cambio + 1. comodin
_ i]. tipo _ ((losJugadores at: playerTurn) misCartas at: i) \\\ 3.
tipo caseOf: { [0] -> [sold3 _ sold3 + 1. soldado = 0
ifTrue: [soldado _ i. cambio _ cambio + 1] ifFalse: [self
in: laCarta pos1: i pos2: soldado]]. [1] -> [canon3 _
canon3 + 1. canon = 0 ifTrue: [canon _ i. cambio _ cambio + 1]
ifFalse: [self in: laCarta pos1: i pos2: canon]].
[2] -> [caba3 _ caba3 + 1. caballo = 0 ifTrue: [caballo _ i.
cambio _ cambio + 1] ifFalse: [self in: laCarta pos1: i
pos2: caballo]]} otherwise: [Transcript open]]. siCambio _ false.
cambio >= 3 ifTrue: [self halt. sold3 = 3 ifTrue: [self repeat].
canon3 = 3 ifTrue: [self repeat]. caba3 = 3 ifTrue: [self
repeat]]! ! !TEGMain methodsFor: 'game sequence' stamp: 'EDC 5/29/2002 10:39'!
ataque | p1 n aString paisAtacante paisAtacado reagrupa | estado _ 2.
"Estado dos corresponde al ataque" Cursor crossHair showWhile: [[Sensor
anyButtonPressed] whileFalse: [self currentWorld displayWorldSafely;
runStepMethods]. p1 _ Sensor cursorPoint]. n _ miRegion size. paisAtacante
_ 1. [((miRegion at: paisAtacante) containsPoint: p1) or: [paisAtacante =
n]] whileFalse: [paisAtacante _ paisAtacante + 1]. aString _ (miRegion at:
paisAtacante) nombre. PopUpMenu inform: aString. ((losJugadores at:
playerTurn) misPaises includes: (miRegion at: paisAtacante) numero) ifFalse:
[^ self]. Cursor crossHair showWhile: [[Sensor anyButtonPressed]
whileFalse: [self currentWorld displayWorldSafely; runStepMethods]. p1 _
Sensor cursorPoint]. n _ miRegion size. paisAtacado _ 1. [((miRegion at:
paisAtacado) containsPoint: p1) or: [paisAtacado = n]] whileFalse:
[paisAtacado _ paisAtacado + 1]. lim _ Array new: 2. lim at: 1 put:
paisAtacante. lim at: 2 put: paisAtacado. (limites includes: lim) ifTrue:
[aString _ aString , ' Ataca ' , (miRegion at: paisAtacado) nombre. PopUpMenu
inform: aString] ifFalse: [lim at: 1 put: paisAtacado. lim at: 2 put:
paisAtacante. (limites includes: lim) ifTrue: [aString _ aString , '
Ataca ' , (miRegion at: paisAtacado) nombre. PopUpMenu inform: aString]
ifFalse: [PopUpMenu inform: 'No son limitrofes'. ^ false]]. cartel info:
lim. reagrupa _ self suerte: paisAtacante contra: paisAtacado. reagrupa
ifTrue: [self eligeEjercitos: pone jugador: playerTurn]! ! !TEGMain methodsFor:
'game sequence' stamp: 'EDC 5/18/2002 07:08'! continue done _ true.
playerTurn = jugadoresVivos ifTrue: [self finRonda]. self nextTurn! !
!TEGMain methodsFor: 'game sequence' stamp: 'EDC 5/2/2002 10:56'! endGameFor:
aInteger ^ self halt.! ! !TEGMain methodsFor: 'game sequence' stamp: 'EDC
5/23/2002 07:19'! finRonda cartel string: 'Ronda ' , ronda asString. cartel
center: self center. cartel top: self top + 10. ronda _ ronda + 1. self
nextTurn! ! !TEGMain methodsFor: 'game sequence' stamp: 'EDC 5/29/2002 17:59'!
makeMove estado _ 1. ronda caseOf: { [1] -> [pone _ 5]. [2] -> [pone _ 4].
[3] -> [pone _ 3]. [4] -> [pone _ 1]. [5] -> [pone _ 1]} otherwise: [pone
_ self cuantosEjercitos]. playerTurn <= jugadoresVivos ifTrue: [cartel color:
(losJugadores at: playerTurn) miColor. cartel string: 'Ronda ' , ronda
asString , ' Turno del jugador ' , playerTurn asString. cartel center: self
center. cartel top: self top + 10. (losJugadores at: playerTurn) nCartas
>= 3 ifTrue: [self verCartas]. done _ false. (losJugadores at:
playerTurn) esHumano ifTrue: [self eligeEjercitos: pone jugador: playerTurn]
ifFalse: [self maquinaPone]]. self informaCartas! ! !TEGMain methodsFor: 'game
sequence' stamp: 'EDC 5/29/2002 10:03'! nextTurn | c | [done] whileFalse:
[World doOneCycle]. c _ Color wheel: 256. cartel color: (c at: 256
atRandom). playerTurn _ playerTurn \\ 6 + 1. self world displayWorld. (Delay
forSeconds: 5) wait. self makeMove! ! !TEGMain methodsFor: 'game sequence'
stamp: 'EDC 5/17/2002 11:30'! permitido: aInteger estado = 1 ifTrue:
[((losJugadores at: playerTurn) misPaises includes: aInteger) ifTrue: [^ true]].
estado = 2 ifTrue: [(lim includes: aInteger) ifTrue: [ ^ true]]. ^ false! !
!TEGMain methodsFor: 'game sequence' stamp: 'EDC 5/10/2002 11:37'!
ponerEjercitos: aInteger enPais: pais ejEnPais at: pais put: (ejEnPais at:
pais) + aInteger. ! ! !TEGMain methodsFor: 'fileIn/out' stamp: 'EDC
5/16/2002 10:17'! grabaEstado | outputStream | outputStream _ ReferenceStream
fileNamed: 'estado.teg'. outputStream nextPut: ejEnPais. outputStream nextPut:
deQuienEsPais. outputStream nextPut: cartas. outputStream nextPut: losJugadores.
outputStream close. ! ! !TEGMain methodsFor: 'fileIn/out' stamp: 'EDC
5/16/2002 10:19'! leerEstado | inputStream | inputStream _ ReferenceStream
fileNamed: 'estado.teg'. ejEnPais _ inputStream next. deQuienEsPais _
inputStream next. cartas _ inputStream next. losJugadores _ inputStream next.
inputStream close. inputStream close. ! ! !TEGMain methodsFor: 'fileIn/out'
stamp: 'EDC 4/28/2002 15:19'! resetFolder FileDirectory setDefaultDirectory:
oldFolder.! ! !TEGMain methodsFor: 'fileIn/out' stamp: 'EDC 5/15/2002 15:00'!
setFolder oldFolder _ FileDirectory default pathName. newFolder _ FileList2
modalFolderSelector. FileDirectory setDefaultDirectory: newFolder pathName.! !
!TEGMain methodsFor: 'debug and other' stamp: 'EDC 5/20/2002 07:56'!
conQuienLimito | nombres | nombres _ OrderedCollection new. Transcript open.
limites do: [:frontera | Transcript show: (miRegion at: (frontera at: 1))
nombre , ' limita con ' , (miRegion at: (frontera at: 2)) nombre;
cr]! ! !TEGMain methodsFor: 'debug and other' stamp: 'EDC 5/19/2002 09:27'!
debug miRegion do: [:i| Transcript show: i ,'-> ',i nombre;cr]! ! !TEGMain
methodsFor: 'debug and other' stamp: 'EDC 5/18/2002 10:31'! maximo: aCollection
| maxValue maxElement val | aCollection do: [:each | maxValue == nil ifTrue:
["first element" maxElement _ each x. maxValue _ each x] ifFalse:
[(val _ each x) > maxValue ifTrue: [maxElement _ each x. maxValue _
val]]]. ^maxValue! ! !TEGMain methodsFor: 'debug and other' stamp: 'EDC
5/18/2002 10:34'! minimo: aCollection | minValue minElement val | aCollection
do: [:each | minValue == nil ifTrue: ["first element" minElement _ each
x. minValue _ each x] ifFalse: [(val _ each x) < minValue ifTrue:
[minElement _ each x. minValue _ val]]]. ^ minValue! ! !TEGMain
methodsFor: 'debug and other' stamp: 'EDC 5/10/2002 07:12'! muerte self halt.! !
!TEGMain methodsFor: 'sound effects' stamp: 'EDC 5/23/2002 09:14'! soundEffects
| numero sonido soundTrack | numero _ 3 atRandom. sonido _ newFolder pathName
, FileDirectory slash , 'batalla' , numero asString , '.mp3'. soundTrack _
StreamingMP3Sound onFileNamed: sonido. SoundPlayer stopReverb. soundTrack
volume: 1.0. soundTrack repeat: false. soundTrack resumePlaying. self halt! !
!TEGMain methodsFor: 'as yet unclassified' stamp: 'EDC 5/29/2002 09:48'! in:
laCarta pos1: aInteger1 pos2: aInteger2 | temp c | temp _ (losJugadores at:
playerTurn) misPaises includes: laCarta. temp ifTrue: [self halt. c _
(losJugadores at: playerTurn) misCartas at: aInteger1. ((losJugadores at:
playerTurn) misCartas at: aInteger1) put: ((losJugadores at: playerTurn)
misCartas at: aInteger2). ((losJugadores at: playerTurn) misCartas at:
aInteger2) put: c]! !

Archivo adjunto
Morphic-TEG.060.st
Tipo:
application/applefile
Morph subclass: #DrawCard instanceVariableNames: 'nombre deQuienSoy numero '
classVariableNames: '' poolDictionaries: '' category: 'Morphic-TEG'!
!DrawCard methodsFor: 'initialization'! dibujaUnaCarta: t1 | t2 t3 t4 t5 |
self numero: t1. t4 _ #('Soldado1.jpg' 'Canon.jpg' 'Caballo.jpg' ). t1 > 42
ifTrue: [t3 _ self top + 5. t4 do: [:t6 | self addMorph:
(DrawPicture new initializeWith: t6 escala: 0.7). self submorphs first
center: self center. self submorphs first top: t3. t3 _ t3 + 40]]
ifFalse: [t5 _ t1 \\\ 3 + 1. self addMorphBack: (DrawPicture new
initializeWith: (t4 at: t5) valor: t1 pos: self left + 20 @ self
center y). t2 _ StringMorph contents: self nombre. t2 center: self center.
t2 top: self top + 8. self addMorphBack: t2]! ! !DrawCard methodsFor:
'initialization'! initialize super initialize. self setProperty: #dragEnabled
toValue: true. self extent: 80 @ 120. self color: Color lightGray. self
borderColor: Color black. self borderWidth: 2! ! !DrawCard methodsFor:
'initialization'! initializeOff self addMorph: (Form fromFileNamed:
'TEGCarta.jpg') asMorph! ! !DrawCard methodsFor: 'initialization'! nombre: t1
limites: t2 | t3 t4 t5 | nombre _ t1. ejEnPais _ 0. self vertices: t2
asArray color: Color white borderWidth: 2 borderColor: Color black. t4 _
self center. t5 _ Morph new. t5 bounds: (Rectangle left: t4 x right:
t4 x + 15 top: t4 y bottom: t4 y + 10). t5 color: Color white. self
addMorph: t5. t3 _ TextMorph new. t3 autoFit: true. t3 string: ejEnPais
asString fontName: #ComicBold size: 18 wrap: false. t3 contents: ejEnPais
asString. t3 bounds: t5. t3 centered. self addMorph: t3. t3 lock! !
!DrawCard methodsFor: 'access'! deQuienSoy ^ deQuienSoy! ! !DrawCard
methodsFor: 'access'! deQuienSoy: t1 deQuienSoy _ t1! ! !DrawCard methodsFor:
'access'! nombre ^ nombre! ! !DrawCard methodsFor: 'access'! nombre: t1
nombre _ t1! ! !DrawCard methodsFor: 'access'! numero ^ numero! ! !DrawCard
methodsFor: 'access'! numero: t1 numero _ t1! ! !DrawCard methodsFor: 'event
handling'! click: t1 ^ self! ! !DrawCard methodsFor: 'event handling'!
doubleClick: t1 submorphs first ifNil: [^ 0]. submorphs first delete. self
dibujaUnaCarta: numero! ! !DrawCard methodsFor: 'event handling'!
handlesMouseDown: t1 ^ true! ! !DrawCard methodsFor: 'event handling'!
mouseDown: t1 t1 hand waitForClicksOrDrag: self event: t1. t1 hand grabMorph:
self! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! DrawCard
class instanceVariableNames: ''! !DrawCard class methodsFor: 'as yet
unclassified'! initializeOff | t1 | t1 _ self new. FileDirectory default
pathParts last = 'STEG' ifFalse: [TEGMain setFolder]. t1 addMorph: (Form
fromFileNamed: 'TEGCarta.jpg') asMorph. ^ t1! ! IconicButton subclass:
#DrawPicture instanceVariableNames: 'estado valor ' classVariableNames: ''
poolDictionaries: '' category: 'Morphic-TEG'! !DrawPicture methodsFor: 'as yet
unclassified'! estado ^ estado! ! !DrawPicture methodsFor: 'as yet
unclassified'! estado: t1 | t2 | estado _ t1. estado ifTrue: [t2 _
submorphs first form. t2 mapColor: Color white to: Color lightRed] ifFalse:
[t2 _ submorphs first form. t2 mapColor: Color lightRed to: Color white]! !
!DrawPicture methodsFor: 'as yet unclassified'! initializeWith: t1 escala: t2
| t3 | t3 _ Form fromFileNamed: t1. t3 _ t3 magnify: t3 boundingBox by: t2.
self labelGraphic: t3! ! !DrawPicture methodsFor: 'as yet unclassified'!
initializeWith: t1 valor: t2 pos: t3 | t4 | valor _ t2. self estado: false.
t4 _ Form fromFileNamed: t1. self labelGraphic: t4. self position: t3! !
!DrawPicture methodsFor: 'as yet unclassified'! initializeWith: t1 valor: t2
rect: t3 | t4 | valor _ t2. self estado: false. t4 _ Form fromFileNamed:
t1. self labelGraphic: t4. self bounds: t3. self comeToFront! ! !DrawPicture
methodsFor: 'as yet unclassified'! mouseUp: t1 (self containsPoint: t1
cursorPoint) ifTrue: [self setSwitchState: estado = false. self
doButtonAction] ifFalse: [self setSwitchState: estado = true]! ! !DrawPicture
methodsFor: 'as yet unclassified'! setSwitchState: t1 t1 ifTrue: [self
borderColor: #inset. self estado: true] ifFalse: [self borderColor:
#raised. self estado: false]! ! !DrawPicture methodsFor: 'as yet
unclassified'! valor ^ valor! ! Morph subclass: #InformaCartas
instanceVariableNames: '' classVariableNames: '' poolDictionaries: ''
category: 'Morphic-TEG'! !InformaCartas methodsFor: 'initialization'!
initialize: t1 | t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 | super initialize. self
bounds: (Rectangle left: 710 right: 748 top: 220 bottom: 460).
self color: Color white. self borderColor: Color black. self borderWidth: 2.
t2 _ t1 size. t3 _ (216 / t2) asInteger. t4 _ 224. t5 _ 224 + t3. t6 _ 237.
t7 _ 247. t3 _ t3 + 3. 1 to: t2 do: [:t12 | t8 _ Morph new. t8
bounds: (Rectangle left: 712 right: 748 top: t4 bottom:
t5). t8 color: (t1 at: t12) miColor. t8 borderColor: Color black. t8
borderWidth: 2. self addMorph: t8. (t1 at: t12) vive ifTrue: [t9 _
Morph new. t9 bounds: (Rectangle left: 720 right: 738
top: t6 bottom: t7). t9 color: Color white. t9 borderColor:
Color black. t9 borderWidth: 2. self addMorph: t9. t10 _
StringMorph contents: (t1 at: t12) misCartas size asString. t10 center: t9
center. self addMorph: t10] ifFalse: [t11 _ DrawPicture new
initializeWith: 'muerte.gif' valor: 0 pos: t8 topLeft. self
addMorph: t11]. t4 _ t4 + t3. t5 _ t5 + t3. t6 _ t6 + t3. t7 _ t7 +
t3]. self openInWorld! ! Object subclass: #Jugador instanceVariableNames:
'vive esHumano misPaises misCartas miColor ' classVariableNames: ''
poolDictionaries: '' category: 'Morphic-TEG'! !Jugador methodsFor: 'accesing'!
esHumano ^ esHumano! ! !Jugador methodsFor: 'accesing'! esHumano: t1
esHumano _ t1! ! !Jugador methodsFor: 'accesing'! initialize vive _ true.
esHumano _ false. misPaises _ OrderedCollection new. misCartas _
OrderedCollection new! ! !Jugador methodsFor: 'accesing'! miColor ^ miColor! !
!Jugador methodsFor: 'accesing'! miColor: t1 miColor _ t1! ! !Jugador
methodsFor: 'accesing'! misCartas ^ misCartas! ! !Jugador methodsFor:
'accesing'! misCartas: t1 misCartas add: t1! ! !Jugador methodsFor:
'accesing'! misPaises ^ misPaises! ! !Jugador methodsFor: 'accesing'!
misPaises: t1 misPaises add: t1! ! !Jugador methodsFor: 'accesing'! vive ^
vive! ! !Jugador methodsFor: 'accesing'! vive: t1 vive _ t1! ! !Jugador
methodsFor: 'as yet unclassified'! sortCartas | t1 | t1 _ SortedCollection
new. t1 sortBlock: [:t2 :t3 | t2 \\\ 3 < (t3 \\\ 3)]. misCartas do: [:t4 |
t1 add: t4]. misCartas _ t1 asOrderedCollection! ! PolygonMorph subclass:
#PaisMorph instanceVariableNames: 'nombre ejEnPais deQuienSoy instanciaTEG
numero misLimites ' classVariableNames: '' poolDictionaries: '' category:
'Morphic-TEG'! !PaisMorph methodsFor: 'initialization'! initialize
instanciaTEG _ ActiveWorld submorphs detect: [:t1 | t1 class == TEGMain].
super initialize. misLimites _ SortedCollection new! ! !PaisMorph methodsFor:
'initialization'! nombre: t1 limites: t2 | t3 t4 t5 | nombre _ t1. ejEnPais
_ 0. self vertices: t2 asArray color: Color white borderWidth: 2
borderColor: Color black. t4 _ self center. t5 _ Morph new. t5 bounds:
(Rectangle left: t4 x right: t4 x + 15 top: t4 y bottom: t4 y +
10). t5 color: Color white. self addMorph: t5. t3 _ TextMorph new. t3
autoFit: true. t3 string: ejEnPais asString fontName: #ComicBold size: 18
wrap: false. t3 contents: ejEnPais asString. t3 bounds: t5. t3 centered.
self addMorph: t3. t3 lock! ! !PaisMorph methodsFor: 'event handling'! click:
t1 | t2 t3 | t2 _ 'Soy ' , nombre asString , ' numero ' , numero asString ,
'y pertenezco a ' , deQuienSoy asString. self showBalloon: t2 hand: t1 hand.
t3 _ 0. instanciaTEG estado = 2 ifFalse: [^ false]. (instanciaTEG permitido:
numero) ifFalse: [^ false]. instanciaTEG submorphs do: [:t4 | t4 class ==
DrawPicture ifTrue: [t3 _ t3 + 1. instanciaTEG pone: instanciaTEG pone
- 1. t4 estado ifTrue: [ejEnPais _ ejEnPais + t4 valor. t3 _
t3 - 1. t4 delete]]]. self mostrar. t3 = 1 ifTrue: [instanciaTEG
ronda <= 5 ifTrue: [instanciaTEG continue] ifFalse: [instanciaTEG
estado: 2]]! ! !PaisMorph methodsFor: 'event handling'! firstClickTimedOut: t1
| t2 t3 | t2 _ owner rootForGrabOf: self. t2 ifNil: [t3 _ self copy. self
board owner owner addMorphFront: t3. self world displayWorld. (Delay
forMilliseconds: 750) wait. t3 delete] ifNotNil: [t1 hand grabMorph: t2]! !
!PaisMorph methodsFor: 'event handling'! handlesMouseDown: t1 ^ true! !
!PaisMorph methodsFor: 'event handling'! mouseDown: t1 t1 hand
waitForClicksOrDrag: self event: t1! ! !PaisMorph methodsFor: 'event handling'!
mouseEnter: t1 | t2 | t2 _ 'Soy ' , nombre asString , ' y pertenezco a ' ,
deQuienSoy asString. self showBalloon: t2 hand: t1 hand! ! !PaisMorph
methodsFor: 'access'! add: t1 ejEnPais _ ejEnPais + t1. self mostrar! !
!PaisMorph methodsFor: 'access'! deQuienSoy ^ deQuienSoy! ! !PaisMorph
methodsFor: 'access'! deQuienSoy: t1 deQuienSoy _ t1! ! !PaisMorph
methodsFor: 'access'! doubleClick: t1 1 to: 42 do: [:t2 | (instanciaTEG
submorphs at: t2) color: Color white]. (instanciaTEG submorphs at: numero)
color: Color green. misLimites do: [:t3 | (instanciaTEG submorphs at: t3)
color: Color red]. self borderWidth: 4; borderColor: Color red. ^ self
numero! ! !PaisMorph methodsFor: 'access'! ejercitos ^ ejEnPais! ! !PaisMorph
methodsFor: 'access'! ejercitos: t1 ejEnPais _ t1. self mostrar! !
!PaisMorph methodsFor: 'access'! misLimites ^ misLimites! ! !PaisMorph
methodsFor: 'access'! misLimites: t1 misLimites _ t1! ! !PaisMorph
methodsFor: 'access'! mostrar submorphs first contents: ejEnPais asString.
submorphs do: [:t1 | t1 center: self center]! ! !PaisMorph methodsFor:
'access'! noMostrar submorphs do: [:t1 | t1 delete]! ! !PaisMorph
methodsFor: 'access'! nombre ^ nombre! ! !PaisMorph methodsFor: 'access'!
numero ^ numero! ! !PaisMorph methodsFor: 'access'! numero: t1 numero _ t1!
! !PaisMorph methodsFor: 'access'! otroLimites: t1 misLimites _ misLimites
add: t1! ! !PaisMorph methodsFor: 'access'! redrawInColor: t1 self color: t1.
submorphs first contents: ejEnPais asString. submorphs do: [:t2 | t2 center:
self center]! ! Object subclass: #TEGClient instanceVariableNames: 'socket
serverName instanciaTEG ' classVariableNames: '' poolDictionaries: ''
category: 'Morphic-TEG'! !TEGClient methodsFor: 'as yet unclassified'!
initialize | t1 | instanciaTEG _ ActiveWorld submorphs detect: [:t2 | t2
class == TEGMain]. instanciaTEG cartel newContents: 'TEGClient starting...'.
serverName _ FillInTheBlank request: 'Type server name or IPAddress'
initialAnswer: 'localhost'. t1 _ FillInTheBlank request: 'Type client name'
initialAnswer: ''. self newSocket. socket sendData: t1. instanciaTEG
activeSocket: self socket! ! !TEGClient methodsFor: 'as yet unclassified'!
newSocket Socket initializeNetwork. socket _ Socket newTCP. socket
connectTo: (NetNameResolver addressForName: serverName) port: 8000. socket
waitForConnectionUntil: Socket standardDeadline! ! !TEGClient methodsFor: 'as
yet unclassified'! socket ^ socket! ! !TEGClient methodsFor: 'as yet
unclassified'! start | t1 | instanciaTEG _ ActiveWorld submorphs detect:
[:t2 | t2 class == TEGMain]. instanciaTEG cartel newContents: 'TEGClient
starting...'. serverName _ FillInTheBlank request: 'Type server name or
IPAddress' initialAnswer: 'localhost'. t1 _ FillInTheBlank request: 'Type
client name' initialAnswer: ''. self newSocket. socket sendData: t1.
instanciaTEG activeSocket: self socket! ! "-- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- "! TEGClient class instanceVariableNames: ''! !TEGClient
class methodsFor: 'as yet unclassified'! new super new initialize! !
!TEGClient class methodsFor: 'as yet unclassified'! start super new initialize!
! TextMorph subclass: #TEGConsole instanceVariableNames: ''
classVariableNames: '' poolDictionaries: '' category: 'Morphic-TEG'! "-- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! TEGConsole class
instanceVariableNames: ''! !TEGConsole class methodsFor: 'as yet unclassified'!
default: t1 | t2 | t2 _ self borderedPrototype. t2 privateOwner: t1. t2
beAllFont: (StrikeFont familyName: #ComicBold size: 18). t2 color: Color red.
t2 newContents: 'SqueakRos fight the evil '. t2 extent: t1 width - 30 @ 40. t2
center: t1 center. t2 top: t1 top + 10. t1 addMorphBack: t2. ^ t2! !
BorderedMorph subclass: #TEGMain instanceVariableNames: 'miArchivo cartasOrden
losJugadores jugadoresVivos cartel pone cambiosTotales playerTurn ronda limites
done lim estado numCarta mazo activeSocket serverOrClient socketList '
classVariableNames: 'NewFolder ' poolDictionaries: '' category: 'Morphic-TEG'!
!TEGMain methodsFor: 'accessing'! activeSocket ^ activeSocket! ! !TEGMain
methodsFor: 'accessing'! activeSocket: t1 activeSocket _ t1! ! !TEGMain
methodsFor: 'accessing'! cambiosTotales ^ cambiosTotales! ! !TEGMain
methodsFor: 'accessing'! cambiosTotales: t1 cambiosTotales _ t1! ! !TEGMain
methodsFor: 'accessing'! cartasOrden ^ cartasOrden! ! !TEGMain methodsFor:
'accessing'! cartasOrden: t1 cartasOrden _ t1! ! !TEGMain methodsFor:
'accessing'! cartel ^ cartel! ! !TEGMain methodsFor: 'accessing'! cartel: t1
cartel _ t1! ! !TEGMain methodsFor: 'accessing'! done ^ done! ! !TEGMain
methodsFor: 'accessing'! done: t1 done _ t1! ! !TEGMain methodsFor:
'accessing'! estado ^ estado! ! !TEGMain methodsFor: 'accessing'! estado: t1
estado _ t1! ! !TEGMain methodsFor: 'accessing'! jugadoresVivos ^
jugadoresVivos! ! !TEGMain methodsFor: 'accessing'! jugadoresVivos: t1
jugadoresVivos _ t1! ! !TEGMain methodsFor: 'accessing'! lim ^ lim! !
!TEGMain methodsFor: 'accessing'! lim: t1 lim _ t1! ! !TEGMain methodsFor:
'accessing'! limites ^ limites! ! !TEGMain methodsFor: 'accessing'! limites:
t1 limites _ t1! ! !TEGMain methodsFor: 'accessing'! losJugadores ^
losJugadores! ! !TEGMain methodsFor: 'accessing'! losJugadores: t1
losJugadores _ t1! ! !TEGMain methodsFor: 'accessing'! mazo ^ mazo! !
!TEGMain methodsFor: 'accessing'! mazo: t1 mazo _ t1! ! !TEGMain methodsFor:
'accessing'! miArchivo ^ miArchivo! ! !TEGMain methodsFor: 'accessing'!
miArchivo: t1 miArchivo _ t1! ! !TEGMain methodsFor: 'accessing'! numCarta ^
numCarta! ! !TEGMain methodsFor: 'accessing'! numCarta: t1 numCarta _ t1! !
!TEGMain methodsFor: 'accessing'! paises: t1 | t2 t3 | 1 to: 42 do: [:t4
| (submorphs at: t4) ejercitos: ((t1 at: t4) at: 1). (submorphs
at: t4) deQuienSoy: ((t1 at: t4) at: 2). t2 _ (submorphs at: t4)
deQuienSoy. t3 _ (losJugadores at: t2) miColor. (submorphs at: t4)
redrawInColor: t3]! ! !TEGMain methodsFor: 'accessing'! playerTurn ^
playerTurn! ! !TEGMain methodsFor: 'accessing'! playerTurn: t1 playerTurn _
t1! ! !TEGMain methodsFor: 'accessing'! pone ^ pone! ! !TEGMain methodsFor:
'accessing'! pone: t1 pone _ t1! ! !TEGMain methodsFor: 'accessing'! ronda ^
ronda! ! !TEGMain methodsFor: 'accessing'! ronda: t1 ronda _ t1! ! !TEGMain
methodsFor: 'accessing'! serverOrClient ^ serverOrClient! ! !TEGMain
methodsFor: 'accessing'! serverOrClient: t1 serverOrClient _ t1! ! !TEGMain
methodsFor: 'accessing'! socketList: t1 socketList _ t1. done _ true! !
!TEGMain methodsFor: 'as yet unclassified'! hacerListaPaises | t1 t2 | t1 _
Set new. (losJugadores at: playerTurn) misPaises do: [:t3 | limites do:
[:t4 | (t4 includes: t3) ifTrue: [t1 add: t4]]]. t2 _ t1 copy. t1 do:
[:t5 | (((losJugadores at: playerTurn) misPaises includes: (t5 at: 1))
and: [(losJugadores at: playerTurn) misPaises includes: (t5 at: 2)])
ifTrue: [t2 remove: t5]]. ^ t2! ! !TEGMain methodsFor: 'as yet unclassified'!
in: t1 pos1: t2 pos2: t3 | t4 t5 | t4 _ (losJugadores at: playerTurn)
misPaises includes: t1. t4 ifTrue: [t5 _ (losJugadores at: playerTurn)
misCartas at: t2. (losJugadores at: playerTurn) misCartas at: t2 put:
((losJugadores at: playerTurn) misCartas at: t3). (losJugadores at:
playerTurn) misCartas at: t3 put: t5]! ! !TEGMain methodsFor: 'as yet
unclassified'! optimizarCambio | t1 t2 t3 t4 t5 | t5 _ Array new: 6.
(losJugadores at: playerTurn) misCartas do: [:t6 | t2 _ t6 \\\ 3. self
halt]. (losJugadores at: playerTurn) misCartas do: [:t6 | ((losJugadores at:
playerTurn) misPaises includes: t6) ifTrue: [t1 _ (losJugadores at:
playerTurn) misCartas indexOf: t6. t2 _ t6 \\\ 3]]. t3 _ 0. (losJugadores
at: playerTurn) misCartas do: [:t7 | t3 _ t3 + 1. t7 \\\ 3 = t2
ifTrue: [t4 _ (losJugadores at: playerTurn) misCartas at: t1. (losJugadores
at: playerTurn) misCartas at: t1 put: ((losJugadores at: playerTurn)
misCartas at: t3). (losJugadores at: playerTurn) misCartas at: t3 put: t4.
^ true]. nil]! ! !TEGMain methodsFor: 'debug and other'! debug submorphs
do: [:t1 | t1 class == DrawPicture ifTrue: [t1 delete]]. 17 to: 99 do:
[:t2 | pone _ t2. self eligeEjercitos: t2 jugador: 1]! ! !TEGMain
methodsFor: 'debug and other'! maximo: t1 | t2 t3 t4 | t1 do: [:t5 | t2
ifNil: [t3 _ t5 x. t2 _ t5 x] ifNotNil: [(t4 _ t5 x) > t2 ifTrue:
[t3 _ t5 x. t2 _ t4]]]. ^ t2! ! !TEGMain methodsFor: 'debug and other'!
minimo: t1 | t2 t3 t4 | t1 do: [:t5 | t2 ifNil: [t3 _ t5 x. t2 _
t5 x] ifNotNil: [(t4 _ t5 x) < t2 ifTrue: [t3 _ t5 x. t2 _
t4]]]. ^ t2! ! !TEGMain methodsFor: 'debug and other'! split self
eligeEjercitos: pone jugador: playerTurn! ! !TEGMain methodsFor: 'event
handling'! handlesMouseDown: t1 ^ Smalltalk isMorphic not or: [t1
yellowButtonPressed]! ! !TEGMain methodsFor: 'event handling'! mouseDown: t1
| t2 | t1 yellowButtonPressed ifFalse: [^ self]. t2 _ MenuMorph new
defaultTarget: self. self addMenuItemsTo: t2 hand: t1 hand. t2 popUpEvent: t1
in: self world! ! !TEGMain methodsFor: 'fileIn/out'! grabaEstado | t1 | t1 _
ReferenceStream fileNamed: 'estado.teg'. t1 nextPut: losJugadores. t1 nextPut:
cartasOrden. t1 nextPut: jugadoresVivos. t1 nextPut: playerTurn. t1 nextPut:
ronda. t1 nextPut: numCarta. t1 nextPut: cambiosTotales. 1 to: 42 do:
[:t2 | t1 nextPut: (submorphs at: t2) ejercitos. t1 nextPut: (submorphs
at: t2) deQuienSoy]. t1 close! ! !TEGMain methodsFor: 'fileIn/out'! leerEstado
| t1 | t1 _ ReferenceStream fileNamed: 'estado.teg'. losJugadores _ t1 next.
cartasOrden _ t1 next. jugadoresVivos _ t1 next. playerTurn _ t1 next. ronda
_ t1 next. numCarta _ t1 next. cambiosTotales _ t1 next. 1 to: 42 do:
[:t2 | (submorphs at: t2) ejercitos: t1 next. (submorphs at: t2)
deQuienSoy: t1 next]. t1 close. self miColor! ! !TEGMain methodsFor: 'game
sequence'! armaBatallones | t1 t2 t3 t4 t5 t6 t7 | t7 _ Array new: 5. t1 _
pone. t2 _ 0. t3 _ 0. t4 _ 0. t5 _ 0. t6 _ 0. t2 _ (t1 / 50) asInteger.
t1 _ t1 \\\ 50. t3 _ (t1 / 20) asInteger. t1 _ t1 \\\ 20. t4 _ (t1 / 10)
asInteger. t1 _ t1 \\\ 10. t1 = 5 ifTrue: [t6 _ 5] ifFalse: [t5 _ (t1 / 5)
asInteger. t6 _ t1 \\\ 5]. pone <= 9 ifFalse: [[t2 + t3 + t4 + t5 + t6 <=
5] whileTrue: [t4 > 0 ifTrue: [t4 _ t4 - 1. t5 _ t5 + 2]
ifFalse: [t3 > 0 ifTrue: [t3 _ t3 - 1. t4 _ t4 + 2]
ifFalse: [t2 > 0 ifTrue: [t2 _ t2 - 1. t3 _ t3 + 2.
t4 _ t4 + 5] ifFalse: [t5 > 0 ifTrue: [t5 _ t5 - 1.
t6 _ t6 + 5]]]]]]. t7 at: 1 put: t6. t7 at: 2 put: t5. t7 at: 3 put: t4. t7
at: 4 put: t3. t7 at: 5 put: t2. ^ t7! ! !TEGMain methodsFor: 'game
sequence'! atacaMaquina | t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 | t10 _ self
hacerListaPaises: true. t10 do: [:t11 | ((losJugadores at: playerTurn)
misPaises includes: (t11 at: 1)) ifTrue: [t7 _ t11 at: 1. t6 _ t11
at: 2] ifFalse: [t7 _ t11 at: 2. t6 _ t11 at: 1]. t1 ifNil: [t1
_ (submorphs at: t7) ejercitos - (submorphs at: t6) ejercitos. t2 _ t7]
ifNotNil: [(t3 _ (submorphs at: t7) ejercitos - (submorphs at: t6) ejercitos) >
t1 ifTrue: [t2 _ t7. t8 _ t6. t1 _ t3]]]. t8 ifNil: [^
false]. t6 _ t8. t7 _ t2. t4 _ self suerte: (submorphs at: t7)
contra: (submorphs at: t6). t4 ifTrue: [pone > 2 ifTrue: [t5 _ (pone - 2
/ 2) asInteger. t9 _ pone - t5. (submorphs at: t7) add: t9.
(submorphs at: t6) add: t5. (submorphs at: t6) deQuienSoy:
playerTurn. ^ true]. ^ false]. ^ false! ! !TEGMain methodsFor: 'game
sequence'! ataque | t1 t2 t3 t4 t5 | estado _ 2. Cursor crossHair
showWhile: [[Sensor anyButtonPressed] whileFalse: [self currentWorld
displayWorldSafely; runStepMethods]. t1 _ Sensor cursorPoint]. t3 _
submorphs detect: [:t6 | t6 containsPoint: t1]. t2 _ t3 nombre. PopUpMenu
confirm: t2. ((losJugadores at: playerTurn) misPaises includes: t3 numero)
ifFalse: [^ self]. Cursor crossHair showWhile: [[Sensor anyButtonPressed]
whileFalse: [self currentWorld displayWorldSafely; runStepMethods]. t1 _
Sensor cursorPoint]. t4 _ submorphs detect: [:t6 | t6 containsPoint: t1].
lim _ Array new: 2. lim at: 1 put: t3 numero. lim at: 2 put: t4 numero.
(limites includes: lim) ifFalse: [lim at: 1 put: t4 numero. lim at: 2 put:
t3 numero. (limites includes: lim) ifFalse: [PopUpMenu inform: 'No son
limitrofes'. ^ false]]. t5 _ self suerte: t3 contra: t4. t5 ifTrue:
[self eligeEjercitos: pone jugador: playerTurn. estado _ 3]! ! !TEGMain
methodsFor: 'game sequence'! continue done _ true! ! !TEGMain methodsFor:
'game sequence'! continue: t1 t1 delete. estado _ 4! ! !TEGMain methodsFor:
'game sequence'! dibuCartas: t1 hayCambio: t2 | t3 t4 t5 t6 t7 t8 t9 | t3 _
(Form fromFileNamed: 'CardsDLOG.gif') asMorph. t7 _ DrawPicture new
initializeWith: 'OK.gif' valor: 1 rect: (463 @ 327 corner: 535 @ 358).
t7 target: self. t7 actionSelector: #cambiaCartas:. t7 arguments: (Array
with: t3). t9 _ DrawPicture new initializeWith: 'Cancel.gif' valor: 1
rect: (468 @ 292 corner: 530 @ 314). t9 target: self. t9 actionSelector:
#continue:. t9 arguments: (Array with: t3). t3 position: 90 @ 90. t3
openInWorld. 1 to: t1 do: [:t10 | t10 caseOf: { [1] -> [t6 _ 110 @
110]. [2] -> [t6 _ 286 @ 110]. [3] -> [t6 _ 462 @ 110]. [4] -> [t6 _
198 @ 254]. [5] -> [t6 _ 374 @ 254]. [6] -> [t6 _ 110 @ 254]}
otherwise: [t6 _ 20 @ 20]. t8 _ (losJugadores at: playerTurn) misCartas at:
t10. t8 > 42 ifTrue: [t4 _ DrawCard new dibujaUnaCarta: t8] ifFalse:
[t4 _ mazo at: t8. t4 submorphs last noMostrar. t4 submorphs last
color: (submorphs at: t8) color]. t10 <= 3 ifTrue: [t2 ifTrue: [t4
submorphs first estado: true]]. t4 position: t6. t3 addMorphBack: t4]. t3
addMorphBack: t7. t3 addMorphBack: t9. self world displayWorld. (losJugadores
at: playerTurn) esHumano ifTrue: [t2 ifTrue: [[estado = 4]
whileFalse: [World doOneCycle]]. estado _ 1] ifFalse: [3 timesRepeat:
[(Delay forSeconds: 1) wait. SampledSound playSoundNamed: 'chirp'. t2
ifTrue: [self cambiaCartas: t3]. t5 _ true. (Delay forSeconds: 3)
wait. t3 delete. ^ t5]]! ! !TEGMain methodsFor: 'game sequence'!
dibujaUnaCarta2: t1 | t2 t3 t4 | (losJugadores at: playerTurn) esHumano
ifFalse: [^ self]. t1 openInWorld. t1 center: Display center. t2 _ Player
new. t2 costume: t1. t3 _ 1.0. t2 show. 1 to: 8 do: [:t5 | t4 _ 1600
- (100 * t5). (Delay forMilliseconds: t4) wait. t2 setScaleFactor: t3.
t2 forward: 100 atRandom. t2 turn: 360 atRandom. self world displayWorld.
t3 _ t3 - 0.125]. t2 erase! ! !TEGMain methodsFor: 'game sequence'!
eligeEjercitos: t1 jugador: t2 | t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 | t10 _
Array new: 9. t9 _ Array new: 9. 1 to: 9 do: [:t13 | t10 at: t13
put: (Rectangle left: 155 + (t13 * 45) right: 195 + (t13 * 45)
top: self bottom - 70 bottom: self bottom - 50). t9 at: t13 put: 0].
t11 _ self armaBatallones. t8 _ 1. t7 _ t11 at: 1. t6 _ t11 at: 2. t5 _ t11
at: 3. t4 _ t11 at: 4. t3 _ t11 at: 5. t7 > 0 ifTrue: [1 to: t7 do:
[:t14 | t8 _ t8 + 1. self addMorphBack: (DrawPicture new
initializeWith: 'Soldado1.gif' valor: 1 rect: (t10 at: t14)).
t9 at: t14 put: 1]]. t6 > 0 ifTrue: [t12 _ t6 + t8 - 1. t8 to: t12
do: [:t14 | t8 _ t8 + 1. self addMorphBack: (DrawPicture new
initializeWith: 'Soldado5.gif' valor: 5 rect: (t10 at: t14)).
t9 at: t14 put: 5]]. t5 > 0 ifTrue: [t12 _ t5 + t8 - 1. t8 to: t12
do: [:t14 | t8 _ t8 + 1. self addMorphBack: (DrawPicture new
initializeWith: 'Soldado10.gif' valor: 10 rect: (t10 at: t14)).
t9 at: t14 put: 10]]. t4 > 0 ifTrue: [t12 _ t4 + t8 - 1. t8 to: t12
do: [:t14 | t8 _ t8 + 1. self addMorphBack: (DrawPicture new
initializeWith: 'Soldado20.gif' valor: 20 rect: (t10 at: t14)).
t9 at: t14 put: 20]]. t3 > 0 ifTrue: [t12 _ t3 + t8 - 1. t8 to: t12
do: [:t14 | t8 _ t8 + 1. self addMorphBack: (DrawPicture new
initializeWith: 'Soldado50.gif' valor: 50 rect: (t10 at: t14)).
t9 at: t14 put: 50]]. (t9 at: 9) = 0 ifTrue: [self addMorphBack:
(DrawPicture new initializeWith: 'Split.gif' valor: 0 rect: (t10
at: 9); target: self; actionSelector: #split)]! ! !TEGMain
methodsFor: 'game sequence'! endGameFor: t1 ^ self halt! ! !TEGMain
methodsFor: 'game sequence'! finAtaque done _ true. estado _ 3! ! !TEGMain
methodsFor: 'game sequence'! finRonda playerTurn = 6 ifTrue: [ronda _ ronda +
1]! ! !TEGMain methodsFor: 'game sequence'! fortificar | t1 t2 t3 t4 | estado
_ 2. Cursor crossHair showWhile: [[Sensor anyButtonPressed] whileFalse:
[self currentWorld displayWorldSafely; runStepMethods]. t1 _ Sensor
cursorPoint]. t2 _ submorphs detect: [:t5 | t5 containsPoint: t1].
((losJugadores at: playerTurn) misPaises includes: t2 numero) ifFalse: [^
self]. t4 _ t2 nombre. PopUpMenu confirm: t4. Cursor crossHair showWhile:
[[Sensor anyButtonPressed] whileFalse: [self currentWorld
displayWorldSafely; runStepMethods]. t1 _ Sensor cursorPoint]. t3 _
submorphs detect: [:t5 | t5 containsPoint: t1]. ((losJugadores at:
playerTurn) misPaises includes: t3 numero) ifFalse: [self halt]. lim _ Array
new: 2. lim at: 1 put: t2 numero. lim at: 2 put: t3 numero. (limites
includes: lim) ifFalse: [lim at: 1 put: t3 numero. lim at: 2 put: t2
numero. (limites includes: lim) ifFalse: [PopUpMenu inform: 'No son
limitrofes'. ^ false]]. pone _ t2 ejercitos - 1. t2 ejercitos: 1. self
eligeEjercitos: pone jugador: playerTurn! ! !TEGMain methodsFor: 'game
sequence'! fortificarMaquina | t1 t2 t3 t4 t5 t6 | t1 _ OrderedCollection new.
t3 _ (losJugadores at: playerTurn) misPaises asSortedCollection. t3 do: [:t7
| t2 _ false. (submorphs at: t7) misLimites do: [:t8 | (t3 includes:
t8) ifFalse: [t2 _ true]]. t2 ifFalse: [(submorphs at: t7)
ejercitos even ifTrue: [t4 _ (submorphs at: t7) ejercitos - 2.
(submorphs at: t7) ejercitos: 2] ifFalse: [t4 _ (submorphs at: t7)
ejercitos - 1. (submorphs at: t7) ejercitos: 1]. t5 _
(submorphs at: t7) misLimites size. t6 _ (t4 / t5) asInteger.
(submorphs at: t7) misLimites do: [:t9 | (submorphs at: t9) add:
t6]]]! ! !TEGMain methodsFor: 'game sequence'! hacerLimites | t1 | 1 to: 42
do: [:t2 | t1 _ limites select: [:t3 | t3 includes: t2]
thenCollect: [:t4 | (t4 at: 2) ~= t2 ifTrue: [t4 at: 2]
ifFalse: [t4 at: 1]]. (submorphs at: t2) misLimites: t1]. 1 to: 42
do: [:t5 | (submorphs at: t5) color: Color white]! ! !TEGMain methodsFor:
'game sequence'! leerCartas | t1 t2 | mazo _ OrderedCollection new. t1 _
ReferenceStream fileNamed: 'cartas37.teg'. 1 to: 42 do: [:t3 | t2 _ t1
next. (t2 submorphs at: 3) lock. mazo add: t2]. t1 close! ! !TEGMain
methodsFor: 'game sequence'! makeMove [jugadoresVivos > 1] whileTrue:
[submorphs do: [:t1 | t1 class == DrawPicture ifTrue: [t1 delete]].
(losJugadores at: playerTurn) misPaises size = 0 ifTrue: [self muerte.
self finRonda. playerTurn _ playerTurn \\ 6 + 1] ifFalse: [cartel
color: (losJugadores at: playerTurn) miColor. cartel newContents: 'Ronda '
, ronda asString , ' Turno del jugador ' , playerTurn asString. done _
false. estado _ 1. (losJugadores at: playerTurn) esHumano &
(serverOrClient = #server) ifTrue: [self sendMyData. done _ true].
ronda caseOf: { [1] -> [pone _ 5]. [2] -> [pone _ 4]. [3] ->
[pone _ 3]. [4] -> [pone _ 1]. [5] -> [pone _ 1]} otherwise:
[pone _ self cuantosEjercitos]. ronda > 5 ifTrue: [submorphs last
class == InformaCartas ifTrue: [submorphs last delete] ifFalse:
[self addMorphBack: (InformaCartas new initialize: losJugadores)]].
(losJugadores at: playerTurn) misCartas size >= 3 & (serverOrClient = #cliente)
ifTrue: [self verCartas]. (losJugadores at: playerTurn) esHumano &
(serverOrClient = #cliente) ifTrue: [self eligeEjercitos: pone jugador:
playerTurn]. (losJugadores at: playerTurn) esHumano not & (serverOrClient =
#server) ifTrue: [self maquinaPone]. [done] whileFalse: [World
doOneCycle]. ((losJugadores at: playerTurn) esHumano and: [estado =
3]) ifTrue: [self obtenerCarta]. self finRonda. serverOrClient =
#cliente ifTrue: [self sendMyData] ifFalse: [playerTurn _ playerTurn
\\ 6 + 1]. self world displayWorld]]! ! !TEGMain methodsFor: 'game
sequence'! maquinaPone | t1 t2 t3 t4 | t2 _ (losJugadores at: playerTurn)
misPaises size. t1 _ 1. [pone > 0] whileTrue: [t3 _ (losJugadores at:
playerTurn) misPaises at: t1. (submorphs at: t3) add: 1. pone _ pone -
1. t1 _ t1 + 1. t1 > t2 ifTrue: [t1 _ 1]]. ronda > 5 ifTrue: [t4 _
self atacaMaquina. t4 ifTrue: [self obtenerCarta]. self
fortificarMaquina]. done _ true! ! !TEGMain methodsFor: 'game sequence'!
muerte (losJugadores at: playerTurn) vive: false. jugadoresVivos _
jugadoresVivos - 1! ! !TEGMain methodsFor: 'game sequence'! obtenerCarta | t1
| numCarta < 45 ifTrue: [t1 _ cartasOrden at: numCarta. (losJugadores at:
playerTurn) misCartas: t1. t1 > 42 ifTrue: [self
dibujaUnaCarta2: (DrawCard new dibujaUnaCarta: t1)] ifFalse: [self
dibujaUnaCarta2: (mazo at: t1)]]. numCarta _ numCarta + 1! ! !TEGMain
methodsFor: 'game sequence'! permitido: t1 estado = 1 ifTrue:
[((losJugadores at: playerTurn) misPaises includes: t1) ifTrue: [^ true]].
estado = 2 | (estado = 3) ifTrue: [(lim includes: t1) ifTrue: [^ true]].
^ false! ! !TEGMain methodsFor: 'game sequence'! ponerEjercitos: t1 enPais: t2
ejEnPais at: t2 put: (ejEnPais at: t2) + t1! ! !TEGMain methodsFor: 'game
sequence'! suerte: t1 contra: t2 | t3 t4 t5 | cartel newContents: t1 nombre ,
' Ataca a ' , t2 nombre. cartel center: self center. cartel top: self top +
10. cartel color: (losJugadores at: playerTurn) miColor. self world
displayWorld. [t1 ejercitos > 0 and: [t2 ejercitos > 0]] whileTrue: [t3 _
0. t4 _ 0. [t3 = t4] whileTrue: [t3 _ 6 atRandom. t4 _ 6
atRandom]. t3 > t4 ifTrue: [t2 ejercitos: t2 ejercitos - 1] ifFalse:
[t1 ejercitos: t1 ejercitos - 1]]. t2 ejercitos = 0 ifTrue: [t5 _
(losJugadores at: playerTurn) miColor. t2 color: t5. (losJugadores at: t2
deQuienSoy) misPaises remove: t2 numero ifAbsent: []. t2 deQuienSoy:
playerTurn. (losJugadores at: t2 deQuienSoy) misPaises size = 0 ifTrue:
[self muerte]. t2 deQuienSoy: playerTurn. (losJugadores at: playerTurn)
misPaises: t2 numero] ifFalse: [^ false]. t1 ejercitos > 2 ifTrue: [t2
ejercitos: 2. pone _ t1 ejercitos - 2. t1 ejercitos: 0. ^ true]. pone
_ 0. ^ false. self halt! ! !TEGMain methodsFor: 'game sequence'! verCartas |
t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 | (losJugadores at: playerTurn) esHumano
ifFalse: [^ self]. t1 _ 0. t2 _ 0. t3 _ 0. t4 _ 0. t5 _ 0. t6 _ 0. t7 _
0. t4 _ 0. t8 _ false. 1 to: (losJugadores at: playerTurn) misCartas size
do: [:t11 | t10 _ (losJugadores at: playerTurn) misCartas at: t11. t10 >=
43 ifTrue: [t4 _ t4 + 1]. t9 _ ((losJugadores at: playerTurn) misCartas
at: t11) \\\ 3. t9 caseOf: { [0] -> [t1 _ t1 + 1. t5 = 0
ifTrue: [t5 _ t11. t4 _ t4 + 1] ifFalse: [self in: t10
pos1: t11 pos2: t5]]. [1] -> [t2 _ t2 + 1. t6 = 0
ifTrue: [t6 _ t11. t4 _ t4 + 1] ifFalse: [self in: t10
pos1: t11 pos2: t6]]. [2] -> [t3 _ t3 + 1. t7 = 0
ifTrue: [t7 _ t11. t4 _ t4 + 1] ifFalse: [self in: t10
pos1: t11 pos2: t7]]} otherwise: [Transcript open]]. t1 >= 3 | (t2
>= 3) | (t3 >= 3) | (t4 >= 3) ifTrue: [t8 _ true]. (losJugadores at:
playerTurn) misCartas size > 3 ifTrue: [t8 ifTrue: [self
optimizarCambio]]. t8 ifTrue: [self dibuCartas: (losJugadores at: playerTurn)
misCartas size hayCambio: t8]! ! !TEGMain methodsFor: 'initialization'!
cuantosEjercitos | t1 t2 t3 t4 t5 t6 t7 | t1 _ 0. t2 _ 0. t3 _ 0. t4 _ 0.
t5 _ 0. t6 _ 0. t7 _ 0. 1 to: 42 do: [:t8 | (submorphs at: t8) deQuienSoy
= playerTurn ifTrue: [t1 _ t1 + 1. (t8 >= 1 and: [t8 <= 4])
ifTrue: [t2 _ t2 + 1]. (t8 >= 5 and: [t8 <= 12]) ifTrue: [t3 _
t3 + 1]. (t8 >= 13 and: [t8 <= 20]) ifTrue: [t4 _ t4 + 1].
(t8 >= 21 and: [t8 <= 33]) ifTrue: [t5 _ t5 + 1]. (t8 >= 34
and: [t8 <= 37]) ifTrue: [t6 _ t6 + 1]. (t8 > 38 and: [t8 <
42]) ifTrue: [t7 _ t7 + 1]]]. t1 _ 1 + (t1 / 3) asInteger. (t2 = 4
or: [t6 = 4]) ifTrue: [t1 _ t1 + 2]. (t3 = 7 or: [t4 = 7]) ifTrue: [t1 _
t1 + 5]. t5 = 8 ifTrue: [t1 _ t1 + 7]. t7 = 5 ifTrue: [t1 _ t1 + 3]. t1 <
3 ifTrue: [t1 _ 3]. ^ t1! ! !TEGMain methodsFor: 'initialization'!
dibujaRegion2: t1 color: t2 (miRegion at: t1) color: t2! ! !TEGMain
methodsFor: 'initialization'! distribuyePaises | t1 t2 t3 t4 t5 | t2 _ 42 /
jugadoresVivos. t3 _ OrderedCollection new. [t3 size < 42] whileTrue: [(t3
includes: (t1 _ 42 atRandom)) ifFalse: [t3 add: t1]]. t4 _ 1. 1 to:
jugadoresVivos do: [:t6 | 1 to: t2 do: [:t7 | t5 _ t3 at: t4.
(losJugadores at: t6) misPaises: t5. (submorphs at: t5)
deQuienSoy: t6. t4 _ t4 + 1]]! ! !TEGMain methodsFor: 'initialization'!
elijeColor | t1 t2 t3 | t1 _ Array new: 16. t1 at: 1 put: (Color r:
1.0 g: 5000 / 65535 b: 5000 / 65535). t1 at: 2 put: (Color r:
1.0 g: 25000 / 65535 b: 5000 / 65535). t1 at: 3 put: (Color r:
1.0 g: 45000 / 65535 b: 5000 / 65535). t1 at: 4 put: (Color r:
65000 / 65535 g: 65000 / 65535 b: 25000 / 65535). t1 at: 5 put:
(Color r: 65000 / 65535 g: 65000 / 65535 b: 500 / 65535). t1 at:
6 put: (Color r: 45000 / 65535 g: 45000 / 65535 b: 500 / 65535).
t1 at: 7 put: (Color r: 25000 / 65535 g: 25000 / 65535 b: 500 /
65535). t1 at: 8 put: (Color r: 5000 / 65535 g: 65535 / 65535
b: 20000 / 65535). t1 at: 9 put: (Color r: 5000 / 65535 g: 65535 /
65535 b: 65535 / 65535). t1 at: 10 put: (Color r: 5000 / 65535
g: 45000 / 65535 b: 65535 / 65535). t1 at: 11 put: (Color r: 5000 /
65535 g: 25000 / 65535 b: 65535 / 65535). t1 at: 12 put: (Color
r: 5000 / 65535 g: 5000 / 65535 b: 65535 / 65535). t1 at: 13 put:
(Color r: 1.0 g: 5000 / 65535 b: 25000 / 65535). t1 at: 14 put:
(Color r: 1.0 g: 5000 / 65535 b: 45000 / 65535). t1 at: 15 put:
(Color r: 1.0 g: 5000 / 65535 b: 65000 / 65535). t1 at: 16 put:
(Color r: 45000 / 65535 g: 5000 / 65535 b: 65535 / 65535). t2 _
AlignmentMorph newColumn. t3 _ OrderedCollection new. 1 to: 16 do: [:t4 |
t3 add: (SimpleButtonMorph new label: 'Color '; color: (t1 at: t4);
target: self; actionSelector: #miColor:; arguments: (Array
with: (t1 at: t4)))]. t3 reverseDo: [:t5 | t2 addMorph: t5]. t2 position:
650 @ 30. self addMorph: t2. cartel _ t2! ! !TEGMain methodsFor:
'initialization'! informaCartas self halt. self addMorphBack: (InformaCartas
new initialize: losJugadores)! ! !TEGMain methodsFor: 'initialization'!
initialize | t1 t2 t3 t4 | self setFolder. (StreamingMP3Sound onFileNamed:
NewFolder pathName , FileDirectory slash , 'combat.mp3') play. super
initialize. self remoteCommServer. self extent: 750 @ 490. self color: Color
paleBlue. self borderWidth: 2. self position: 18 @ 0. self toggleStickiness.
self openInWorld. miArchivo _ FileStream readOnlyFileNamed: 'PRUEBA'.
cartasOrden _ OrderedCollection new. [cartasOrden size < 44] whileTrue:
[(cartasOrden includes: (t4 _ 44 atRandom)) ifFalse: [cartasOrden add: t4]].
losJugadores _ Array new: 6. 1 to: 6 do: [:t5 | losJugadores at: t5 put:
Jugador new initialize]. (losJugadores at: 1) esHumano: true. jugadoresVivos
_ 6. 1 to: 42 do: [:t6 | t2 _ String new. t2 _ self leerArchivo.
t3 _ OrderedCollection new. t1 _ Point readFromString: self leerArchivo.
t3 add: t1. 10 timesRepeat: [t1 _ Point readFromString: self leerArchivo.
t3 add: t1]. self addMorphBack: (PaisMorph new nombre: t2 limites: t3;
numero: t6)]. self distribuyePaises. self miColor. ronda _ 1. estado _ 1.
numCarta _ 1. playerTurn _ 1. cambiosTotales _ 0. self initialize2! !
!TEGMain methodsFor: 'initialization'! initialize2 | t1 t2 t3 t4 | limites _
#(#(1 2) #(1 3) #(2 3) #(2 4) #(3 2) #(3 4) #(3 38) #(4 3) #(4 5) #(5 6) #(5 7)
#(6 5) #(6 7) #(6 9) #(6 10) #(7 8) #(7 9) #(8 9) #(8 11) #(8 12) #(9 10) #(9
12) #(10 13) #(11 27) #(12 13) #(13 14) #(14 15) #(14 18) #(15 16) #(15 18) #(15
19) #(16 17) #(16 20) #(16 20) #(16 21) #(16 22) #(16 23) #(17 19) #(18 19) #(19
38) #(20 16) #(20 21) #(20 23) #(20 38) #(20 39) #(21 25) #(22 23) #(22 24) #(22
29) #(23 24) #(23 39) #(23 40) #(24 33) #(25 21) #(25 29) #(29 33) #(33 29) #(38
39) #(38 40) #(38 41) #(40 41) #(20 23) #(19 20) #(39 40) #(25 26) #(26 27) #(31
32) #(27 32) #(30 32) #(29 30) #(34 35) #(37 35) #(35 36) #(11 12) #(40 42) #(42
41) #(34 37) #(36 37) #(33 34) #(24 29) #(28 30) #(25 30) #(18 17) #(18 19) #(17
20) #(21 22) #(21 29) #(25 28) #(26 28) #(26 31) #(28 31) #(30 31) ). t1 _
SimpleButtonMorph new label: 'Ataque'; target: self; actionSelector:
#ataque; position: 180 @ 460; bottom: self bottom - 20. self
addMorphBack: t1. t1 _ SimpleButtonMorph new label: 'Fin Ataque'; target:
self; actionSelector: #finAtaque; position: 280 @ 460; bottom:
self bottom - 20. self addMorphBack: t1. t2 _ SimpleButtonMorph new label:
'Continuar'; target: self; actionSelector: #continue; position:
380 @ 460; bottom: self bottom - 20. self addMorphBack: t2. t3 _
SimpleButtonMorph new label: 'Fortificar'; target: self;
actionSelector: #fortificar; position: 480 @ 460; bottom: self bottom
- 20. self addMorphBack: t3. t4 _ SimpleButtonMorph new label: 'DEBUG';
target: self; actionSelector: #debug; position: 580 @ 460;
bottom: self bottom - 20. self addMorphBack: t4. done _ true. cartel _
TEGConsole default: self. cartel newContents: 'SqueakRos fight the evil '.
World displayWorldSafely. (Delay forSeconds: 5) wait. self leerCartas. self
startStepping. done _ false. self serverOrClient = #server ifTrue:
[TEGServer start] ifFalse: [TEGClient start. [activeSocket dataAvailable]
whileFalse. self askMyData]. self serverOrClient = #server ifTrue: [1
to: socketList size do: [:t5 | (losJugadores at: t5) esHumano: true]].
self makeMove! ! !TEGMain methodsFor: 'initialization'! initializeN | t1 |
cartasOrden _ OrderedCollection new. [cartasOrden size < 44] whileTrue:
[(cartasOrden includes: (t1 _ 44 atRandom)) ifFalse: [cartasOrden add: t1]].
losJugadores _ Array new: 6. 1 to: 6 do: [:t2 | losJugadores at: t2 put:
Jugador new initialize]. jugadoresVivos _ 6. serverOrClient = #server
ifTrue: [self distribuyePaises. self miColor]. ronda _ 1. estado _ 1.
numCarta _ 1. playerTurn _ 1. cambiosTotales _ 0. self initialize2! !
!TEGMain methodsFor: 'initialization'! initializeP | t1 t2 t3 t4 | self
setFolder. super initialize. self extent: 750 @ 490. self color: Color
paleBlue. self borderWidth: 2. self position: 18 @ 0. self toggleStickiness.
self openInWorld. miArchivo _ FileStream readOnlyFileNamed: 'PRUEBA'.
cartasOrden _ OrderedCollection new. [cartasOrden size < 44] whileTrue:
[(cartasOrden includes: (t4 _ 44 atRandom)) ifFalse: [cartasOrden add: t4]].
losJugadores _ Array new: 6. 1 to: 6 do: [:t5 | losJugadores at: t5 put:
Jugador new initialize]. (losJugadores at: 1) esHumano: true. jugadoresVivos
_ 6. 1 to: 42 do: [:t6 | t2 _ String new. t2 _ self leerArchivo.
t3 _ OrderedCollection new. t1 _ Point readFromString: self leerArchivo.
t3 add: t1. 10 timesRepeat: [t1 _ Point readFromString: self leerArchivo.
t3 add: t1]. self addMorphBack: (PaisMorph new nombre: t2 limites: t3;
numero: t6)]. self distribuyePaises. self miColor. ronda _ 1. estado _ 1.
numCarta _ 1. playerTurn _ 1. cambiosTotales _ 0. self initialize2! !
!TEGMain methodsFor: 'initialization'! leerArchivo | t1 t2 | t2 _ String new.
[miArchivo atEnd] whileFalse: [t1 _ miArchivo next asCharacter. t1
asciiValue = 13 ifTrue: [^ t2]. t2 _ t2 , t1 asString]! ! !TEGMain
methodsFor: 'initialization'! miColor | t1 t2 | t1 _ Color wheel: 6
saturation: 0.7 brightness: 0.9. t2 _ 1. t1 do: [:t3 | (losJugadores
at: t2) miColor: t3. t2 _ t2 + 1]. submorphs do: [:t4 | t4 color:
(losJugadores at: t4 deQuienSoy) miColor]! ! !TEGMain methodsFor:
'initialization'! miColor: t1 1 to: 6 do: [:t2 | (losJugadores at: t2)
miColor ifNil: [(losJugadores at: t2) miColor: t1. (losJugadores
at: t2) misPaises do: [:t3 | (submorphs at: t3) color: t1].
t2 = 6 ifTrue: [cartel delete. cartel _ TextMorph
borderedPrototype. cartel beAllFont: (StrikeFont familyName:
#ComicBold size: 18). cartel color: Color red. cartel newContents:
'SqueakRos fight the evil '. cartel extent: self width - 30 @ 40.
cartel center: self center. cartel top: self top + 10. self
addMorphBack: cartel. self startStepping. self makeMove]. ^
t2]]! ! !TEGMain methodsFor: 'initialization'! repeat | t1 t2 t3 | t1 _
(losJugadores at: playerTurn) misCartas size. t2 _ 1. [t2 > t1] whileFalse:
[((losJugadores at: playerTurn) misCartas at: t2) \\\ 3 = 0 ifFalse:
[t3 _ (losJugadores at: playerTurn) misCartas at: t2. (losJugadores at:
playerTurn) misCartas at: t2 put: ((losJugadores at: playerTurn)
misCartas at: t1). (losJugadores at: playerTurn) misCartas at: t1 put: t3.
t1 _ t1 - 1]. t2 _ t2 + 1]! ! !TEGMain methodsFor: 'initialization'!
verificarCambio: t1 | t2 t3 t4 t5 t6 | t3 _ 0. t4 _ 0. t5 _ 0. t2 _ t1
submorphs count: [:t7 | t7 class name = 'DrawCard' and: [t7 submorphs
first estado = true]]. t2 > 3 ifTrue: [cartel newContents: 'Tramposo '.
cartel center: t1 center. t1 addMorph: cartel]. t6 _ t1 submorphs
select: [:t7 | t7 class name = 'DrawCard' and: [t7 submorphs first estado
= true]] thenCollect: [:t8 | t8 numero \\\ 3]. t2 _ 0. t6 do: [:t9 | t9
caseOf: { [0] -> [t3 = 0 ifTrue: [t3 _ 1. t2 _ t2 + 1]].
[1] -> [t4 = 0 ifTrue: [t4 _ 1. t2 _ t2 + 1]]. [2] ->
[t5 = 0 ifTrue: [t5 _ 1. t2 _ t2 + 1]]} otherwise: [Transcript
open]]. t6 _ t1 submorphs select: [:t7 | t7 class name = 'DrawCard'
and: [t7 submorphs first estado = true]] thenCollect: [:t8 | t8 numero > 42
ifTrue: [t2 _ t2 + 1]]. t2 = 3 ifTrue: [^ true]. cartel newContents:
'Tramposo '. cartel center: t1 center. t1 addMorph: cartel! ! !TEGMain
methodsFor: 'menus'! addCustomMenuItems: t1 hand: t2 super addCustomMenuItems:
t1 hand: t2. t1 addLine. self addMenuItemsTo: t1 hand: t2! ! !TEGMain
methodsFor: 'menus'! addMenuItemsTo: t1 hand: t2 t1 add: 'new game'
target: self action: #newGame. t1 add: 'reset...' target: self action:
#reset. t1 add: 'grabar estado' target: self action: #grabaEstado. t1
add: 'leer estado' target: self action: #leerEstado. t1 add: 'debug'
target: self action: #debug! ! !TEGMain methodsFor: 'menus'! cambiaCartas: t1
| t2 t3 t4 | estado _ 4. t3 _ #(4 6 8 10 12 15 ). (losJugadores at:
playerTurn) esHumano ifTrue: [t4 _ self verificarCambio: t1] ifFalse: [t4 _
true]. t1 submorphs do: [:t5 | t5 class name = 'DrawCard' ifTrue: [t5
submorphs first estado ifTrue: [t2 _ (losJugadores at: playerTurn)
misPaises includes: t5 numero. t2 ifTrue: [(submorphs at: t5
numero) add: 2]. (losJugadores at: playerTurn) misCartas
remove: t5 numero ifAbsent: []]]]. cambiosTotales _ cambiosTotales + 1.
cambiosTotales < 7 ifTrue: [pone _ pone + t3 at: cambiosTotales] ifFalse:
[pone _ pone + 15 + 5 * (cambiosTotales - 6)]. t1 delete! ! !TEGMain
methodsFor: 'menus'! hacerListaPaises: t1 | t2 t3 | t2 _ Set new.
(losJugadores at: playerTurn) misPaises do: [:t4 | limites do: [:t5 | (t5
includes: t4) ifTrue: [t2 add: t5]]]. t3 _ t2 copy. t1 ifTrue: [t2
do: [:t6 | (((losJugadores at: playerTurn) misPaises includes: (t6 at:
1)) and: [(losJugadores at: playerTurn) misPaises includes: (t6
at: 2)]) ifTrue: [t3 remove: t6]]] ifFalse: [t2 do: [:t6 |
(((losJugadores at: playerTurn) misPaises includes: (t6 at: 1))
and: [(losJugadores at: playerTurn) misPaises includes: (t6 at: 2)])
ifFalse: [t3 remove: t6]]]. ^ t3! ! !TEGMain methodsFor: 'menus'! reset ^
self! ! !TEGMain methodsFor: 'sound effects'! soundEffects | t1 t2 | t1 _ 3
atRandom. t2 _ 'batalla' , t1 asString , '.wav'. (SampledSound
fromWaveFileNamed: t2) play! ! !TEGMain methodsFor: 'sending-receiving
objects'! askMyData | t1 t2 t3 t4 t5 t6 | t1 _ activeSocket getObject. self
losJugadores: (t1 at: 1). self cartasOrden: (t1 at: 2). self ronda: (t1
at: 3). self numCarta: (t1 at: 4). self cambiosTotales: (t1 at: 5). t2 _
t1 at: 6. 1 to: 42 do: [:t7 | t3 _ t2 at: t7. t4 _ self submorphs
at: t7. t4 ejercitos: (t3 at: 1). t4 deQuienSoy: (t3 at: 2). t5
_ t4 deQuienSoy. t6 _ (self losJugadores at: t5) miColor. t4
redrawInColor: t6]. self playerTurn: (t1 at: 7)! ! !TEGMain methodsFor:
'sending-receiving objects'! sendMyData | t1 t2 t3 t4 | serverOrClient =
#server ifTrue: [activeSocket _ socketList at: playerTurn]. (activeSocket
isValid and: [activeSocket isConnected]) ifTrue: [t1 _ OrderedCollection
new. t1 add: self losJugadores. t1 add: self cartasOrden. t1 add: self
ronda. t1 add: self numCarta. t1 add: self cambiosTotales. t2 _ Array
new: 42. 1 to: 42 do: [:t5 | t3 _ self submorphs at: t5.
t4 _ Array new: 2. t4 at: 1 put: t3 ejercitos. t4 at: 2 put: t3
deQuienSoy. t2 at: t5 put: t4]. t1 add: t2. t1 add: self playerTurn.
activeSocket sendObject: t1]. [activeSocket dataAvailable] whileFalse. self
askMyData! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! TEGMain
class instanceVariableNames: ''! !TEGMain class methodsFor: 'as yet
unclassified'! debug self maquinaPone! ! !TEGMain class methodsFor: 'as yet
unclassified'! new | t1 t2 | FileDirectory default pathParts last = 'STEG'
ifFalse: [self setFolder]. t1 _ FileStream readOnlyFileNamed: 'TEGBlank.morph'.
t2 _ t1 fileInObjectAndCode. t2 openCenteredInWorld. t2 initializeN! !
!TEGMain class methodsFor: 'as yet unclassified'! reset | t1 t2 |
FileDirectory default pathParts last = 'STEG' ifFalse: [self setFolder]. t1 _
FileStream readOnlyFileNamed: 'TEGBlank.morph'. t2 _ t1 fileInObjectAndCode.
t2 leerEstado. t2 openCenteredInWorld. t2 initialize2! ! !TEGMain class
methodsFor: 'as yet unclassified'! resetFolder FileDirectory
setDefaultDirectory: OldFolder! ! !TEGMain class methodsFor: 'as yet
unclassified'! setFolder OldFolder _ FileDirectory default pathName.
FileDirectory setDefaultDirectory: OldFolder , FileDirectory slash , 'STEG'.
NewFolder _ FileDirectory default! ! !TEGMain class methodsFor: 'as yet
unclassified'! startAsCliente | t1 t2 | FileDirectory default pathParts last =
'STEG' ifFalse: [self setFolder]. t1 _ FileStream readOnlyFileNamed:
'TEGBlank.morph'. t2 _ t1 fileInObjectAndCode. t2 openCenteredInWorld. t2
serverOrClient: #cliente. t2 initializeN! ! !TEGMain class methodsFor: 'as yet
unclassified'! startAsServer | t1 t2 | FileDirectory default pathParts last =
'STEG' ifFalse: [self setFolder]. t1 _ FileStream readOnlyFileNamed:
'TEGBlank.morph'. t2 _ t1 fileInObjectAndCode. t2 openCenteredInWorld. t2
serverOrClient: #server. t2 initializeN! ! Object subclass: #TEGServer
instanceVariableNames: 'port process ear socketList activeClient addClient
instanciaTEG maxClient ' classVariableNames: '' poolDictionaries: ''
category: 'Morphic-TEG'! !TEGServer methodsFor: 'as yet unclassified'!
addClient ^ addClient! ! !TEGServer methodsFor: 'as yet unclassified'!
addClient: t1 | t2 t3 | t2 _ NetNameResolver stringFromAddress: t1
remoteAddress. t3 _ String new. t3 _ t2 , Character tab asString , t1 getData
printString , ' joining this game...'. instanciaTEG cartel newContents: t3.
World displayWorldSafely. activeClient _ activeClient + 1. socketList at:
activeClient put: t1. activeClient = maxClient ifTrue: [instanciaTEG
socketList: self socketList]! ! !TEGServer methodsFor: 'as yet unclassified'!
newEar | t1 | t1 _ Socket tcpCreateIfFail: [self error: 'Unable to create
a socket']. t1 listenOn: port backlogSize: 6. ^ t1! ! !TEGServer methodsFor:
'as yet unclassified'! newProcess | t1 | t1 _ [self serviceLoop] newProcess.
t1 priority: self class priority. ^ t1! ! !TEGServer methodsFor: 'as yet
unclassified'! port: t1 port _ t1! ! !TEGServer methodsFor: 'as yet
unclassified'! ringLoop | t1 t2 t3 t4 t5 t6 t7 t8 | t4 _ ActiveWorld submorphs
detect: [:t9 | t9 class == TEGMain]. [true] whileTrue: [activeClient _
activeClient \\ 2 + 1. t1 _ socketList at: activeClient. (t1 isValid
and: [t1 isConnected]) ifTrue: [t4 activeSocket: t1. t6 _
OrderedCollection new. t6 add: t4 losJugadores. t6 add: t4
cartasOrden. t6 add: t4 ronda. t6 add: t4 numCarta. t6 add: t4
cambiosTotales. t7 _ Array new: 42. 1 to: 42 do: [:t10 |
t5 _ t4 submorphs at: t10. t8 _ Array new: 2. t8 at: 1 put: t5
ejercitos. t8 at: 2 put: t5 deQuienSoy. t7 at: t10 put: t8].
t6 add: t7. t1 sendObject: t6. [t1 dataAvailable] whileFalse. t4
askMyData. self halt. t3 _ NetNameResolver stringFromAddress: t1
remoteAddress. Transcript show: t3; tab. Transcript show: t2
printString; cr. self halt]]! ! !TEGServer methodsFor: 'as yet
unclassified'! serviceLoop | t1 | t1 _ nil. ear _ self newEar. [true]
whileTrue: [[t1 isNil] whileTrue: [t1 _ ear waitForAcceptUntil: Socket
standardDeadline]. t1 isConnected ifTrue: [addClient ifTrue: [self
addClient: t1]. t1 _ nil] ifFalse: [self error: 'Accepted unconnected
socket']]! ! !TEGServer methodsFor: 'as yet unclassified'! socketList ^
socketList! ! !TEGServer methodsFor: 'as yet unclassified'! start maxClient _
0. [maxClient between: 1 and: 6] whileFalse: [maxClient _ (FillInTheBlank
request: 'How many players 1 - 6') asInteger]. instanciaTEG _ ActiveWorld
submorphs detect: [:t1 | t1 class == TEGMain]. instanciaTEG cartel
newContents: 'TEGServer starting for ' , maxClient asString , ' players'. World
displayWorldSafely. socketList _ Dictionary new. activeClient _ 0. addClient
_ true. process ifNil: [Socket initializeNetwork. process _ self
newProcess. process resume] ifNotNil: [self error: 'TEG Server already
started']! ! !TEGServer methodsFor: 'as yet unclassified'! stop process
ifNotNil: [process terminate. process _ nil. ear closeAndDestroy. ear _
nil]! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! TEGServer
class instanceVariableNames: ''! !TEGServer class methodsFor: 'defaults'!
defaultPort ^ 8000! ! !TEGServer class methodsFor: 'defaults'! priority ^
Processor lowIOPriority! ! !TEGServer class methodsFor: 'defaults'! start ^
self startOn: self defaultPort! ! !TEGServer class methodsFor: 'running'!
startOn: t1 ^ self new port: t1; start! ! !TEGServer class methodsFor:
'running'! stop self allInstancesDo: [:t1 | t1 stop]! ! ImageMorph
subclass: #TEGStartButton instanceVariableNames: '' classVariableNames: ''
poolDictionaries: '' category: 'Morphic-TEG'! !TEGStartButton methodsFor:
'menu'! addMenuItemsTo: t1 hand: t2 | t3 | t3 _ MenuMorph new. t3 color:
Color blue. t3 color: (t3 color alpha: 0.5). t3 add: 'Soy server'
target: TEGMain action: #startAsServer. t3 add: 'Soy cliente ' target:
TEGMain action: #startAsCliente. t3 items do: [:t4 | t4 color: Color
yellow; font: (StrikeFont familyName: 'Comic Bold' size: 18
emphasized: 1)]. t3 invokeModal! ! !TEGStartButton methodsFor: 'event
handling'! handlesMouseDown: t1 ^ true! ! !TEGStartButton methodsFor: 'event
handling'! mouseDown: t1 | t2 | t1 yellowButtonPressed ifFalse: [^ t1 hand
waitForClicksOrDrag: self event: t1]. t2 _ MenuMorph new defaultTarget: self.
self addMenuItemsTo: t2 hand: t1 hand. t2 popUpEvent: t1 in: self world! !
Object subclass: #VNCServer instanceVariableNames: 'port process ear socketList
activeClient addClient instanciaTEG ' classVariableNames: '' poolDictionaries:
'' category: 'Morphic-TEG'! !VNCServer methodsFor: 'as yet unclassified'!
addClient: t1 | t2 t3 | t2 _ NetNameResolver stringFromAddress: t1
remoteAddress. t3 _ String new. t3 _ t2 , Character tab asString , t1 getData
printString. instanciaTEG cartel newContents: t3. activeClient _ activeClient
+ 1. socketList at: activeClient put: t1. activeClient = 2 ifTrue:
[instanciaTEG socketList: self socketList]! ! !VNCServer methodsFor: 'as yet
unclassified'! newEar | t1 | t1 _ Socket tcpCreateIfFail: [self error:
'Unable to create a socket']. t1 listenOn: port backlogSize: 6. ^ t1! !
!VNCServer methodsFor: 'as yet unclassified'! newProcess | t1 | t1 _ [self
serviceLoop] newProcess. t1 priority: self class priority. ^ t1! ! !VNCServer
methodsFor: 'as yet unclassified'! nextClient self halt! ! !VNCServer
methodsFor: 'as yet unclassified'! port: t1 port _ t1! ! !VNCServer
methodsFor: 'as yet unclassified'! ringLoop | t1 t2 t3 | [true] whileTrue:
[activeClient _ activeClient \\ 2 + 1. t1 _ socketList at: activeClient.
(t1 isValid and: [t1 isConnected]) ifTrue: [t1 sendData: 'OK'. [t1
dataAvailable] whileFalse. t2 _ t1 getData. t3 _ NetNameResolver
stringFromAddress: t1 remoteAddress. Transcript show: t3; tab.
Transcript show: t2 printString; cr]]! ! !VNCServer methodsFor: 'as yet
unclassified'! serviceLoop | t1 | t1 _ nil. ear _ self newEar. [true]
whileTrue: [[t1 isNil] whileTrue: [t1 _ ear waitForAcceptUntil: Socket
standardDeadline]. t1 isConnected ifTrue: [addClient ifTrue: [self
addClient: t1]. t1 _ nil] ifFalse: [self error: 'Accepted unconnected
socket']]! ! !VNCServer methodsFor: 'as yet unclassified'! socketList ^
socketList! ! !VNCServer methodsFor: 'as yet unclassified'! start instanciaTEG
_ ActiveWorld submorphs detect: [:t1 | t1 class == TEGMain]. instanciaTEG
cartel newContents: 'TEGServer starting...'. socketList _ Dictionary new.
activeClient _ 0. addClient _ true. process ifNil: [Socket
initializeNetwork. process _ self newProcess. process resume] ifNotNil:
[self error: 'TEG Server already started']! ! !VNCServer methodsFor: 'as yet
unclassified'! stop process terminate. process _ nil. ear closeAndDestroy.
ear _ nil! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
VNCServer class instanceVariableNames: ''! !VNCServer class methodsFor:
'defaults'! defaultPort ^ 8000! ! !VNCServer class methodsFor: 'defaults'!
priority ^ Processor lowIOPriority! ! !VNCServer class methodsFor: 'defaults'!
start Transcript open. Transcript show: 'VNCServer starting...'; cr. ^
self startOn: self defaultPort! ! !VNCServer class methodsFor: 'running'!
startOn: t1 ^ self new port: t1; start! ! !VNCServer class methodsFor:
'running'! stop self allInstancesDo: [:t1 | t1 stop]! !

Reenviar Mensaje #1451 de 3477 |
Desplegar mensajes Autor Ordenar por fecha

http://www.imdb.com/title/tt0075784/ Es el sitio donde podran ver algo sobre esta película (Alguno la vio ?) Les cuento que llegue al punto donde he...
Lic. Edgar J. De Cleene
edgardec2001
Sin conexión Enviar correo
20 de May, 2006
8:40 pm

... proceso, ... Epa! resumiste en una frase todo un thread que era mas bien un repaso de las modalidades disponibles y sus particularidades. De todos modos,...
Emilio Oca
emiliooca
Sin conexión Enviar correo
22 de May, 2006
3:08 pm

Emilio Oca puso en su mail : > Epa! resumiste en una frase todo un thread que era mas bien un repaso de las > modalidades disponibles y sus particularidades....
Lic. Edgar J. De Cleene
edgardec2001
Sin conexión Enviar correo
22 de May, 2006
6:39 pm
Avanzado

Copyright © 2009 Yahoo! de Argentina S.R.L. Todos los derechos reservados.
Política de privacidad - Condiciones del Servicio - Reglas de la comunidad de Yahoo! - Ayuda