Skip to content
This repository was archived by the owner on Jun 26, 2024. It is now read-only.

Commit 622d48d

Browse files
committed
Ada has changed her name :)
1 parent 8e94a47 commit 622d48d

File tree

9 files changed

+58
-58
lines changed

9 files changed

+58
-58
lines changed

java/src/main/java/SafeSpaces.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import java.util.Arrays;
22

33
/**
4-
* A class to help us find safe locations for Alex
4+
* A class to help us find safe locations for Ada
55
*/
66
class SafeSpaces {
77

@@ -20,28 +20,28 @@ int[][] convertCoordinates(String[] alphanumericCoordinates){
2020

2121
/**
2222
* This method should take a two-dimensional, zero-based representation of coordinates for the agents locations and
23-
* find the safest places for Alex in a two-dimensional, zero-based representation of coordinates
23+
* find the safest places for Ada in a two-dimensional, zero-based representation of coordinates
2424
*
2525
* @see SafeSpaces#convertCoordinates(String[]) for the two-dimensional, zero-based representation of coordinates
2626
* @param agentCoordinates a two-dimensional, zero-based representation of coordinates for the agents locations
27-
* @return a two-dimensional, zero-based representation of coordinates for the safest places for alex
27+
* @return a two-dimensional, zero-based representation of coordinates for the safest places for ada
2828
*/
2929
int[][] findSafeSpaces(int[][] agentCoordinates){
3030
return null;
3131
}
3232

3333
/**
34-
* This method should take an array of alphanumeric agent locations and offer advice to Alex for where she
34+
* This method should take an array of alphanumeric agent locations and offer advice to Ada for where she
3535
* should hide out in the city, with special advice for edge cases
3636
* @param alphanumericCoordinates (e.g. ["A5", "B1"])
37-
* @return SearchResult with the proper information for Alex
37+
* @return SearchResult with the proper information for Ada
3838
*/
39-
SearchResult adviceForAlex(String[] alphanumericCoordinates){
39+
SearchResult adviceForAda(String[] alphanumericCoordinates){
4040
return null;
4141
}
4242

4343
/**
44-
* Class that contains advice for Alex
44+
* Class that contains advice for Ada
4545
* In general the safeLocations array should be filled
4646
* However there edgecases to be taken into account (e.g. no safe locations or only safe locations) which would
4747
* only require a message

java/src/test/java/SafeSpacesTest.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ public void testAgentsEverywhere(){
140140
"H1", "H2", "H3", "H4", "H5", "H6", "H7", "H8", "H9", "H10",
141141
"I1", "I2", "I3", "I4", "I5", "I6", "I7", "I8", "I9", "I10",
142142
"J1", "J2", "J3", "J4", "J5", "J6", "J7", "J8", "J9", "J10"};
143-
SafeSpaces.SearchResult searchResult = objectUnderTest.adviceForAlex(agents);
144-
assertEquals("There are no safe locations for Alex! :-(",
143+
SafeSpaces.SearchResult searchResult = objectUnderTest.adviceForAda(agents);
144+
assertEquals("There are no safe locations for Ada! :-(",
145145
searchResult.toString());
146146
}
147147

@@ -152,7 +152,7 @@ public void testAgentsEverywhere(){
152152
@Ignore
153153
public void testAdviceRound1(){
154154
String[] agents = {"B2", "D6", "E9", "H4", "H9", "J2"};
155-
SafeSpaces.SearchResult searchResult = objectUnderTest.adviceForAlex(agents);
155+
SafeSpaces.SearchResult searchResult = objectUnderTest.adviceForAda(agents);
156156
assertEquals(Arrays.toString(new String[]{"A10", "A8", "F1"}),
157157
searchResult.toString());
158158
}
@@ -164,7 +164,7 @@ public void testAdviceRound1(){
164164
@Ignore
165165
public void testAdviceRound2(){
166166
String[] agents = {"B4", "C4", "C8", "E2", "F10", "H1", "J6"};
167-
SafeSpaces.SearchResult searchResult = objectUnderTest.adviceForAlex(agents);
167+
SafeSpaces.SearchResult searchResult = objectUnderTest.adviceForAda(agents);
168168
assertEquals(Arrays.toString(new String[]{"A1", "A10", "E6", "F5", "F6", "G4", "G5","G7", "H8", "I9", "J10"}),
169169
searchResult.toString());
170170
}
@@ -176,7 +176,7 @@ public void testAdviceRound2(){
176176
@Ignore
177177
public void testAdviceRound3(){
178178
String[] agents = {"A1", "A10", "B6", "F2", "J1", "J10"};
179-
SafeSpaces.SearchResult searchResult = objectUnderTest.adviceForAlex(agents);
179+
SafeSpaces.SearchResult searchResult = objectUnderTest.adviceForAda(agents);
180180
assertEquals(Arrays.toString(new String[]{"F8", "G7", "H6"}),
181181
searchResult.toString());
182182
}
@@ -188,7 +188,7 @@ public void testAdviceRound3(){
188188
@Ignore
189189
public void testAdviceRound4(){
190190
String[] agents = {"A1"};
191-
SafeSpaces.SearchResult searchResult = objectUnderTest.adviceForAlex(agents);
191+
SafeSpaces.SearchResult searchResult = objectUnderTest.adviceForAda(agents);
192192
assertEquals(Arrays.toString(new String[]{"J10"}),
193193
searchResult.toString());
194194
}
@@ -200,8 +200,8 @@ public void testAdviceRound4(){
200200
@Ignore
201201
public void testAgentOutsideMap(){
202202
String[] agents = {"A12"};
203-
SafeSpaces.SearchResult searchResult = objectUnderTest.adviceForAlex(agents);
204-
assertEquals("The whole city is safe for Alex! :-)",
203+
SafeSpaces.SearchResult searchResult = objectUnderTest.adviceForAda(agents);
204+
assertEquals("The whole city is safe for Ada! :-)",
205205
searchResult.toString());
206206
}
207207

javascript/src/savePlaces.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ const findSafePlaces = (agents) => {
77
return "findSafePlaces"
88
}
99

10-
const adviceForAlex = (agents) => {
11-
return "adviceForAlex"
10+
const adviceForAda = (agents) => {
11+
return "adviceForAda"
1212
}
1313

1414
module.exports = {
1515
convertCoordinates,
1616
findSafePlaces,
17-
adviceForAlex
17+
adviceForAda
1818
}

javascript/test/savePlaces.test.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { convertCoordinates, findSafePlaces, adviceForAlex } = require('../src/savePlaces')
1+
const { convertCoordinates, findSafePlaces, adviceForAda } = require('../src/savePlaces')
22

33
// Please enable Level 1, 2, 3-Tests by replacing xdescribe with describe!
44
// Do not edit the tests itself!
@@ -41,10 +41,10 @@ xdescribe('Spy Places Level 2 - find save places', () => {
4141
})
4242
})
4343

44-
xdescribe('Spy Places Level 3 - find edge cases and give advice to Alex', () => {
44+
xdescribe('Spy Places Level 3 - find edge cases and give advice to Ada', () => {
4545
it('should be replaced with a descriptive message', () => {
4646
const agents = []
47-
expect(adviceForAlex(agents)).toEqual('The whole city is safe for Alex! :-)')
47+
expect(adviceForAda(agents)).toEqual('The whole city is safe for Ada! :-)')
4848
})
4949
it('no place is save if agents are everywhere', () => {
5050
const agents =
@@ -59,31 +59,31 @@ xdescribe('Spy Places Level 3 - find edge cases and give advice to Alex', () =>
5959
'I1', 'I2', 'I3', 'I4', 'I5', 'I6', 'I7', 'I8', 'I9', 'I10',
6060
'J1', 'J2', 'J3', 'J4', 'J5', 'J6', 'J7', 'J8', 'J9', 'J10']
6161

62-
expect(adviceForAlex(agents)).toEqual('There are no safe locations for Alex! :-(')
62+
expect(adviceForAda(agents)).toEqual('There are no safe locations for Ada! :-(')
6363
})
6464

6565
it('some places are save if agents are some', () => {
6666
const agents = ['B2', 'D6', 'E9', 'H4', 'H9', 'J2']
67-
expect(adviceForAlex(agents).length).toEqual(3)
68-
expect(adviceForAlex(agents)).toEqual(expect.arrayContaining(['A10', 'A8', 'F1']))
67+
expect(adviceForAda(agents).length).toEqual(3)
68+
expect(adviceForAda(agents)).toEqual(expect.arrayContaining(['A10', 'A8', 'F1']))
6969
})
7070
it('some places are save if agents are some', () => {
7171
const agents = ['B4', 'C4', 'C8', 'E2', 'F10', 'H1', 'J6']
72-
expect(adviceForAlex(agents).length).toEqual(11)
73-
expect(adviceForAlex(agents)).toEqual(expect.arrayContaining(['A1', 'A10', 'E6', 'F5', 'F6', 'G4', 'G5', 'G7', 'H8', 'I9', 'J10']))
72+
expect(adviceForAda(agents).length).toEqual(11)
73+
expect(adviceForAda(agents)).toEqual(expect.arrayContaining(['A1', 'A10', 'E6', 'F5', 'F6', 'G4', 'G5', 'G7', 'H8', 'I9', 'J10']))
7474
})
7575
it('some places are save if agents are some', () => {
7676
const agents = ['A1', 'A10', 'B6', 'F2', 'J1', 'J10']
77-
expect(adviceForAlex(agents).length).toEqual(3)
78-
expect(adviceForAlex(agents)).toEqual(expect.arrayContaining(['F8', 'G7', 'H6']))
77+
expect(adviceForAda(agents).length).toEqual(3)
78+
expect(adviceForAda(agents)).toEqual(expect.arrayContaining(['F8', 'G7', 'H6']))
7979
})
8080
it('one save place', () => {
8181
const agents = ['A1']
82-
expect(adviceForAlex(agents).length).toEqual(1)
83-
expect(adviceForAlex(agents)).toEqual(expect.arrayContaining(['J10']))
82+
expect(adviceForAda(agents).length).toEqual(1)
83+
expect(adviceForAda(agents)).toEqual(expect.arrayContaining(['J10']))
8484
})
8585
it('agent outside the city', () => {
8686
const agents = ['A12']
87-
expect(adviceForAlex(agents)).toEqual('The whole city is safe for Alex! :-)')
87+
expect(adviceForAda(agents)).toEqual('The whole city is safe for Ada! :-)')
8888
})
8989
})

python/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ This will also install numpy and scipy for your convenience. However, you are no
4747

4848
### Creating the solution
4949

50-
You should see the file `safe_spaces.py`, which contains a class definition for a class named `SafetyFinder`. This class contains three methods: `convert_coordinates`, `find_safe_spaces`, and `advice_for_alex`.
50+
You should see the file `safe_spaces.py`, which contains a class definition for a class named `SafetyFinder`. This class contains three methods: `convert_coordinates`, `find_safe_spaces`, and `advice_for_ada`.
5151

52-
There are three levels to the challenge. In the first level you are asked to convert alphanumeric map coordinates (e.g. 'A3') to a more easily handled form. In the next level, you are asked to find the "safe spaces" in the map. Finally, in the last level, you are asked to provide feedback to Alex and to handle any edge cases.
52+
There are three levels to the challenge. In the first level you are asked to convert alphanumeric map coordinates (e.g. 'A3') to a more easily handled form. In the next level, you are asked to find the "safe spaces" in the map. Finally, in the last level, you are asked to provide feedback to Ada and to handle any edge cases.
5353

5454
For each method, we are expecting `agents` to be a list of coordinates, e.g.
5555

python/safe_spaces.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class SafetyFinder:
44
"""A class that contains everything we need to find the
5-
safest places in the city for Alex to hide out
5+
safest places in the city for Ada to hide out
66
"""
77

88
def convert_coordinates(self, agents):
@@ -19,7 +19,7 @@ def convert_coordinates(self, agents):
1919

2020
def find_safe_spaces(self, agents):
2121
"""This method will take an array with agent locations and find
22-
the safest places in the city for Alex to hang out.
22+
the safest places in the city for Ada to hang out.
2323
2424
Arguments:
2525
agents -- a list-like object containing the map coordinates of agents.
@@ -30,16 +30,16 @@ def find_safe_spaces(self, agents):
3030
"""
3131
pass
3232

33-
def advice_for_alex(self, agents):
33+
def advice_for_ada(self, agents):
3434
"""This method will take an array with agent locations and offer advice
35-
to Alex for where she should hide out in the city, with special advice for
35+
to Ada for where she should hide out in the city, with special advice for
3636
edge cases.
3737
3838
Arguments:
3939
agents -- a list-like object containing the map coordinates of the agents.
4040
Each entry should be formatted in alphanumeric form, e.g. A10, E6, etc.
4141
42-
Returns either a list of alphanumeric map coordinates for Alex to hide in,
42+
Returns either a list of alphanumeric map coordinates for Ada to hide in,
4343
or a specialized message informing her of edge cases
4444
"""
4545
pass

python/safe_spaces_test.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def test_safe_spaces_round3(self):
5757
# Level 3 -- Handling edge cases and offering recommendations
5858
def test_no_agents(self):
5959
"""Tests for no agents in the city"""
60-
self.assertEqual(SafetyFinder().advice_for_alex([]),
61-
'The whole city is safe for Alex! :-)')
60+
self.assertEqual(SafetyFinder().advice_for_ada([]),
61+
'The whole city is safe for Ada! :-)')
6262

6363
def test_agents_everywhere(self):
6464
"""Tests for agents everywhere in the city. Oh no!!"""
@@ -72,39 +72,39 @@ def test_agents_everywhere(self):
7272
'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'H7', 'H8', 'H9', 'H10',
7373
'I1', 'I2', 'I3', 'I4', 'I5', 'I6', 'I7', 'I8', 'I9', 'I10',
7474
'J1', 'J2', 'J3', 'J4', 'J5', 'J6', 'J7', 'J8', 'J9', 'J10']
75-
self.assertEqual(SafetyFinder().advice_for_alex(agents),
76-
'There are no safe locations for Alex! :-(')
75+
self.assertEqual(SafetyFinder().advice_for_ada(agents),
76+
'There are no safe locations for Ada! :-(')
7777

7878
def test_advice_round1(self):
7979
"""Test for six agents at specified locations"""
8080
agents = ['B2', 'D6', 'E9', 'H4', 'H9', 'J2']
81-
self.assertEqual(sorted(SafetyFinder().advice_for_alex(agents)),
81+
self.assertEqual(sorted(SafetyFinder().advice_for_ada(agents)),
8282
sorted(['A10', 'A8', 'F1']))
8383

8484
def test_advice_round2(self):
8585
"""Test for seven agents at specified locations"""
8686
agents = ['B4', 'C4', 'C8', 'E2', 'F10', 'H1', 'J6']
87-
self.assertEqual(sorted(SafetyFinder().advice_for_alex(agents)),
87+
self.assertEqual(sorted(SafetyFinder().advice_for_ada(agents)),
8888
sorted(['A1', 'A10', 'E6', 'F5', 'F6', 'G4', 'G5',
8989
'G7', 'H8', 'I9', 'J10']))
9090

9191
def test_advice_round3(self):
9292
"""Test for a different six agents at specified locations"""
9393
agents = ['A1', 'A10', 'B6', 'F2', 'J1', 'J10']
94-
self.assertEqual(sorted(SafetyFinder().advice_for_alex(agents)),
94+
self.assertEqual(sorted(SafetyFinder().advice_for_ada(agents)),
9595
sorted(['F8', 'G7', 'H6']))
9696

9797
def test_advice_round4(self):
9898
"""Test when only a single agent remains in the city"""
9999
agents = ['A1']
100-
self.assertEqual(sorted(SafetyFinder().advice_for_alex(agents)),
100+
self.assertEqual(sorted(SafetyFinder().advice_for_ada(agents)),
101101
sorted(['J10']))
102102

103103
def test_agent_outside_map(self):
104104
"""Test when only a single agent remains in the city"""
105105
agents = ['A12']
106-
self.assertEqual(SafetyFinder().advice_for_alex(agents),
107-
'The whole city is safe for Alex! :-)')
106+
self.assertEqual(SafetyFinder().advice_for_ada(agents),
107+
'The whole city is safe for Ada! :-)')
108108

109109

110110
if __name__ == '__main__':

ruby/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ To run the test, type in: `bundle exec rspec run.rb`
1414

1515
### Creating the solution
1616

17-
All things are located in the file run.rb. There you will find three defintions of functions: convert_coordinates(agents), find_safe_spaces(agents) and advice_for_alex(agents).
17+
All things are located in the file run.rb. There you will find three defintions of functions: convert_coordinates(agents), find_safe_spaces(agents) and advice_for_ada(agents).
1818

1919
For each function exists a suite of rspec-tests with example input and exprected results from the function. You can find all the requirements of the challenge in this tests.
2020

ruby/run.rb

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def convert_coordinates(agents)
77
def find_safe_spaces(agents)
88
end
99

10-
def advice_for_alex(agents)
10+
def advice_for_ada(agents)
1111
end
1212

1313
# Please enable Level 1, 2, 3-Tests by replacing xdescribe with describe!
@@ -55,10 +55,10 @@ def advice_for_alex(agents)
5555
end
5656
end
5757

58-
RSpec.xdescribe 'Spy Places Level 3 - find edge cases and give advice to Alex' do
58+
RSpec.xdescribe 'Spy Places Level 3 - find edge cases and give advice to Ada' do
5959
it 'expects all save places at no agents' do
6060
agents = []
61-
expect(advice_for_alex(agents)).to eq('The whole city is safe for Alex! :-)')
61+
expect(advice_for_ada(agents)).to eq('The whole city is safe for Ada! :-)')
6262
end
6363

6464
it 'no place is save if agents are everywhere' do
@@ -73,32 +73,32 @@ def advice_for_alex(agents)
7373
'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'H7', 'H8', 'H9', 'H10',
7474
'I1', 'I2', 'I3', 'I4', 'I5', 'I6', 'I7', 'I8', 'I9', 'I10',
7575
'J1', 'J2', 'J3', 'J4', 'J5', 'J6', 'J7', 'J8', 'J9', 'J10']
76-
expect(advice_for_alex(agents)).to eq('There are no safe locations for Alex! :-(')
76+
expect(advice_for_ada(agents)).to eq('There are no safe locations for Ada! :-(')
7777
end
7878

7979
it 'some places are save if agents are some' do
8080
agents =
8181
['B2', 'D6', 'E9', 'H4', 'H9', 'J2']
82-
expect(advice_for_alex(agents)).to match_array(['A10', 'A8', 'F1'])
82+
expect(advice_for_ada(agents)).to match_array(['A10', 'A8', 'F1'])
8383
end
8484
it 'some places are save if agents are some' do
8585
agents =
8686
['B4', 'C4', 'C8', 'E2', 'F10', 'H1', 'J6']
87-
expect(advice_for_alex(agents)).to match_array(['A1', 'A10', 'E6', 'F5', 'F6', 'G4', 'G5', 'G7', 'H8', 'I9', 'J10'])
87+
expect(advice_for_ada(agents)).to match_array(['A1', 'A10', 'E6', 'F5', 'F6', 'G4', 'G5', 'G7', 'H8', 'I9', 'J10'])
8888
end
8989
it 'some places are save if agents are some' do
9090
agents =
9191
['A1', 'A10', 'B6', 'F2', 'J1', 'J10']
92-
expect(advice_for_alex(agents)).to match_array(['F8', 'G7', 'H6'])
92+
expect(advice_for_ada(agents)).to match_array(['F8', 'G7', 'H6'])
9393
end
9494
it 'one save place' do
9595
agents =
9696
['A1']
97-
expect(advice_for_alex(agents)).to match_array(['J10'])
97+
expect(advice_for_ada(agents)).to match_array(['J10'])
9898
end
9999
it 'agent outside the city' do
100100
agents =
101101
['A12']
102-
expect(advice_for_alex(agents)).to eq('The whole city is safe for Alex! :-)')
102+
expect(advice_for_ada(agents)).to eq('The whole city is safe for Ada! :-)')
103103
end
104104
end

0 commit comments

Comments
 (0)