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

Consejos

¿Sabías que...?
Podés hacer búsquedas de antiguos mensajes del grupo.

Mensajes

  Mensajes Ayuda
Avanzado
Multicast...¿como se puede hacer?   Lista de mensajes  
Responder | Reenviar Mensaje #519 de 3321 |
Re: [squeakRos] Re: Multicast...¿como se puede hacer?

On 12/01/05 16:12, "hernan_karate" <hernan_karate@...> wrote:

>
>
> Hola!! Primero gracias por responder a mi duda, segundo... te
> respondo las preguntas entre lineas ok?
>> A ver si te entiendo.
>> La máquina que esta escuchando es un server ?
> Si, además ejecutará una instancia del cliente.
>> Podrías definir mejor el problema >
> Si, basicamente es un juego, que ubica a los servidores sin tener
> idea de los nombres de los mismos (tipo counter strike). Esto explica
> por que uso UDP... si se hace con tcp debo conocer al host destino,
> en cambio con udp lo mando a la direccion de broadcast de la red y
> el / los servidor(es) capturan el datagrama y pueden responderme.
>
>> Hay ejercicios en OldSocket que yo mande a la lista como de Socket.
> Si, hemos dado de bruces contra OldSocket... con udp hemos podido
> transferir datos, pero a la hora de enviar paquetes, como bien dejas
> traslucir, seria mejor usar tcp... pero con tcp en squeak 3.7 varias
> veces hemos destrozado la vm, o salio un lindo primitive has falied
> en el acept... o en el waitForCon...For:
> De hecho
>> tengo una clase Socket levemente modificada que me resuelve todo
> tipo de
>> problemas.
> Podrias mandarnosla?
>> Porque udp ?
> (Udp solo lo usamos para buscar otras maquinas, la transmision
> efectiva de los datos seria por tcp)
>> Los niveles de complejidad son.
>> Socket para transmiitir bytes, texto u objetos (tal como en el TEG)
> pero
>> usando tcp.
>> TcpService para conexiones mas seguras y servicios
>> Komanche y sus derivados para armar swikis y otras cosas.
>> HttpView 2 para aplicaciones web livianas.
>> Seaside para aplicaciones web complejas.
> Digamos que querriamos hacer nuestro propio framework... estamos en
> problemas no?
>
> Muchas gracias por tu tiempo. Hasta luego

Clarísimo , lástima que estamos en vacaciones y el laboratorio está cerrado,
para probar en una red real.
Haata ahora siempre trabaje con tcp, conociendo o los IP o los nombres .

De todas maneras, te mando lo que vengo usando hace mucho tiempo sin
problemas, es el .cs del TEG que te puede dar un monton de ideas de como
implementar un server, mandar objetos por la red, etc.
Las modificaciones a Socket estan incluidas.
Creo que en los archivos hay un STEG.zip con los dibujos necesarios.
Tengo versiones en las que uso TcpService, si te hacen falta las mando.
Voy a buscar en los backup lo que se haya comentado de udp, me interesa
cualquier experimento que hagas (aunque no ande).
Te comento que tengo Mac, pero todas las pruebas han funcionado sin
problemas en la UTN con Windows 2000.
Este año creo que hare tambien experimentos con Linux, por lo que cuando los
tenga mandare mail a SqueakRos.

Como dice el amigo español, nos leemos.

Edgar



Jue, 13 de Ene, 2005 12:41 pm

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

'From Squeak3.7 of ''4 September 2004'' [latest update: #5988] on 29 October
2004 at 7:32:06 am'! "Change Set: TEG Date: 20 October 2004 Author: Edgar
J. De Cleene This is a experiment on packaging a game in .sar format" !
Object subclass: #Jugador instanceVariableNames: 'vive esHumano misPaises
misCartas miColor' classVariableNames: '' poolDictionaries: '' category:
'Morphic-TEG'! Morph subclass: #DrawCard instanceVariableNames: 'nombre
deQuienSoy numero' classVariableNames: '' poolDictionaries: '' category:
'Morphic-TEG'! IconicButton subclass: #DrawPicture instanceVariableNames:
'estado valor' classVariableNames: 'MisDibujos' poolDictionaries: ''
category: 'Morphic-TEG'! Morph subclass: #InformaCartas instanceVariableNames:
'' classVariableNames: '' poolDictionaries: '' category: 'Morphic-TEG'!
PolygonMorph subclass: #PaisMorph instanceVariableNames: 'nombre ejEnPais
deQuienSoy instanciaTEG numero misLimites' classVariableNames: ''
poolDictionaries: '' category: 'Morphic-TEG'! Object subclass: #TEGClient
instanceVariableNames: 'socket serverName instanciaTEG' classVariableNames: ''
poolDictionaries: '' category: 'Morphic-TEG'! TextMorph subclass: #TEGConsole
instanceVariableNames: '' classVariableNames: '' poolDictionaries: ''
category: 'Morphic-TEG'! BorderedMorph subclass: #TEGMain
instanceVariableNames: 'cartasOrden losJugadores jugadoresVivos cartel pone
cambiosTotales playerTurn ronda limites done lim estado numCarta mazo
activeSocket serverOrClient socketList' classVariableNames: 'NewFolder'
poolDictionaries: '' category: 'Morphic-TEG'! Object subclass: #TEGServer
instanceVariableNames: 'port process ear socketList activeClient addClient
instanciaTEG maxClient' classVariableNames: '' poolDictionaries: '' category:
'Morphic-TEG'! ImageMorph subclass: #TEGStartButton instanceVariableNames: ''
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! ! !Morph methodsFor:
'submorphs-accessing' stamp: 'edc 10/21/2004 12:04'! allSubmorphOfClass: aClass
^self submorphs select: [:p | p isKindOf: aClass] thenCollect:[ :any| any].! !
!DrawCard methodsFor: 'initialization' stamp: 'edc 10/19/2004 09:05'!
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.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 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! ! !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' 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
10/19/2004 09:06'! initializeWith: t1 valor: t2 rect: t3 | t4 | valor _ t2.
self estado: false. t4 _MisDibujos at: 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! !
!DrawPicture class methodsFor: 'objects from disk' stamp: 'edc 10/19/2004
09:16'! inicializarDibujos | path | path _ FileDirectory default pathName ,
FileDirectory slash , 'STEG',FileDirectory slash. MisDibujos _ Dictionary new.
MisDibujos at: #Soldado1 put: (Form fromFileNamed: path,'Soldado1.gif').
MisDibujos at: #Soldado5 put: (Form fromFileNamed: path,'Soldado5.gif').
MisDibujos at: #Soldado10 put: (Form fromFileNamed: path,'Soldado10.gif').
MisDibujos at: #Soldado20 put: (Form fromFileNamed: path,'Soldado10.gif').
MisDibujos at: #Soldado50 put: (Form fromFileNamed: path,'Soldado50.gif').
MisDibujos at: #Ok put: (Form fromFileNamed: path,'OK.gif'). MisDibujos at:
#Cancel put: (Form fromFileNamed:path, 'Cancel.gif'). MisDibujos at: #Muerte
put: (Form fromFileNamed: path,'muerte.gif'). MisDibujos at: #Split put: (Form
fromFileNamed: path,'Split.gif'). MisDibujos at: #Caballo put: (Form
fromFileNamed: path,'Caballo.gif'). MisDibujos at: #Canon put: (Form
fromFileNamed: path,'Canon.gif'). MisDibujos at: #CardsDLOG put: (Form
fromFileNamed: path,'CardsDLOG.gif'). ! ! !InformaCartas methodsFor:
'initialization' stamp: 'edc 10/19/2004 09:14'! 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 valor: 0 pos: t8 topLeft. self addMorph: t11].
t4 _ t4 + t3. t5 _ t5 + t3. t6 _ t6 + t3. t7 _ t7 + t3]. self
openInWorld! ! !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' stamp:
'edc 10/8/2004 10:44'! 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 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]! ! !PaisMorph methodsFor: 'as yet unclassified' stamp:
'edc 10/26/2004 08:18'! reset self color: Color white. self deQuienSoy: 0. self
ejercitos: 0.! ! !Socket methodsFor: 'receiving' stamp: 'edc 2/15/2004 09:17'!
getData | t1 t2 | (self waitForDataUntil: Socket standardDeadline) ifFalse:
[self error: 'getData timeout']. t1 _ String new: 4000. t2 _ self
primSocket: socketHandle receiveDataInto: t1 startingAt: 1 count: t1
size. ^ t1 copyFrom: 1 to: t2! ! !Socket methodsFor: 'waiting' stamp: 'edc
4/12/2004 08:52'! waitForAcceptUntil: deadLine "Wait and accept an incoming
connection" self waitForConnectionUntil: deadLine. ^ self isConnected
ifTrue: [self accept]! ! !Socket methodsFor: 'waiting' stamp: 'jm 3/2/98
18:15'! waitForConnectionUntil: deadline "Wait up until the given deadline for
a connection to be established. Return true if it is established by the
deadline, false if not." | status | status _ self primSocketConnectionStatus:
socketHandle. [(status = WaitingForConnection) and: [Time millisecondClockValue
< deadline]] whileTrue: [ semaphore waitTimeoutMSecs: (deadline - Time
millisecondClockValue). status _ self primSocketConnectionStatus:
socketHandle]. ^ status = Connected! ! !Socket methodsFor: 'waiting' stamp:
'edc 2/15/2004 09:19'! waitForDataUntil: deadline "Wait up until the given
deadline for data to arrive. Return true if data arrives by the deadline,
false if not." | dataArrived | [self isConnected & (dataArrived := self
primSocketReceiveDataAvailable: socketHandle) not and: ["Connection end and
final data can happen fast, so test in this order " Time
millisecondClockValue < deadline]] whileTrue: [self readSemaphore
waitTimeoutMSecs: deadline - Time millisecondClockValue]. ^ dataArrived! !
!Socket methodsFor: 'waiting' stamp: 'edc 10/5/2004 11:44'!
waitForDisconnectionUntil: deadline "Wait up until the given deadline for the
the connection to be broken. Return true if it is broken by the deadline, false
if not." "Note: The client should know the the connect is really going to be
closed (e.g., because he has called 'close' to send a close request to the other
end) before calling this method. JMM 00/5/17 note that other end can close which
will terminate wait" | extraBytes status | extraBytes := 0. status := self
primSocketConnectionStatus: socketHandle. [((status = Connected) or: [(status =
ThisEndClosed)]) and: [Time millisecondClockValue < deadline]] whileTrue: [
self dataAvailable ifTrue: [extraBytes := extraBytes + self
discardReceivedData]. semaphore waitTimeoutMSecs: (deadline - Time
millisecondClockValue). status := self primSocketConnectionStatus:
socketHandle]. extraBytes > 0 ifTrue: [self inform: 'Discarded ', extraBytes
printString, ' bytes while closing connection.']. ^ status ~= Connected ! !
!Socket methodsFor: 'waiting' stamp: 'edc 10/5/2004 11:42'!
waitForSendDoneUntil: deadline "Wait up until the given deadline for the
current send operation to complete. Return true if it completes by the deadline,
false if not." | sendDone | [self isConnected & (sendDone := self
primSocketSendDone: socketHandle) not "Connection end and final data can
happen fast, so test in this order" and: [Time millisecondClockValue <
deadline]] whileTrue: [ self writeSemaphore waitTimeoutMSecs: (deadline -
Time millisecondClockValue)]. ^ sendDone! ! !Socket methodsFor:
'sending-receiving objects' stamp: 'dgd 2/22/2002 20:28'! getObject "gets a
serialized object from this socket" | encoded object | encoded _ String new
writeStream. [encoded size isZero] whileTrue: [encoded nextPutAll: self
getData]. [self isConnected and: [self dataAvailable]] whileTrue: [encoded
nextPutAll: self getData]. object _ ReferenceStream unStream: encoded contents.
^ object! ! !Socket methodsFor: 'sending-receiving objects' stamp: 'dgd
2/22/2002 20:28'! sendObject: anObject "sends a serialized object to this
socket" | encoded | encoded _ ReferenceStream streamedRepresentationOf:
anObject. self sendData: encoded! ! !Socket class methodsFor:
'remoteExamples' stamp: 'edc 2/15/2004 10:53'! remoteCommClient | newSocket
objRec command serverName | Transcript open. Transcript show: 'starting remote
comm test'; cr. Transcript show: 'initializing network ... '. Socket
initializeNetwork. Transcript show: 'ok'; cr. serverName := '169.254.6.4'.
command := FillInTheBlank request: 'Type remote image command' initialAnswer:
''. newSocket := Socket newTCP. newSocket connectTo: (NetNameResolver
addressForName: serverName) port: 8000. newSocket waitForConnectionUntil:
Socket standardDeadline. Transcript show: 'server start to perform
instructions'; cr. [command = 'FIN'] whileFalse: [Transcript show:
'Command sended is ' , command; cr. newSocket sendObject: command.
newSocket waitForConnectionUntil: (Socket deadlineSecs: 60). [newSocket
isConnected] whileTrue: [newSocket dataAvailable ifTrue: [newSocket
dataAvailable ifTrue: [objRec := newSocket getObject.
Transcript show: 'Resoonse is ' , objRec printString; cr.
command := FillInTheBlank request: 'Type remote image command' initialAnswer:
'']]]]. newSocket closeAndDestroy! ! !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! ! !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! ! !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' stamp: 'edc
10/19/2004 17:04'! cartel: anObject cartel _ 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'! 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'! numCarta ^ numCarta! ! !TEGMain
methodsFor: 'accessing'! numCarta: t1 numCarta _ t1! ! !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' stamp: 'edc 10/6/2004
16:25'! socketList: aDictionary socketList := aDictionary. done := true. ! !
!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'! 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'! 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 6/27/2002 16:06'!
atacaMaquina | maxValue maxElement val reagrupa pasan paisAcacado paisAcacante
atacarA quedan listaLimpia | listaLimpia _ self hacerListaPaises: true.
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 _ (submorphs at: paisAcacante) ejercitos - (submorphs at: paisAcacado)
ejercitos. maxElement _ paisAcacante] ifFalse: [(val _ (submorphs at:
paisAcacante) ejercitos - (submorphs at: paisAcacado) ejercitos) > maxValue
ifTrue: [maxElement _ paisAcacante. atacarA _ paisAcacado.
maxValue _ val]]]. atacarA ifNil: [^ false]. paisAcacado _ atacarA.
paisAcacante _ maxElement. reagrupa _ self suerte: (submorphs at:
paisAcacante) contra: (submorphs at: paisAcacado). reagrupa ifTrue: [pone
> 2 ifTrue: [pasan _ (pone - 2 / 2) asInteger. quedan _ pone - pasan.
(submorphs at: paisAcacante) add: quedan. (submorphs at: paisAcacado)
add: pasan. (submorphs at: paisAcacado) deQuienSoy: playerTurn.
^ true] ifFalse: [^ false]] ifFalse: [^ 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' 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]]! ]style[(33 1334 44
423)f2b,f2,f2cred;,f2! ! !TEGMain methodsFor: 'game sequence' stamp: 'EDC
6/19/2002 09:38'! dibujaUnaCarta2: cardDialog | p t tiempo | 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 10/19/2004 16:30'! eligeEjercitos:
aInteger jugador: j | s50 s20 s10 s5 s1 posIcon nEjRec ejercitos batallones l
r | 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 | posIcon _
posIcon + 1. self addMorphBack: (DrawPicture new
initializeWith: #Soldado1 valor: 1 rect: (ejercitos at: i)).
nEjRec at: i put: 1]]. s5 > 0 ifTrue: [posIcon to: s5 + posIcon - 1
do: [:i | posIcon _ posIcon + 1. self addMorphBack:
(DrawPicture new initializeWith: #Soldado5 valor: 5
rect: (ejercitos at: i)). nEjRec at: i put: 5]]. s10 > 0 ifTrue:
[posIcon to: s10 + posIcon - 1 do: [:i | posIcon _ posIcon + 1.
self addMorphBack: (DrawPicture new initializeWith: #Soldado10
valor: 10 rect: (ejercitos at: i)). nEjRec at: i put: 10]]. s20 >
0 ifTrue: [posIcon to: s20 + posIcon - 1 do: [:i | posIcon _
posIcon + 1. self addMorphBack: (DrawPicture new
initializeWith: #Soldado20 valor: 20 rect: (ejercitos at: i)).
nEjRec at: i put: 20]]. s50 > 0 ifTrue: [posIcon to: s50 + posIcon - 1
do: [:i | posIcon _ posIcon + 1. self addMorphBack:
(DrawPicture new initializeWith: #Soldado50 valor: 50
rect: (ejercitos at: i)). nEjRec at: i put: 50]]. (nEjRec at: 9) = 0
ifTrue: [self addMorphBack: (DrawPicture new initializeWith: #Split
valor: 0 rect: (ejercitos at: 9); 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'!
finRonda playerTurn = 6 ifTrue: [ronda _ ronda + 1]! ! !TEGMain methodsFor:
'game sequence' stamp: 'EDC 6/27/2002 15:39'! fortificar | p1 paisOrigen
paisDestino aString | estado _ 2. "Estado dos corresponde al ataque" Cursor
crossHair showWhile: [[Sensor anyButtonPressed] whileFalse: [self
currentWorld displayWorldSafely; runStepMethods]. p1 _ Sensor cursorPoint].
paisOrigen _ submorphs detect: [:pais | pais containsPoint: p1].
((losJugadores at: playerTurn) misPaises includes: paisOrigen numero) ifFalse:
[^ self]. aString _ paisOrigen nombre. PopUpMenu confirm: aString. Cursor
crossHair showWhile: [[Sensor anyButtonPressed] whileFalse: [self
currentWorld displayWorldSafely; runStepMethods]. p1 _ Sensor cursorPoint].
paisDestino _ submorphs detect: [:pais | pais containsPoint: p1].
((losJugadores at: playerTurn) misPaises includes: paisDestino numero)
ifFalse: [self halt]. 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: [PopUpMenu inform: 'No son limitrofes'. ^
false]]. pone _ paisOrigen ejercitos - 1. paisOrigen ejercitos: 1. self
eligeEjercitos: pone jugador: playerTurn. ! ! !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 6/29/2002
08:21'! hacerLimites | otroLimites | 1 to: 42 do: [:pais | otroLimites
_ limites select: [:each | each includes: pais] thenCollect: [:each2
| (each2 at: 2) ~= pais ifTrue: [each2 at: 2] ifFalse:
[each2 at: 1]]. (submorphs at: pais) misLimites: otroLimites]. 1
to: 42 do: [:pais2 | (submorphs at: pais2) 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' stamp: 'edc 10/19/2004
17:23'! 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). submorphs
last right: self right - 30]]. (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' stamp: 'edc 10/8/2004 10:50'! 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'
stamp: 'edc 10/19/2004 09:29'! suerte: paisAtacante contra: paisAcacado |
dadoAtaque dadoDefensa elColor | cartel newContents: paisAtacante nombre , '
Ataca a ' , paisAcacado nombre. cartel center: self center. cartel top: self
top + 10. cartel color: (losJugadores at: playerTurn) miColor. (Delay
forSeconds: 1) wait. self world displayWorld. [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 7/1/2002 08:34'! cuantosEjercitos |
sumEj sudAmerica norteAmerica europa asia oceania africa | self. sumEj _ 0.
sudAmerica _ 0. norteAmerica _ 0. europa _ 0. asia _ 0. oceania _ 0. africa
_ 0. 1 to: 42 do: [:e | (submorphs at: e) deQuienSoy = playerTurn
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 10/8/2004
09:54'! cuantosHumanos: aInteger 1 to: aInteger do: [:i| (losJugadores at:
i) esHumano: true ]. ! ! !TEGMain methodsFor: 'initialization' stamp: 'EDC
6/10/2002 07:06'! distribuyePaises | randomNumber cantPaises ordendePaises
totalPaises cualPais | 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. (submorphs at:
cualPais) deQuienSoy: elJugador. totalPaises _ totalPaises + 1]]! !
!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' stamp: 'edc 10/26/2004 09:12'! initialize2 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) ). done := true.
self cartel: (TEGConsole default: self). World displayWorldSafely. self stop.
(Delay forSeconds: 5) wait. self leerCartas. self startStepping. done :=
false. self serverOrClient = #server ifTrue: [TEGServer start] ifFalse:
[TEGClient new. [activeSocket dataAvailable] whileFalse. self askMyData.
done := true]. [done] whileFalse. self makeMove! ! !TEGMain methodsFor:
'initialization' stamp: 'edc 10/26/2004 09:11'! 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'! 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 10/19/2004 16:22'! 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: [(StreamingMP3Sound onFileNamed:
NewFolder pathName , FileDirectory slash , 'tramposo.mp3') play. 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 methodsFor: 'menus' stamp: 'edc 10/26/2004 08:20'! reset self
submorphsDo: [:p | (p isKindOf: PaisMorph) ifTrue:[ p reset]]. self halt.
self initializeN! ! !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 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'! 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' stamp: 'edc
10/21/2004 11:39'! start ^ ActiveWorld submorphs detect: [:t1 | t1 class ==
TEGMain].! ! !TEGMain class methodsFor: 'as yet unclassified' stamp: 'edc
10/21/2004 11:40'! startAsCliente | instanciaTEG | instanciaTEG _ self start.
instanciaTEG serverOrClient: #cliente. instanciaTEG initializeN! ! !TEGMain
class methodsFor: 'as yet unclassified' stamp: 'edc 10/21/2004 11:41'!
startAsServer | instanciaTEG | instanciaTEG _ self start. instanciaTEG
serverOrClient: #server. instanciaTEG initializeN ! ! !TEGServer methodsFor:
'as yet unclassified' stamp: 'edc 10/8/2004 09:42'! addClient: socket |
iPAddress s | iPAddress := NetNameResolver stringFromAddress: socket
remoteAddress. s := String new. s := iPAddress , Character tab asString ,
socket getData printString , ' joining this game...'. instanciaTEG cartel
newContents: s. World displayWorldSafely. activeClient := activeClient + 1.
socketList at: activeClient put: socket. activeClient < maxClient ifFalse: [
instanciaTEG cuantosHumanos: activeClient. 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' stamp: 'edc 10/18/2004 17:17'! newProcess | p | p _ [self
serviceLoop] newProcess. p priority: self class priority. ^ p! ! !TEGServer
methodsFor: 'as yet unclassified'! port: t1 port _ t1! ! !TEGServer
methodsFor: 'as yet unclassified' stamp: 'edc 10/4/2004 17:08'! serviceLoop |
conn | conn _ nil. ear _ self newEar. [true] whileTrue: [[conn isNil]
whileTrue: [conn _ ear waitForAcceptUntil: Socket standardDeadline]. conn
isConnected ifTrue: [activeClient = maxClient ifFalse: [self
addClient: conn]. conn _ nil] ifFalse: [self error: 'Accepted
unconnected socket']]! ! !TEGServer methodsFor: 'as yet unclassified'!
socketList ^ socketList! ! !TEGServer methodsFor: 'as yet unclassified' stamp:
'edc 10/19/2004 07:14'! start | | maxClient := 0. [maxClient between: 1 and:
5] whileFalse: [maxClient := (FillInTheBlank request: 'How many players 1 -
5') 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. 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 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]! !
!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!
! TEGMain class removeSelector: #resetFolder! TEGMain class removeSelector:
#setFolder! TEGMain removeSelector: #activeSocket! TEGMain removeSelector:
#dibujaRegion2:color:! TEGMain removeSelector: #elijeColor! TEGMain
removeSelector: #in:pos1:pos2:! TEGMain removeSelector: #informaCartas! TEGMain
removeSelector: #initializeP! TEGMain removeSelector: #lim! TEGMain
removeSelector: #lim:! TEGMain removeSelector: #maximo:! TEGMain removeSelector:
#miArchivo! TEGMain removeSelector: #miArchivo:! TEGMain removeSelector:
#minimo:! TEGMain removeSelector: #paises:! TEGMain removeSelector:
#ponerEjercitos:enPais:! TEGMain removeSelector: #repeat! "Postscript: Leave the
line above, and replace the rest of this comment by a useful one. Executable
statements should follow this comment, and should be separated by periods, with
no exclamation points (!!). Be sure to put any further comments in
double-quotes, like this one." | fd path oldFolder newFolderPath pos
relativeName b t|
fd _ FileDirectory default. (fd directoryExists: 'STEG') ifFalse:[fd
createDirectory: 'STEG'].
path _ fd pathName, FileDirectory slash ,'STEG', FileDirectory slash . (self
memberNames) do: [ :aFile| (aFile beginsWith: 'STEG') ifTrue:[ pos _ aFile
findString: '/'. relativeName _ aFile copyFrom: pos + 1 to: aFile size.
relativeName _ 'STEG/' , relativeName. self extractMember: aFile
toFileNamed: relativeName ]] . oldFolder := FileDirectory default.
newFolderPath := oldFolder pathName,FileDirectory slash,'STEG'. FileDirectory
setDefaultDirectory: newFolderPath. b _ self fileInMorphsNamed:
'STEG/TEGStartButton.morph' addToWorld: true. t _ self fileInMorphsNamed:
'STEG/TEGBlank.morph' addToWorld: true. b show. b position: 20@20. t show. t
center: World center. FileDirectory setDefaultDirectory: oldFolder pathName.
DrawPicture inicializarDibujos.!

Reenviar Mensaje #519 de 3321 |
Desplegar mensajes Autor Ordenar por fecha

Hola lista soy Hernan, un nuevo miembro. Escribo este mail porque necesito hacer un multicast en squeak. La idea es la siguiente: conectarme con udp a una...
hernan_karate
Sin conexión Enviar correo
5 de Ene, 2005
2:48 pm

... A ver si te entiendo. La máquina que esta escuchando es un server ? Podrías definir mejor el problema > Hay ejercicios en OldSocket que yo mande a la...
Lic. Edgar J. De Cleene
edgardec2001
Sin conexión Enviar correo
6 de Ene, 2005
9:17 am

Hola!! Primero gracias por responder a mi duda, segundo... te respondo las preguntas entre lineas ok? ... Si, además ejecutará una instancia del cliente. ......
hernan_karate
Sin conexión Enviar correo
12 de Ene, 2005
7:41 pm

On 12/01/05 16:12, "hernan_karate" <hernan_karate@...> wrote: > > > Hola!! Primero gracias por responder a mi duda, segundo... te > respondo las...
Lic. Edgar J. De Cleene
edgardec2001
Sin conexión Enviar correo
14 de Ene, 2005
12:43 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